Passed
Push — master ( 2632ed...8bf7c9 )
by Brian
05:05
created
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'addons' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'addons' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51 51
 
52 52
     }
53 53
 
54 54
     /**
55
-	 * Process Payment.
56
-	 *
57
-	 *
58
-	 * @param WPInv_Invoice $invoice Invoice.
59
-	 * @param array $submission_data Posted checkout fields.
60
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
-	 * @return array
62
-	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
55
+     * Process Payment.
56
+     *
57
+     *
58
+     * @param WPInv_Invoice $invoice Invoice.
59
+     * @param array $submission_data Posted checkout fields.
60
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
+     * @return array
62
+     */
63
+    public function process_payment( $invoice, $submission_data, $submission ) {
64 64
 
65 65
         // Add a transaction id.
66 66
         $invoice->set_transaction_id( $invoice->generate_key('trans_') );
@@ -81,66 +81,66 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     /**
84
-	 * Output for the order received page.
85
-	 *
86
-	 * @param WPInv_Invoice $invoice Invoice.
87
-	 */
88
-	public function thankyou_page( $invoice ) {
84
+     * Output for the order received page.
85
+     *
86
+     * @param WPInv_Invoice $invoice Invoice.
87
+     */
88
+    public function thankyou_page( $invoice ) {
89 89
 
90 90
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
91 91
 
92
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
92
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94 94
             if ( ! empty( $this->instructions ) ) {
95 95
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
96
-			}
96
+            }
97 97
 
98
-			$this->bank_details( $invoice );
98
+            $this->bank_details( $invoice );
99 99
 
100
-			echo '</div>';
100
+            echo '</div>';
101 101
 
102 102
         }
103 103
 
104
-	}
104
+    }
105 105
 
106 106
     /**
107
-	 * Add content to the WPI emails.
108
-	 *
109
-	 * @param WPInv_Invoice $invoice Invoice.
110
-	 * @param string     $email_type Email format: plain text or HTML.
111
-	 * @param bool     $sent_to_admin Sent to admin.
112
-	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
107
+     * Add content to the WPI emails.
108
+     *
109
+     * @param WPInv_Invoice $invoice Invoice.
110
+     * @param string     $email_type Email format: plain text or HTML.
111
+     * @param bool     $sent_to_admin Sent to admin.
112
+     */
113
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116 116
 
117
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
117
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+            if ( $this->instructions ) {
120
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+            $this->bank_details( $invoice );
124 124
 			
125
-			echo '</div>';
125
+            echo '</div>';
126 126
 
127
-		}
127
+        }
128 128
 
129 129
     }
130 130
     
131 131
     /**
132
-	 * Get bank details and place into a list format.
133
-	 *
134
-	 * @param WPInv_Invoice $invoice Invoice.
135
-	 */
136
-	protected function bank_details( $invoice ) {
132
+     * Get bank details and place into a list format.
133
+     *
134
+     * @param WPInv_Invoice $invoice Invoice.
135
+     */
136
+    protected function bank_details( $invoice ) {
137 137
 
138
-		// Get the invoice country and country $locale.
139
-		$country = $invoice->get_country();
140
-		$locale  = $this->get_country_locale();
138
+        // Get the invoice country and country $locale.
139
+        $country = $invoice->get_country();
140
+        $locale  = $this->get_country_locale();
141 141
 
142
-		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
142
+        // Get sortcode label in the $locale array and use appropriate one.
143
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
144 144
 
145 145
         $bank_fields = array(
146 146
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -169,144 +169,144 @@  discard block
 block discarded – undo
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
173 173
 
174
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
174
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+        foreach ( $bank_info as $key => $data ) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+            $key   = sanitize_html_class( $key );
179
+            $label = wp_kses_post( $data['label'] );
180
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
181 181
 
182
-			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
-		}
182
+            echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
+        }
184 184
 
185
-		echo '</table>';
185
+        echo '</table>';
186 186
 
187 187
     }
188 188
     
189 189
     /**
190
-	 * Get country locale if localized.
191
-	 *
192
-	 * @return array
193
-	 */
194
-	public function get_country_locale() {
195
-
196
-		if ( empty( $this->locale ) ) {
197
-
198
-			// Locale information to be used - only those that are not 'Sort Code'.
199
-			$this->locale = apply_filters(
200
-				'getpaid_get_bank_transfer_locale',
201
-				array(
202
-					'AU' => array(
203
-						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
205
-						),
206
-					),
207
-					'CA' => array(
208
-						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
210
-						),
211
-					),
212
-					'IN' => array(
213
-						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
215
-						),
216
-					),
217
-					'IT' => array(
218
-						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
220
-						),
221
-					),
222
-					'NZ' => array(
223
-						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
225
-						),
226
-					),
227
-					'SE' => array(
228
-						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
230
-						),
231
-					),
232
-					'US' => array(
233
-						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
235
-						),
236
-					),
237
-					'ZA' => array(
238
-						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
240
-						),
241
-					),
242
-				)
243
-			);
244
-
245
-		}
246
-
247
-		return $this->locale;
248
-
249
-	}
250
-
251
-	/**
252
-	 * Filters the gateway settings.
253
-	 * 
254
-	 * @param array $admin_settings
255
-	 */
256
-	public function admin_settings( $admin_settings ) {
190
+     * Get country locale if localized.
191
+     *
192
+     * @return array
193
+     */
194
+    public function get_country_locale() {
195
+
196
+        if ( empty( $this->locale ) ) {
197
+
198
+            // Locale information to be used - only those that are not 'Sort Code'.
199
+            $this->locale = apply_filters(
200
+                'getpaid_get_bank_transfer_locale',
201
+                array(
202
+                    'AU' => array(
203
+                        'sortcode' => array(
204
+                            'label' => __( 'BSB', 'invoicing' ),
205
+                        ),
206
+                    ),
207
+                    'CA' => array(
208
+                        'sortcode' => array(
209
+                            'label' => __( 'Bank transit number', 'invoicing' ),
210
+                        ),
211
+                    ),
212
+                    'IN' => array(
213
+                        'sortcode' => array(
214
+                            'label' => __( 'IFSC', 'invoicing' ),
215
+                        ),
216
+                    ),
217
+                    'IT' => array(
218
+                        'sortcode' => array(
219
+                            'label' => __( 'Branch sort', 'invoicing' ),
220
+                        ),
221
+                    ),
222
+                    'NZ' => array(
223
+                        'sortcode' => array(
224
+                            'label' => __( 'Bank code', 'invoicing' ),
225
+                        ),
226
+                    ),
227
+                    'SE' => array(
228
+                        'sortcode' => array(
229
+                            'label' => __( 'Bank code', 'invoicing' ),
230
+                        ),
231
+                    ),
232
+                    'US' => array(
233
+                        'sortcode' => array(
234
+                            'label' => __( 'Routing number', 'invoicing' ),
235
+                        ),
236
+                    ),
237
+                    'ZA' => array(
238
+                        'sortcode' => array(
239
+                            'label' => __( 'Branch code', 'invoicing' ),
240
+                        ),
241
+                    ),
242
+                )
243
+            );
244
+
245
+        }
246
+
247
+        return $this->locale;
248
+
249
+    }
250
+
251
+    /**
252
+     * Filters the gateway settings.
253
+     * 
254
+     * @param array $admin_settings
255
+     */
256
+    public function admin_settings( $admin_settings ) {
257 257
 
258 258
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
259
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+        $locale  = $this->get_country_locale();
262 262
 
263
-		// Get sortcode label in the $locale array and use appropriate one.
264
-		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
263
+        // Get sortcode label in the $locale array and use appropriate one.
264
+        $country  = wpinv_default_billing_country();
265
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
266 266
 
267
-		$admin_settings['bank_transfer_ac_name'] = array(
267
+        $admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270 270
             'name' => __( 'Account Name', 'invoicing' ),
271
-		);
271
+        );
272 272
 		
273
-		$admin_settings['bank_transfer_ac_no'] = array(
273
+        $admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276 276
             'name' => __( 'Account Number', 'invoicing' ),
277
-		);
277
+        );
278 278
 		
279
-		$admin_settings['bank_transfer_bank_name'] = array(
279
+        $admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282 282
             'name' => __( 'Bank Name', 'invoicing' ),
283
-		);
283
+        );
284 284
 
285
-		$admin_settings['bank_transfer_ifsc'] = array(
285
+        $admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288 288
             'name' => __( 'IFSC Code', 'invoicing' ),
289
-		);
289
+        );
290 290
 
291
-		$admin_settings['bank_transfer_iban'] = array(
291
+        $admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294 294
             'name' => __( 'IBAN', 'invoicing' ),
295
-		);
295
+        );
296 296
 
297
-		$admin_settings['bank_transfer_bic'] = array(
297
+        $admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300 300
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
301
-		);
301
+        );
302 302
 		
303
-		$admin_settings['bank_transfer_sort_code'] = array(
304
-			'type' => 'text',
305
-			'id'   => 'bank_transfer_sort_code',
306
-			'name' => $sortcode,
307
-		);
303
+        $admin_settings['bank_transfer_sort_code'] = array(
304
+            'type' => 'text',
305
+            'id'   => 'bank_transfer_sort_code',
306
+            'name' => $sortcode,
307
+        );
308 308
 
309
-		$admin_settings['bank_transfer_info'] = array(
309
+        $admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311 311
             'name' => __( 'Instructions', 'invoicing' ),
312 312
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
             'rows' => 5
317 317
         );
318 318
 
319
-		return $admin_settings;
320
-	}
319
+        return $admin_settings;
320
+    }
321 321
 
322
-	/**
323
-	 * Processes invoice addons.
324
-	 *
325
-	 * @param WPInv_Invoice $invoice
326
-	 * @param GetPaid_Form_Item[] $items
327
-	 * @return WPInv_Invoice
328
-	 */
329
-	public function process_addons( $invoice, $items ) {
322
+    /**
323
+     * Processes invoice addons.
324
+     *
325
+     * @param WPInv_Invoice $invoice
326
+     * @param GetPaid_Form_Item[] $items
327
+     * @return WPInv_Invoice
328
+     */
329
+    public function process_addons( $invoice, $items ) {
330 330
 
331 331
         foreach ( $items as $item ) {
332 332
             $invoice->add_item( $item );
@@ -334,6 +334,6 @@  discard block
 block discarded – undo
334 334
 
335 335
         $invoice->recalculate_total();
336 336
         $invoice->save();
337
-	}
337
+    }
338 338
 
339 339
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Bank transfer Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected $supports = array( 'addons' );
27
+	protected $supports = array('addons');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
43
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
44
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
42
+        $this->title                = __('Direct bank transfer', 'invoicing');
43
+        $this->method_title         = __('Bank transfer', 'invoicing');
44
+        $this->checkout_button_text = __('Proceed', 'invoicing');
45
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
48
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
49
+		add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11);
50
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
51 51
 
52 52
     }
53 53
 
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61 61
 	 * @return array
62 62
 	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
63
+	public function process_payment($invoice, $submission_data, $submission) {
64 64
 
65 65
         // Add a transaction id.
66
-        $invoice->set_transaction_id( $invoice->generate_key('trans_') );
66
+        $invoice->set_transaction_id($invoice->generate_key('trans_'));
67 67
 
68 68
         // Set it as pending payment.
69
-        if ( ! $invoice->needs_payment() ) {
69
+        if (!$invoice->needs_payment()) {
70 70
             $invoice->mark_paid();
71
-        } else if ( ! $invoice->is_paid() ) {
72
-            $invoice->set_status( 'wpi-onhold' );
71
+        } else if (!$invoice->is_paid()) {
72
+            $invoice->set_status('wpi-onhold');
73 73
         }
74 74
 
75 75
         // Save it.
76 76
         $invoice->save();
77 77
 
78 78
         // Send to the success page.
79
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
79
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
80 80
 
81 81
     }
82 82
 
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param WPInv_Invoice $invoice Invoice.
87 87
 	 */
88
-	public function thankyou_page( $invoice ) {
88
+	public function thankyou_page($invoice) {
89 89
 
90
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
90
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
91 91
 
92 92
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94
-            if ( ! empty( $this->instructions ) ) {
95
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
94
+            if (!empty($this->instructions)) {
95
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
96 96
 			}
97 97
 
98
-			$this->bank_details( $invoice );
98
+			$this->bank_details($invoice);
99 99
 
100 100
 			echo '</div>';
101 101
 
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * @param string     $email_type Email format: plain text or HTML.
111 111
 	 * @param bool     $sent_to_admin Sent to admin.
112 112
 	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
113
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
116 116
 
117 117
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+			if ($this->instructions) {
120
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+			$this->bank_details($invoice);
124 124
 			
125 125
 			echo '</div>';
126 126
 
@@ -133,51 +133,51 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param WPInv_Invoice $invoice Invoice.
135 135
 	 */
136
-	protected function bank_details( $invoice ) {
136
+	protected function bank_details($invoice) {
137 137
 
138 138
 		// Get the invoice country and country $locale.
139 139
 		$country = $invoice->get_country();
140 140
 		$locale  = $this->get_country_locale();
141 141
 
142 142
 		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
144 144
 
145 145
         $bank_fields = array(
146
-            'ac_name'     => __( 'Account Name', 'invoicing' ),
147
-            'ac_no'       => __( 'Account Number', 'invoicing' ),
148
-            'bank_name'   => __( 'Bank Name', 'invoicing' ),
149
-            'ifsc'        => __( 'IFSC code', 'invoicing' ),
150
-            'iban'        => __( 'IBAN', 'invoicing' ),
151
-            'bic'         => __( 'BIC/Swift code', 'invoicing' ),
146
+            'ac_name'     => __('Account Name', 'invoicing'),
147
+            'ac_no'       => __('Account Number', 'invoicing'),
148
+            'bank_name'   => __('Bank Name', 'invoicing'),
149
+            'ifsc'        => __('IFSC code', 'invoicing'),
150
+            'iban'        => __('IBAN', 'invoicing'),
151
+            'bic'         => __('BIC/Swift code', 'invoicing'),
152 152
             'sort_code'   => $sortcode,
153 153
         );
154 154
 
155 155
         $bank_info = array();
156 156
 
157
-        foreach ( $bank_fields as $field => $label ) {
158
-            $value = $this->get_option( $field );
157
+        foreach ($bank_fields as $field => $label) {
158
+            $value = $this->get_option($field);
159 159
 
160
-            if ( ! empty( $value ) ) {
161
-                $bank_info[$field] = array( 'label' => $label, 'value' => $value );
160
+            if (!empty($value)) {
161
+                $bank_info[$field] = array('label' => $label, 'value' => $value);
162 162
             }
163 163
 
164 164
         }
165 165
 
166
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info );
166
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info);
167 167
 
168
-        if ( empty( $bank_info ) ) {
168
+        if (empty($bank_info)) {
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL;
173 173
 
174 174
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+		foreach ($bank_info as $key => $data) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+			$key   = sanitize_html_class($key);
179
+			$label = wp_kses_post($data['label']);
180
+			$value = wp_kses_post(wptexturize($data['value']));
181 181
 
182 182
 			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183 183
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function get_country_locale() {
195 195
 
196
-		if ( empty( $this->locale ) ) {
196
+		if (empty($this->locale)) {
197 197
 
198 198
 			// Locale information to be used - only those that are not 'Sort Code'.
199 199
 			$this->locale = apply_filters(
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
 				array(
202 202
 					'AU' => array(
203 203
 						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
204
+							'label' => __('BSB', 'invoicing'),
205 205
 						),
206 206
 					),
207 207
 					'CA' => array(
208 208
 						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
209
+							'label' => __('Bank transit number', 'invoicing'),
210 210
 						),
211 211
 					),
212 212
 					'IN' => array(
213 213
 						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
214
+							'label' => __('IFSC', 'invoicing'),
215 215
 						),
216 216
 					),
217 217
 					'IT' => array(
218 218
 						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
219
+							'label' => __('Branch sort', 'invoicing'),
220 220
 						),
221 221
 					),
222 222
 					'NZ' => array(
223 223
 						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
224
+							'label' => __('Bank code', 'invoicing'),
225 225
 						),
226 226
 					),
227 227
 					'SE' => array(
228 228
 						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
229
+							'label' => __('Bank code', 'invoicing'),
230 230
 						),
231 231
 					),
232 232
 					'US' => array(
233 233
 						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
234
+							'label' => __('Routing number', 'invoicing'),
235 235
 						),
236 236
 					),
237 237
 					'ZA' => array(
238 238
 						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
239
+							'label' => __('Branch code', 'invoicing'),
240 240
 						),
241 241
 					),
242 242
 				)
@@ -253,51 +253,51 @@  discard block
 block discarded – undo
253 253
 	 * 
254 254
 	 * @param array $admin_settings
255 255
 	 */
256
-	public function admin_settings( $admin_settings ) {
256
+	public function admin_settings($admin_settings) {
257 257
 
258
-        $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258
+        $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
259
+		$admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing');
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+		$locale = $this->get_country_locale();
262 262
 
263 263
 		// Get sortcode label in the $locale array and use appropriate one.
264 264
 		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
265
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
266 266
 
267 267
 		$admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270
-            'name' => __( 'Account Name', 'invoicing' ),
270
+            'name' => __('Account Name', 'invoicing'),
271 271
 		);
272 272
 		
273 273
 		$admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276
-            'name' => __( 'Account Number', 'invoicing' ),
276
+            'name' => __('Account Number', 'invoicing'),
277 277
 		);
278 278
 		
279 279
 		$admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282
-            'name' => __( 'Bank Name', 'invoicing' ),
282
+            'name' => __('Bank Name', 'invoicing'),
283 283
 		);
284 284
 
285 285
 		$admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288
-            'name' => __( 'IFSC Code', 'invoicing' ),
288
+            'name' => __('IFSC Code', 'invoicing'),
289 289
 		);
290 290
 
291 291
 		$admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294
-            'name' => __( 'IBAN', 'invoicing' ),
294
+            'name' => __('IBAN', 'invoicing'),
295 295
 		);
296 296
 
297 297
 		$admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
300
+            'name' => __('BIC/Swift Code', 'invoicing'),
301 301
 		);
302 302
 		
303 303
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 
309 309
 		$admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311
-            'name' => __( 'Instructions', 'invoicing' ),
312
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
311
+            'name' => __('Instructions', 'invoicing'),
312
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
313 313
             'type' => 'textarea',
314
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
314
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
315 315
             'cols' => 50,
316 316
             'rows' => 5
317 317
         );
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @param GetPaid_Form_Item[] $items
327 327
 	 * @return WPInv_Invoice
328 328
 	 */
329
-	public function process_addons( $invoice, $items ) {
329
+	public function process_addons($invoice, $items) {
330 330
 
331
-        foreach ( $items as $item ) {
332
-            $invoice->add_item( $item );
331
+        foreach ($items as $item) {
332
+            $invoice->add_item($item);
333 333
         }
334 334
 
335 335
         $invoice->recalculate_total();
Please login to merge, or discard this patch.
templates/invoice/invoice-meta.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$class = ! is_singular( 'page' ) ? 'px-1' : '';
12
+$class = !is_singular('page') ? 'px-1' : '';
13 13
 ?>
14 14
 
15
-        <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?>
15
+        <?php do_action('getpaid_before_invoice_meta', $invoice); ?>
16 16
         <div class="getpaid-invoice-meta-data">
17 17
 
18
-            <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?>
18
+            <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?>
19 19
             <table class="table table-bordered">
20 20
                 <tbody>
21 21
 
22
-                    <?php do_action( "getpaid_before_invoice_meta_rows", $invoice ); ?>
23
-                    <?php foreach ( $meta as $key => $data ) : ?>
22
+                    <?php do_action("getpaid_before_invoice_meta_rows", $invoice); ?>
23
+                    <?php foreach ($meta as $key => $data) : ?>
24 24
 
25
-                        <?php if ( ! empty( $data['value'] ) ) : ?>
25
+                        <?php if (!empty($data['value'])) : ?>
26 26
 
27
-                            <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?>
27
+                            <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?>
28 28
 
29
-                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>">
29
+                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>">
30 30
 
31 31
                                 <th class="<?php echo $class; ?> font-weight-bold">
32
-                                    <?php echo sanitize_text_field( $data['label'] ); ?>
32
+                                    <?php echo sanitize_text_field($data['label']); ?>
33 33
                                 </th>
34 34
 
35 35
                                 <td class="<?php echo $class; ?> <?php echo $key == 'invoice_total' ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break w-75">
36
-                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span>
36
+                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span>
37 37
                                 </td>
38 38
 
39 39
                             </tr>
40 40
 
41
-                            <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?>
41
+                            <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?>
42 42
 
43 43
                         <?php endif; ?>
44 44
                     
45 45
                     <?php endforeach; ?>
46
-                    <?php do_action( "getpaid_after_invoice_meta_rows", $invoice ); ?>
46
+                    <?php do_action("getpaid_after_invoice_meta_rows", $invoice); ?>
47 47
 
48 48
                 </tbody>
49 49
             </table>
50
-            <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?>
50
+            <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?>
51 51
 
52 52
 
53 53
         </div>
54
-        <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?>
54
+        <?php do_action('getpaid_after_invoice_meta', $invoice); ?>
55 55
 
56 56
 <?php
Please login to merge, or discard this patch.
templates/frontend-head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
Please login to merge, or discard this patch.
templates/frontend-footer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		<div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;">
17 17
 			<div class="modal-content">
18 18
 				<div class="modal-body">
19
-					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__( 'Close', 'invoicing' ); ?>">
19
+					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__('Close', 'invoicing'); ?>">
20 20
 						<i class="fa fa-times" aria-hidden="true"></i>
21 21
 					</button>
22 22
 					<div class="modal-body-wrapper"></div>
Please login to merge, or discard this patch.
templates/invoice/company-address.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Prepare the company name.
13
-$company_name = wpinv_get_option( 'vat_company_name' );
13
+$company_name = wpinv_get_option('vat_company_name');
14 14
 
15
-if ( empty( $company_name ) ) {
15
+if (empty($company_name)) {
16 16
     $company_name = wpinv_get_business_name();
17 17
 }
18 18
 
19 19
 // Prepare the VAT number.
20
-$vat_number = wpinv_get_option( 'vat_number' );
20
+$vat_number = wpinv_get_option('vat_number');
21 21
 
22 22
 ?>
23 23
     <div class="getpaid-company-address form-group">
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
         <div class="row">
26 26
 
27 27
             <div class="invoice-company-address-label col-2">
28
-                <strong><?php _e( 'From:', 'invoicing' ) ?></strong>
28
+                <strong><?php _e('From:', 'invoicing') ?></strong>
29 29
             </div>
30 30
 
31 31
             <div class="invoice-company-address-value col-10">
32 32
 
33
-                <?php do_action( 'getpaid_company_address_top' ); ?>
33
+                <?php do_action('getpaid_company_address_top'); ?>
34 34
 
35 35
                 <div class="name">
36
-                    <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>">
37
-                        <?php echo esc_html( $company_name ); ?>
36
+                    <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>">
37
+                        <?php echo esc_html($company_name); ?>
38 38
                     </a>
39 39
                 </div>
40 40
 
41
-                <?php if ( $address = wpinv_get_business_address() ) { ?>
42
-                    <?php echo $address;?>
41
+                <?php if ($address = wpinv_get_business_address()) { ?>
42
+                    <?php echo $address; ?>
43 43
                 <?php } ?>
44 44
 
45
-                <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?>
45
+                <?php if ($email_from = wpinv_mail_get_from_address()) { ?>
46 46
                     <div class="email_from">
47
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), $email_from );?>
47
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), $email_from); ?>
48 48
                     </div>
49 49
                 <?php } ?>
50 50
 
51
-                <?php if ( ! empty( $vat_number ) ) { ?>
51
+                <?php if (!empty($vat_number)) { ?>
52 52
                     <div class="email_from">
53
-                        <?php echo wp_sprintf( __( 'VAT Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) );?>
53
+                        <?php echo wp_sprintf(__('VAT Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?>
54 54
                     </div>
55 55
                 <?php } ?>
56 56
 
57
-                <?php do_action( 'getpaid_company_address_bottom' ); ?>
57
+                <?php do_action('getpaid_company_address_bottom'); ?>
58 58
 
59 59
             </div>
60 60
 
Please login to merge, or discard this patch.
templates/invoice/billing-address.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
12
+$invoice     = new WPInv_Invoice($invoice);
13
+$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info());
14 14
 $phone       = $invoice->get_phone();
15 15
 $email       = $invoice->get_email();
16 16
 $vat_number  = $invoice->get_vat_number();
@@ -21,41 +21,41 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
             <div class="invoice-billing-address-label col-2">
24
-                <strong><?php _e( 'To:', 'invoicing' ) ?></strong>
24
+                <strong><?php _e('To:', 'invoicing') ?></strong>
25 25
             </div>
26 26
 
27 27
 
28 28
             <div class="invoice-billing-address-value col-10">
29 29
 
30
-                <?php do_action( 'getpaid_billing_address_top' ); ?>
30
+                <?php do_action('getpaid_billing_address_top'); ?>
31 31
 
32
-                <?php if ( ! empty( $address_row ) ) : ?>
32
+                <?php if (!empty($address_row)) : ?>
33 33
                     <div class="billing-address">
34 34
                         <?php echo $address_row; ?>
35 35
                     </div>
36 36
                 <?php endif; ?>
37 37
 
38 38
 
39
-                <?php if ( ! empty( $phone ) ) : ?>
39
+                <?php if (!empty($phone)) : ?>
40 40
                     <div class="billing-phone">
41
-                        <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
41
+                        <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?>
42 42
                     </div>
43 43
                 <?php endif; ?>
44 44
 
45 45
 
46
-                <?php if ( ! empty( $email ) ) : ?>
46
+                <?php if (!empty($email)) : ?>
47 47
                     <div class="billing-email">
48
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?>
48
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?>
49 49
                     </div>
50 50
                 <?php endif; ?>
51 51
 
52
-                <?php if ( ! empty( $vat_number ) ) : ?>
52
+                <?php if (!empty($vat_number)) : ?>
53 53
                     <div class="vat-number">
54
-                        <?php echo wp_sprintf( __( 'Vat Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) ); ?>
54
+                        <?php echo wp_sprintf(__('Vat Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?>
55 55
                     </div>
56 56
                 <?php endif; ?>
57 57
 
58
-                <?php do_action( 'getpaid_billing_address_bottom' ); ?>
58
+                <?php do_action('getpaid_billing_address_bottom'); ?>
59 59
 
60 60
             </div>
61 61
 
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -24,64 +24,64 @@  discard block
 block discarded – undo
24 24
 
25 25
 				<?php
26 26
 
27
-					// Fires before printing a line item column.
28
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
27
+                    // Fires before printing a line item column.
28
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29 29
 
30
-					// Item name.
31
-					if ( 'name' == $key ) {
30
+                    // Item name.
31
+                    if ( 'name' == $key ) {
32 32
 
33
-						// Display the name.
34
-						echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
33
+                        // Display the name.
34
+                        echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
35 35
 
36
-						// And an optional description.
36
+                        // And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39 39
                         if ( ! empty( $description ) ) {
40 40
                             $description = wp_kses_post( $description );
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42
-						}
42
+                        }
43 43
 
44
-						// Price help text.
44
+                        // Price help text.
45 45
                         $description = getpaid_item_recurring_price_help_text( $item, $currency );
46 46
                         if ( $description ) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48
-						}
48
+                        }
49 49
 
50
-					}
50
+                    }
51 51
 
52
-					// Item price.
53
-					if ( 'price' == $key ) {
52
+                    // Item price.
53
+                    if ( 'price' == $key ) {
54 54
 
55
-						// Set the currency position.
56
-						$position = wpinv_currency_position();
55
+                        // Set the currency position.
56
+                        $position = wpinv_currency_position();
57 57
 
58
-						if ( $position == 'left_space' ) {
59
-							$position = 'left';
60
-						}
58
+                        if ( $position == 'left_space' ) {
59
+                            $position = 'left';
60
+                        }
61 61
 
62
-						if ( $position == 'right_space' ) {
63
-							$position = 'right';
64
-						}
62
+                        if ( $position == 'right_space' ) {
63
+                            $position = 'right';
64
+                        }
65 65
 
66
-						if ( $item->user_can_set_their_price() ) {
67
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
68
-							$minimum          = (float) $item->get_minimum_price();
69
-							$validate_minimum = '';
70
-							$class            = '';
71
-							$data_minimum     = '';
66
+                        if ( $item->user_can_set_their_price() ) {
67
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
68
+                            $minimum          = (float) $item->get_minimum_price();
69
+                            $validate_minimum = '';
70
+                            $class            = '';
71
+                            $data_minimum     = '';
72 72
 
73
-							if ( $minimum > 0 ) {
74
-								$validate_minimum = sprintf(
75
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
-									sanitize_text_field( wpinv_price( $minimum, $currency ) )
77
-								);
73
+                            if ( $minimum > 0 ) {
74
+                                $validate_minimum = sprintf(
75
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
+                                    sanitize_text_field( wpinv_price( $minimum, $currency ) )
77
+                                );
78 78
 
79
-								$class = 'getpaid-validate-minimum-amount';
79
+                                $class = 'getpaid-validate-minimum-amount';
80 80
 
81
-								$data_minimum     = "data-minimum-amount='$minimum'";
82
-							}
81
+                                $data_minimum     = "data-minimum-amount='$minimum'";
82
+                            }
83 83
 
84
-							?>
84
+                            ?>
85 85
 								<div class="input-group input-group-sm">
86 86
 									<?php if( 'left' == $position ) : ?>
87 87
 										<div class="input-group-prepend">
@@ -105,37 +105,37 @@  discard block
 block discarded – undo
105 105
 								</div>
106 106
 
107 107
 							<?php
108
-						} else {
109
-							echo wpinv_price( $item->get_price(), $currency );
110
-							?>
108
+                        } else {
109
+                            echo wpinv_price( $item->get_price(), $currency );
110
+                            ?>
111 111
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
112 112
 							<?php
113
-						}
114
-					}
113
+                        }
114
+                    }
115 115
 
116
-					// Item quantity.
117
-					if ( 'quantity' == $key ) {
116
+                    // Item quantity.
117
+                    if ( 'quantity' == $key ) {
118 118
 
119
-						if ( $item->allows_quantities() ) {
120
-							?>
119
+                        if ( $item->allows_quantities() ) {
120
+                            ?>
121 121
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required>
122 122
 							<?php
123
-						} else {
124
-							echo (float) $item->get_quantity();
125
-							echo '&nbsp;&nbsp;&nbsp;';
126
-							?>
123
+                        } else {
124
+                            echo (float) $item->get_quantity();
125
+                            echo '&nbsp;&nbsp;&nbsp;';
126
+                            ?>
127 127
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
128 128
 							<?php
129
-						}
130
-					}
129
+                        }
130
+                    }
131 131
 
132
-					// Item sub total.
133
-					if ( 'subtotal' == $key ) {
134
-						echo wpinv_price( $item->get_sub_total(), $currency );
135
-					}
132
+                    // Item sub total.
133
+                    if ( 'subtotal' == $key ) {
134
+                        echo wpinv_price( $item->get_sub_total(), $currency );
135
+                    }
136 136
 
137
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
138
-				?>
137
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
138
+                ?>
139 139
 
140 140
 			</div>
141 141
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,116 +7,116 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
12
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
13 13
 
14 14
 $currency = $form->get_currency();
15 15
 
16 16
 ?>
17
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
17
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
18 18
 
19 19
 	<div class="form-row needs-validation">
20 20
 
21
-		<?php foreach ( array_keys( $columns ) as $key ) : ?>
21
+		<?php foreach (array_keys($columns) as $key) : ?>
22 22
 
23
-			<div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>">
23
+			<div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $item->get_id(); ?>">
24 24
 
25 25
 				<?php
26 26
 
27 27
 					// Fires before printing a line item column.
28
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
28
+					do_action("getpaid_form_cart_item_before_$key", $item, $form);
29 29
 
30 30
 					// Item name.
31
-					if ( 'name' == $key ) {
31
+					if ('name' == $key) {
32 32
 
33 33
 						// Display the name.
34
-						echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
34
+						echo '<div class="mb-1">' . sanitize_text_field($item->get_name()) . '</div>';
35 35
 
36 36
 						// And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39
-                        if ( ! empty( $description ) ) {
40
-                            $description = wp_kses_post( $description );
39
+                        if (!empty($description)) {
40
+                            $description = wp_kses_post($description);
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42 42
 						}
43 43
 
44 44
 						// Price help text.
45
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
46
-                        if ( $description ) {
45
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
46
+                        if ($description) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48 48
 						}
49 49
 
50 50
 					}
51 51
 
52 52
 					// Item price.
53
-					if ( 'price' == $key ) {
53
+					if ('price' == $key) {
54 54
 
55 55
 						// Set the currency position.
56 56
 						$position = wpinv_currency_position();
57 57
 
58
-						if ( $position == 'left_space' ) {
58
+						if ($position == 'left_space') {
59 59
 							$position = 'left';
60 60
 						}
61 61
 
62
-						if ( $position == 'right_space' ) {
62
+						if ($position == 'right_space') {
63 63
 							$position = 'right';
64 64
 						}
65 65
 
66
-						if ( $item->user_can_set_their_price() ) {
67
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
66
+						if ($item->user_can_set_their_price()) {
67
+							$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
68 68
 							$minimum          = (float) $item->get_minimum_price();
69 69
 							$validate_minimum = '';
70 70
 							$class            = '';
71 71
 							$data_minimum     = '';
72 72
 
73
-							if ( $minimum > 0 ) {
73
+							if ($minimum > 0) {
74 74
 								$validate_minimum = sprintf(
75
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
76
-									sanitize_text_field( wpinv_price( $minimum, $currency ) )
75
+									esc_attr__('The minimum allowed amount is %s', 'invoicing'),
76
+									sanitize_text_field(wpinv_price($minimum, $currency))
77 77
 								);
78 78
 
79 79
 								$class = 'getpaid-validate-minimum-amount';
80 80
 
81
-								$data_minimum     = "data-minimum-amount='$minimum'";
81
+								$data_minimum = "data-minimum-amount='$minimum'";
82 82
 							}
83 83
 
84 84
 							?>
85 85
 								<div class="input-group input-group-sm">
86
-									<?php if( 'left' == $position ) : ?>
86
+									<?php if ('left' == $position) : ?>
87 87
 										<div class="input-group-prepend">
88
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
88
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
89 89
 										</div>
90 90
 									<?php endif; ?>
91 91
 
92
-									<input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
92
+									<input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
93 93
 
94
-									<?php if ( ! empty( $validate_minimum ) ) : ?>
94
+									<?php if (!empty($validate_minimum)) : ?>
95 95
 										<div class="invalid-tooltip">
96 96
 											<?php echo $validate_minimum; ?>
97 97
 										</div>
98 98
 									<?php endif; ?>
99 99
 
100
-									<?php if( 'left' != $position ) : ?>
100
+									<?php if ('left' != $position) : ?>
101 101
 										<div class="input-group-append">
102
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
102
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
103 103
 										</div>
104 104
 									<?php endif; ?>
105 105
 								</div>
106 106
 
107 107
 							<?php
108 108
 						} else {
109
-							echo wpinv_price( $item->get_price(), $currency );
109
+							echo wpinv_price($item->get_price(), $currency);
110 110
 							?>
111
-								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
111
+								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
112 112
 							<?php
113 113
 						}
114 114
 					}
115 115
 
116 116
 					// Item quantity.
117
-					if ( 'quantity' == $key ) {
117
+					if ('quantity' == $key) {
118 118
 
119
-						if ( $item->allows_quantities() ) {
119
+						if ($item->allows_quantities()) {
120 120
 							?>
121 121
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required>
122 122
 							<?php
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 					}
131 131
 
132 132
 					// Item sub total.
133
-					if ( 'subtotal' == $key ) {
134
-						echo wpinv_price( $item->get_sub_total(), $currency );
133
+					if ('subtotal' == $key) {
134
+						echo wpinv_price($item->get_sub_total(), $currency);
135 135
 					}
136 136
 
137
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
137
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
138 138
 				?>
139 139
 
140 140
 			</div>
@@ -145,4 +145,4 @@  discard block
 block discarded – undo
145 145
 
146 146
 </div>
147 147
 <?php
148
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
148
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 1 patch
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves an item by it's ID.
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * @param int the item ID to retrieve.
15 15
  * @return WPInv_Item|false
16 16
  */
17
-function wpinv_get_item_by_id( $id ) {
18
-    $item = wpinv_get_item( $id );
19
-    return empty( $item ) || $id != $item->get_id() ? false : $item;
17
+function wpinv_get_item_by_id($id) {
18
+    $item = wpinv_get_item($id);
19
+    return empty($item) || $id != $item->get_id() ? false : $item;
20 20
 }
21 21
 
22 22
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  * 
25 25
  * @return WPInv_Item|false
26 26
  */
27
-function wpinv_get_item_by( $field = '', $value = '', $type = '' ) {
27
+function wpinv_get_item_by($field = '', $value = '', $type = '') {
28 28
 
29
-    if ( 'id' == strtolower( $field ) ) {
30
-        return wpinv_get_item_by_id( $field );
29
+    if ('id' == strtolower($field)) {
30
+        return wpinv_get_item_by_id($field);
31 31
     }
32 32
 
33
-    $id = WPInv_Item::get_item_id_by_field( $value, strtolower( $field ), $type );
34
-    return empty( $id ) ? false : wpinv_get_item( $id );
33
+    $id = WPInv_Item::get_item_id_by_field($value, strtolower($field), $type);
34
+    return empty($id) ? false : wpinv_get_item($id);
35 35
 
36 36
 }
37 37
 
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
  * @param int|WPInv_Item the item to retrieve.
42 42
  * @return WPInv_Item|false
43 43
  */
44
-function wpinv_get_item( $item = 0 ) {
44
+function wpinv_get_item($item = 0) {
45 45
 
46
-    if ( empty( $item ) ) {
46
+    if (empty($item)) {
47 47
         return false;
48 48
     }
49 49
 
50
-    $item = new WPInv_Item( $item );
50
+    $item = new WPInv_Item($item);
51 51
     return $item->exists() ? $item : false;
52 52
 
53 53
 }
54 54
 
55
-function wpinv_get_all_items( $args = array() ) {
55
+function wpinv_get_all_items($args = array()) {
56 56
 
57
-    $args = wp_parse_args( $args, array(
58
-        'status'         => array( 'publish' ),
59
-        'limit'          => get_option( 'posts_per_page' ),
57
+    $args = wp_parse_args($args, array(
58
+        'status'         => array('publish'),
59
+        'limit'          => get_option('posts_per_page'),
60 60
         'page'           => 1,
61 61
         'exclude'        => array(),
62 62
         'orderby'        => 'date',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         'meta_query'     => array(),
66 66
         'return'         => 'objects',
67 67
         'paginate'       => false,
68
-    ) );
68
+    ));
69 69
 
70 70
     $wp_query_args = array(
71 71
         'post_type'      => 'wpi_item',
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
         'fields'         => 'ids',
76 76
         'orderby'        => $args['orderby'],
77 77
         'order'          => $args['order'],
78
-        'paged'          => absint( $args['page'] ),
78
+        'paged'          => absint($args['page']),
79 79
     );
80 80
 
81
-    if ( ! empty( $args['exclude'] ) ) {
82
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
81
+    if (!empty($args['exclude'])) {
82
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
83 83
     }
84 84
 
85
-    if ( ! $args['paginate' ] ) {
85
+    if (!$args['paginate']) {
86 86
         $wp_query_args['no_found_rows'] = true;
87 87
     }
88 88
 
89
-    if ( ! empty( $args['search'] ) ) {
89
+    if (!empty($args['search'])) {
90 90
         $wp_query_args['s'] = $args['search'];
91 91
     }
92 92
 
93
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
94
-        $types = wpinv_parse_list( $args['type'] );
93
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
94
+        $types = wpinv_parse_list($args['type']);
95 95
         $wp_query_args['meta_query'][] = array(
96 96
             'key'     => '_wpinv_type',
97
-            'value'   => implode( ',', $types ),
97
+            'value'   => implode(',', $types),
98 98
             'compare' => 'IN',
99 99
         );
100 100
     }
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
     $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
103 103
 
104 104
     // Get results.
105
-    $items = new WP_Query( $wp_query_args );
105
+    $items = new WP_Query($wp_query_args);
106 106
 
107
-    if ( 'objects' === $args['return'] ) {
108
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
109
-    } elseif ( 'self' === $args['return'] ) {
107
+    if ('objects' === $args['return']) {
108
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
109
+    } elseif ('self' === $args['return']) {
110 110
         return $items;
111 111
     } else {
112 112
         $return = $items->posts;
113 113
     }
114 114
 
115
-    if ( $args['paginate' ] ) {
115
+    if ($args['paginate']) {
116 116
         return (object) array(
117 117
             'items'      => $return,
118 118
             'total'         => $items->found_posts,
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 }
126 126
 
127
-function wpinv_is_free_item( $item_id = 0 ) {
128
-    if( empty( $item_id ) ) {
127
+function wpinv_is_free_item($item_id = 0) {
128
+    if (empty($item_id)) {
129 129
         return false;
130 130
     }
131 131
 
132
-    $item = new WPInv_Item( $item_id );
132
+    $item = new WPInv_Item($item_id);
133 133
     
134 134
     return $item->is_free();
135 135
 }
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
  * 
140 140
  * @param WP_Post|WPInv_Item|Int $item The item to check for.
141 141
  */
142
-function wpinv_item_is_editable( $item = 0 ) {
142
+function wpinv_item_is_editable($item = 0) {
143 143
 
144 144
     // Fetch the item.
145
-    $item = new WPInv_Item( $item );
145
+    $item = new WPInv_Item($item);
146 146
 
147 147
     // Check if it is editable.
148 148
     return $item->is_editable();
149 149
 }
150 150
 
151
-function wpinv_get_item_price( $item_id = 0 ) {
152
-    if( empty( $item_id ) ) {
151
+function wpinv_get_item_price($item_id = 0) {
152
+    if (empty($item_id)) {
153 153
         return false;
154 154
     }
155 155
 
156
-    $item = new WPInv_Item( $item_id );
156
+    $item = new WPInv_Item($item_id);
157 157
     
158 158
     return $item->get_price();
159 159
 }
@@ -163,96 +163,96 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @param WPInv_Item|int $item
165 165
  */
166
-function wpinv_is_recurring_item( $item = 0 ) {
167
-    $item = new WPInv_Item( $item ); 
166
+function wpinv_is_recurring_item($item = 0) {
167
+    $item = new WPInv_Item($item); 
168 168
     return $item->is_recurring();
169 169
 }
170 170
 
171
-function wpinv_item_price( $item_id = 0 ) {
172
-    if( empty( $item_id ) ) {
171
+function wpinv_item_price($item_id = 0) {
172
+    if (empty($item_id)) {
173 173
         return false;
174 174
     }
175 175
 
176
-    $price = wpinv_get_item_price( $item_id );
177
-    $price = wpinv_price( $price );
176
+    $price = wpinv_get_item_price($item_id);
177
+    $price = wpinv_price($price);
178 178
     
179
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
179
+    return apply_filters('wpinv_item_price', $price, $item_id);
180 180
 }
181 181
 
182
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
183
-    if ( is_null( $amount_override ) ) {
184
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
182
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
183
+    if (is_null($amount_override)) {
184
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
185 185
     } else {
186 186
         $original_price = $amount_override;
187 187
     }
188 188
     
189 189
     $price = $original_price;
190 190
 
191
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
191
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
192 192
 }
193 193
 
194
-function wpinv_item_custom_singular_name( $item_id ) {
195
-    if( empty( $item_id ) ) {
194
+function wpinv_item_custom_singular_name($item_id) {
195
+    if (empty($item_id)) {
196 196
         return false;
197 197
     }
198 198
 
199
-    $item = new WPInv_Item( $item_id );
199
+    $item = new WPInv_Item($item_id);
200 200
     
201 201
     return $item->get_custom_singular_name();
202 202
 }
203 203
 
204 204
 function wpinv_get_item_types() {
205 205
     $item_types = array(
206
-            'custom'    => __( 'Standard', 'invoicing' ),
207
-            'fee'       => __( 'Fee', 'invoicing' ),
206
+            'custom'    => __('Standard', 'invoicing'),
207
+            'fee'       => __('Fee', 'invoicing'),
208 208
         );
209
-    return apply_filters( 'wpinv_get_item_types', $item_types );
209
+    return apply_filters('wpinv_get_item_types', $item_types);
210 210
 }
211 211
 
212 212
 function wpinv_item_types() {
213 213
     $item_types = wpinv_get_item_types();
214 214
     
215
-    return ( !empty( $item_types ) ? array_keys( $item_types ) : array() );
215
+    return (!empty($item_types) ? array_keys($item_types) : array());
216 216
 }
217 217
 
218
-function wpinv_get_item_type( $item_id ) {
219
-    if( empty( $item_id ) ) {
218
+function wpinv_get_item_type($item_id) {
219
+    if (empty($item_id)) {
220 220
         return false;
221 221
     }
222 222
 
223
-    $item = new WPInv_Item( $item_id );
223
+    $item = new WPInv_Item($item_id);
224 224
     
225 225
     return $item->get_type();
226 226
 }
227 227
 
228
-function wpinv_item_type( $item_id ) {
228
+function wpinv_item_type($item_id) {
229 229
     $item_types = wpinv_get_item_types();
230 230
     
231
-    $item_type = wpinv_get_item_type( $item_id );
231
+    $item_type = wpinv_get_item_type($item_id);
232 232
     
233
-    if ( empty( $item_type ) ) {
233
+    if (empty($item_type)) {
234 234
         $item_type = '-';
235 235
     }
236 236
     
237
-    $item_type = isset( $item_types[$item_type] ) ? $item_types[$item_type] : __( $item_type, 'invoicing' );
237
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
238 238
 
239
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
239
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
240 240
 }
241 241
 
242
-function wpinv_get_random_item( $post_ids = true ) {
243
-    wpinv_get_random_items( 1, $post_ids );
242
+function wpinv_get_random_item($post_ids = true) {
243
+    wpinv_get_random_items(1, $post_ids);
244 244
 }
245 245
 
246
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
247
-    if ( $post_ids ) {
248
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids' );
246
+function wpinv_get_random_items($num = 3, $post_ids = true) {
247
+    if ($post_ids) {
248
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids');
249 249
     } else {
250
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num );
250
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num);
251 251
     }
252 252
     
253
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
253
+    $args = apply_filters('wpinv_get_random_items', $args);
254 254
     
255
-    return get_posts( $args );
255
+    return get_posts($args);
256 256
 }
257 257
 
258 258
 /**
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
  * @param WPInv_Item|int $item
262 262
  * @param bool $html
263 263
  */
264
-function wpinv_get_item_suffix( $item, $html = true ) {
264
+function wpinv_get_item_suffix($item, $html = true) {
265 265
 
266
-    $item   = new WPInv_Item( $item );
267
-    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '';
268
-    $suffix = $html ? $suffix : strip_tags( $suffix );
266
+    $item   = new WPInv_Item($item);
267
+    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __('(r)', 'invoicing') . '</span>' : '';
268
+    $suffix = $html ? $suffix : strip_tags($suffix);
269 269
 
270
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
270
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
271 271
 }
272 272
 
273 273
 /**
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
  * @param WPInv_Item|int $item
277 277
  * @param bool $force_delete
278 278
  */
279
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
280
-    $item = new WPInv_Item( $item );
281
-    $item->delete( $force_delete );
279
+function wpinv_remove_item($item = 0, $force_delete = false) {
280
+    $item = new WPInv_Item($item);
281
+    $item->delete($force_delete);
282 282
 }
283 283
 
284 284
 /**
@@ -317,45 +317,45 @@  discard block
 block discarded – undo
317 317
  * @param bool $wp_error whether or not to return a WP_Error on failure.
318 318
  * @return bool|WP_Error|WPInv_Item
319 319
  */
320
-function wpinv_create_item( $args = array(), $wp_error = false ) {
320
+function wpinv_create_item($args = array(), $wp_error = false) {
321 321
 
322 322
     // Prepare the item.
323
-    if ( ! empty( $args['custom_id'] ) && empty( $args['ID'] ) ) {
324
-        $type = empty( $args['type'] ) ? 'custom' : $args['type'];
325
-        $item = wpinv_get_item_by( 'custom_id', $args['custom_id'], $type );
323
+    if (!empty($args['custom_id']) && empty($args['ID'])) {
324
+        $type = empty($args['type']) ? 'custom' : $args['type'];
325
+        $item = wpinv_get_item_by('custom_id', $args['custom_id'], $type);
326 326
 
327
-        if ( ! empty( $item ) ) {
327
+        if (!empty($item)) {
328 328
             $args['ID'] = $item->get_id();
329 329
         }
330 330
 
331 331
     }
332 332
 
333 333
     // Do we have an item?
334
-    if ( ! empty( $args['ID'] ) ) {
335
-        $item = new WPInv_Item( $args['ID'] );
334
+    if (!empty($args['ID'])) {
335
+        $item = new WPInv_Item($args['ID']);
336 336
     } else {
337 337
         $item = new WPInv_Item();
338 338
     }
339 339
 
340 340
     // Do we have an error?
341
-    if ( ! empty( $item->last_error ) ) {
342
-        return $wp_error ? new WP_Error( 'invalid_item', $item->last_error ) : false;
341
+    if (!empty($item->last_error)) {
342
+        return $wp_error ? new WP_Error('invalid_item', $item->last_error) : false;
343 343
     }
344 344
 
345 345
     // Update item props.
346
-    $item->set_props( $args );
346
+    $item->set_props($args);
347 347
 
348 348
     // Save the item.
349 349
     $item->save();
350 350
 
351 351
     // Do we have an error?
352
-    if ( ! empty( $item->last_error ) ) {
353
-        return $wp_error ? new WP_Error( 'not_saved', $item->last_error ) : false;
352
+    if (!empty($item->last_error)) {
353
+        return $wp_error ? new WP_Error('not_saved', $item->last_error) : false;
354 354
     }
355 355
 
356 356
     // Was the item saved?
357
-    if ( ! $item->get_id() ) {
358
-        return $wp_error ? new WP_Error( 'not_saved', __( 'An error occured while saving the item', 'invoicing' ) ) : false;
357
+    if (!$item->get_id()) {
358
+        return $wp_error ? new WP_Error('not_saved', __('An error occured while saving the item', 'invoicing')) : false;
359 359
     }
360 360
 
361 361
     return $item;
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
  * 
368 368
  * @see wpinv_create_item()
369 369
  */
370
-function wpinv_update_item( $args = array(), $wp_error = false ) {
371
-    return wpinv_create_item( $args, $wp_error );
370
+function wpinv_update_item($args = array(), $wp_error = false) {
371
+    return wpinv_create_item($args, $wp_error);
372 372
 }
373 373
 
374 374
 /**
375 375
  * Sanitizes a recurring period
376 376
  */
377
-function getpaid_sanitize_recurring_period( $period, $full = false ) {
377
+function getpaid_sanitize_recurring_period($period, $full = false) {
378 378
 
379 379
     $periods = array(
380 380
         'D' => 'day',
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
         'Y' => 'year',
384 384
     );
385 385
 
386
-    if ( ! isset( $periods[ $period ] ) ) {
386
+    if (!isset($periods[$period])) {
387 387
         $period = 'D';
388 388
     }
389 389
 
390
-    return $full ? $periods[ $period ] : $period;
390
+    return $full ? $periods[$period] : $period;
391 391
 
392 392
 }
393 393
 
@@ -396,38 +396,38 @@  discard block
 block discarded – undo
396 396
  *
397 397
  * @param WPInv_Item|GetPaid_Form_Item $item
398 398
  */
399
-function getpaid_item_recurring_price_help_text( $item, $currency = '', $_initial_price = false, $_recurring_price = false ) {
399
+function getpaid_item_recurring_price_help_text($item, $currency = '', $_initial_price = false, $_recurring_price = false) {
400 400
 
401 401
     // Abort if it is not recurring.
402
-    if ( ! $item->is_recurring() ) {
402
+    if (!$item->is_recurring()) {
403 403
         return '';
404 404
     }
405 405
 
406
-    $initial_price   = false === $_initial_price ? wpinv_price( $item->get_initial_price(), $currency ) : $_initial_price;
407
-    $recurring_price = false === $_recurring_price ? wpinv_price( $item->get_recurring_price(), $currency ) : $_recurring_price;
408
-    $period          = getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' );
406
+    $initial_price   = false === $_initial_price ? wpinv_price($item->get_initial_price(), $currency) : $_initial_price;
407
+    $recurring_price = false === $_recurring_price ? wpinv_price($item->get_recurring_price(), $currency) : $_recurring_price;
408
+    $period          = getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '');
409 409
     $initial_class   = 'getpaid-item-initial-price';
410 410
     $recurring_class = 'getpaid-item-recurring-price';
411 411
 
412
-    if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
413
-        $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
414
-        $recurring_price = wpinv_price( $item->get_recurring_sub_total(), $currency );
412
+    if ($item instanceof GetPaid_Form_Item && false === $_initial_price) {
413
+        $initial_price   = wpinv_price($item->get_sub_total(), $currency);
414
+        $recurring_price = wpinv_price($item->get_recurring_sub_total(), $currency);
415 415
     }
416 416
 
417
-    if ( wpinv_price( 0, $currency ) == $initial_price && wpinv_price( 0, $currency ) == $recurring_price ) {
418
-        return __( 'Free forever', 'invoicing' );
417
+    if (wpinv_price(0, $currency) == $initial_price && wpinv_price(0, $currency) == $recurring_price) {
418
+        return __('Free forever', 'invoicing');
419 419
     }
420 420
 
421 421
     // For free trial items.
422
-    if ( $item->has_free_trial() ) {
423
-        $trial_period = getpaid_get_subscription_period_label( $item->get_trial_period(), $item->get_trial_interval() );
422
+    if ($item->has_free_trial()) {
423
+        $trial_period = getpaid_get_subscription_period_label($item->get_trial_period(), $item->get_trial_interval());
424 424
 
425
-        if ( wpinv_price( 0, $currency ) == $initial_price ) {
425
+        if (wpinv_price(0, $currency) == $initial_price) {
426 426
 
427 427
             return sprintf(
428 428
 
429 429
                 // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period
430
-                _x( 'Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing' ),
430
+                _x('Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing'),
431 431
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
432 432
                 "<span class='$recurring_class'>$recurring_price</span>",
433 433
                 "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         return sprintf(
440 440
 
441 441
             // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period
442
-            _x( '%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing' ),
442
+            _x('%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing'),
443 443
             "<span class='$initial_class'>$initial_price</span>",
444 444
             "<span class='getpaid-item-trial-period'>$trial_period</span>",
445 445
             "<span class='$recurring_class'>$recurring_price</span>",
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 
450 450
     }
451 451
 
452
-    if ( $initial_price == $recurring_price ) {
452
+    if ($initial_price == $recurring_price) {
453 453
 
454 454
         return sprintf(
455 455
 
456 456
             // translators: $1: is the recurring price, $2: is the susbcription period
457
-            _x( '%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing' ),
457
+            _x('%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing'),
458 458
             "<span class='$recurring_class'>$recurring_price</span>",
459 459
             "<span class='getpaid-item-recurring-period'>$period</span>"
460 460
 
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 
463 463
     }
464 464
 
465
-    if ( $initial_price == wpinv_price( 0, $currency ) ) {
465
+    if ($initial_price == wpinv_price(0, $currency)) {
466 466
 
467 467
         return sprintf(
468 468
 
469 469
             // translators: $1: is the recurring period, $2: is the recurring price
470
-            _x( 'Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing' ),
470
+            _x('Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing'),
471 471
             "<span class='getpaid-item-recurring-period'>$period</span>",
472 472
             "<span class='$recurring_class'>$recurring_price</span>"
473 473
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     return sprintf(
479 479
 
480 480
         // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period
481
-        _x( 'Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing' ),
481
+        _x('Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing'),
482 482
         "<span class='$initial_class'>$initial_price</span>",
483 483
         "<span class='$recurring_class'>$recurring_price</span>",
484 484
         "<span class='getpaid-item-recurring-period'>$period</span>"
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 3 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,8 +126,12 @@  discard block
 block discarded – undo
126 126
 		public function constants(){
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129
-			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
130
-			if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
129
+			if (!defined('AUI_PRIMARY_COLOR')) {
130
+			    define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
131
+			}
132
+			if (!defined('AUI_SECONDARY_COLOR')) {
133
+			    define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
134
+			}
131 135
 		}
132 136
 
133 137
 		/**
@@ -232,7 +236,7 @@  discard block
 block discarded – undo
232 236
 
233 237
 			if( is_admin() && !$this->is_aui_screen()){
234 238
 				// don't add wp-admin scripts if not requested to
235
-			}else{
239
+			} else{
236 240
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
237 241
 
238 242
 				$rtl = is_rtl() ? '-rtl' : '';
@@ -869,7 +873,7 @@  discard block
 block discarded – undo
869 873
 
870 874
 			if( is_admin() && !$this->is_aui_screen()){
871 875
 				// don't add wp-admin scripts if not requested to
872
-			}else {
876
+			} else {
873 877
 
874 878
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
875 879
 
Please login to merge, or discard this patch.
Indentation   +1099 added lines, -1099 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,236 +21,236 @@  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.45';
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
-		 * Main AyeCode_UI_Settings Instance.
93
-		 *
94
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
95
-		 *
96
-		 * @since 1.0.0
97
-		 * @static
98
-		 * @return AyeCode_UI_Settings - Main instance.
99
-		 */
100
-		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
-
103
-				self::$instance = new AyeCode_UI_Settings;
104
-
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
-
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
110
-
111
-					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
-				}
114
-
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
116
-
117
-				do_action( 'ayecode_ui_settings_loaded' );
118
-			}
119
-
120
-			return self::$instance;
121
-		}
122
-
123
-		/**
124
-		 * Setup some constants.
125
-		 */
126
-		public function constants(){
127
-			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128
-			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129
-			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
130
-			if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
131
-		}
132
-
133
-		/**
134
-		 * Initiate the settings and add the required action hooks.
135
-		 */
136
-		public function init() {
137
-			$this->constants();
138
-			$this->settings = $this->get_settings();
139
-			$this->url = $this->get_url();
140
-
141
-			/**
142
-			 * Maybe load CSS
143
-			 *
144
-			 * We load super early in case there is a theme version that might change the colors
145
-			 */
146
-			if ( $this->settings['css'] ) {
147
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
148
-			}
149
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
151
-			}
152
-
153
-			// maybe load JS
154
-			if ( $this->settings['js'] ) {
155
-				$priority = $this->is_bs3_compat() ? 100 : 1;
156
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
157
-			}
158
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
159
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
160
-			}
161
-
162
-			// Maybe set the HTML font size
163
-			if ( $this->settings['html_font_size'] ) {
164
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
165
-			}
166
-
167
-
168
-		}
169
-
170
-		/**
171
-		 * Check if we should load the admin scripts or not.
172
-		 *
173
-		 * @return bool
174
-		 */
175
-		public function load_admin_scripts(){
176
-			$result = true;
177
-
178
-			// check if specifically disabled
179
-			if(!empty($this->settings['disable_admin'])){
180
-				$url_parts = explode("\n",$this->settings['disable_admin']);
181
-				foreach($url_parts as $part){
182
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
183
-						return false; // return early, no point checking further
184
-					}
185
-				}
186
-			}
187
-
188
-			return $result;
189
-		}
190
-
191
-		/**
192
-		 * Add a html font size to the footer.
193
-		 */
194
-		public function html_font_size(){
195
-			$this->settings = $this->get_settings();
196
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
197
-		}
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.45';
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
+         * Main AyeCode_UI_Settings Instance.
93
+         *
94
+         * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
95
+         *
96
+         * @since 1.0.0
97
+         * @static
98
+         * @return AyeCode_UI_Settings - Main instance.
99
+         */
100
+        public static function instance() {
101
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
+
103
+                self::$instance = new AyeCode_UI_Settings;
104
+
105
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
+
107
+                if ( is_admin() ) {
108
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
110
+
111
+                    // Maybe show example page
112
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
+                }
198 114
 
199
-		/**
200
-		 * Check if the current admin screen should load scripts.
201
-		 * 
202
-		 * @return bool
203
-		 */
204
-		public function is_aui_screen(){
205
-			$load = false;
206
-			// check if we should load or not
207
-			if ( is_admin() ) {
208
-				// Only enable on set pages
209
-				$aui_screens = array(
210
-					'page',
211
-					'post',
212
-					'settings_page_ayecode-ui-settings',
213
-					'appearance_page_gutenberg-widgets'
214
-				);
215
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
216
-
217
-				$screen = get_current_screen();
115
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
116
+
117
+                do_action( 'ayecode_ui_settings_loaded' );
118
+            }
119
+
120
+            return self::$instance;
121
+        }
122
+
123
+        /**
124
+         * Setup some constants.
125
+         */
126
+        public function constants(){
127
+            define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128
+            define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129
+            if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
130
+            if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
131
+        }
132
+
133
+        /**
134
+         * Initiate the settings and add the required action hooks.
135
+         */
136
+        public function init() {
137
+            $this->constants();
138
+            $this->settings = $this->get_settings();
139
+            $this->url = $this->get_url();
140
+
141
+            /**
142
+             * Maybe load CSS
143
+             *
144
+             * We load super early in case there is a theme version that might change the colors
145
+             */
146
+            if ( $this->settings['css'] ) {
147
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
148
+            }
149
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
151
+            }
152
+
153
+            // maybe load JS
154
+            if ( $this->settings['js'] ) {
155
+                $priority = $this->is_bs3_compat() ? 100 : 1;
156
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
157
+            }
158
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
159
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
160
+            }
161
+
162
+            // Maybe set the HTML font size
163
+            if ( $this->settings['html_font_size'] ) {
164
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
165
+            }
166
+
167
+
168
+        }
169
+
170
+        /**
171
+         * Check if we should load the admin scripts or not.
172
+         *
173
+         * @return bool
174
+         */
175
+        public function load_admin_scripts(){
176
+            $result = true;
177
+
178
+            // check if specifically disabled
179
+            if(!empty($this->settings['disable_admin'])){
180
+                $url_parts = explode("\n",$this->settings['disable_admin']);
181
+                foreach($url_parts as $part){
182
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
183
+                        return false; // return early, no point checking further
184
+                    }
185
+                }
186
+            }
187
+
188
+            return $result;
189
+        }
190
+
191
+        /**
192
+         * Add a html font size to the footer.
193
+         */
194
+        public function html_font_size(){
195
+            $this->settings = $this->get_settings();
196
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
197
+        }
198
+
199
+        /**
200
+         * Check if the current admin screen should load scripts.
201
+         * 
202
+         * @return bool
203
+         */
204
+        public function is_aui_screen(){
205
+            $load = false;
206
+            // check if we should load or not
207
+            if ( is_admin() ) {
208
+                // Only enable on set pages
209
+                $aui_screens = array(
210
+                    'page',
211
+                    'post',
212
+                    'settings_page_ayecode-ui-settings',
213
+                    'appearance_page_gutenberg-widgets'
214
+                );
215
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
216
+
217
+                $screen = get_current_screen();
218 218
 
219 219
 //				echo '###'.$screen->id;
220 220
 				
221
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
222
-					$load = true;
223
-				}
224
-			}
221
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
222
+                    $load = true;
223
+                }
224
+            }
225 225
 
226
-			return $load;
227
-		}
226
+            return $load;
227
+        }
228 228
 
229
-		/**
230
-		 * Adds the styles.
231
-		 */
232
-		public function enqueue_style() {
229
+        /**
230
+         * Adds the styles.
231
+         */
232
+        public function enqueue_style() {
233 233
 
234
-			if( is_admin() && !$this->is_aui_screen()){
235
-				// don't add wp-admin scripts if not requested to
236
-			}else{
237
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
234
+            if( is_admin() && !$this->is_aui_screen()){
235
+                // don't add wp-admin scripts if not requested to
236
+            }else{
237
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
238 238
 
239
-				$rtl = is_rtl() ? '-rtl' : '';
239
+                $rtl = is_rtl() ? '-rtl' : '';
240 240
 
241
-				if($this->settings[$css_setting]){
242
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
243
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
244
-					wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
245
-					wp_enqueue_style( 'ayecode-ui' );
241
+                if($this->settings[$css_setting]){
242
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
243
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
244
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
245
+                    wp_enqueue_style( 'ayecode-ui' );
246 246
 
247
-					// flatpickr
248
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
247
+                    // flatpickr
248
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
249 249
 
250 250
 
251
-					// fix some wp-admin issues
252
-					if(is_admin()){
253
-						$custom_css = "
251
+                    // fix some wp-admin issues
252
+                    if(is_admin()){
253
+                        $custom_css = "
254 254
                 body{
255 255
                     background-color: #f1f1f1;
256 256
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -289,35 +289,35 @@  discard block
 block discarded – undo
289 289
 				}
290 290
                 ";
291 291
 
292
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
293
-						$custom_css .= "
292
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
293
+                        $custom_css .= "
294 294
 						.edit-post-sidebar input[type=color].components-text-control__input{
295 295
 						    padding: 0;
296 296
 						}
297 297
 					";
298
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
299
-					}
298
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
299
+                    }
300 300
 
301
-					// custom changes
302
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
301
+                    // custom changes
302
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
303 303
 
304
-				}
305
-			}
304
+                }
305
+            }
306 306
 
307 307
 
308
-		}
308
+        }
309
+
310
+        /**
311
+         * Get inline script used if bootstrap enqueued
312
+         *
313
+         * If this remains small then its best to use this than to add another JS file.
314
+         */
315
+        public function inline_script() {
316
+            // Flatpickr calendar locale
317
+            $flatpickr_locale = self::flatpickr_locale();
309 318
 
310
-		/**
311
-		 * Get inline script used if bootstrap enqueued
312
-		 *
313
-		 * If this remains small then its best to use this than to add another JS file.
314
-		 */
315
-		public function inline_script() {
316
-			// Flatpickr calendar locale
317
-			$flatpickr_locale = self::flatpickr_locale();
318
-
319
-			ob_start();
320
-			?>
319
+            ob_start();
320
+            ?>
321 321
 			<script>
322 322
 				/**
323 323
 				 * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -853,27 +853,27 @@  discard block
 block discarded – undo
853 853
 
854 854
 			</script>
855 855
 			<?php
856
-			$output = ob_get_clean();
856
+            $output = ob_get_clean();
857 857
 
858
-			/*
858
+            /*
859 859
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
860 860
 			 */
861
-			return str_replace( array(
862
-				'<script>',
863
-				'</script>'
864
-			), '', $output );
865
-		}
866
-
867
-
868
-		/**
869
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
870
-		 *
871
-		 * @TODO we may need this when other conflicts arrise.
872
-		 * @return mixed
873
-		 */
874
-		public static function bs3_compat_js() {
875
-			ob_start();
876
-			?>
861
+            return str_replace( array(
862
+                '<script>',
863
+                '</script>'
864
+            ), '', $output );
865
+        }
866
+
867
+
868
+        /**
869
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
870
+         *
871
+         * @TODO we may need this when other conflicts arrise.
872
+         * @return mixed
873
+         */
874
+        public static function bs3_compat_js() {
875
+            ob_start();
876
+            ?>
877 877
 			<script>
878 878
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
879 879
 				/* With Avada builder */
@@ -881,20 +881,20 @@  discard block
 block discarded – undo
881 881
 				<?php } ?>
882 882
 			</script>
883 883
 			<?php
884
-			return str_replace( array(
885
-				'<script>',
886
-				'</script>'
887
-			), '', ob_get_clean());
888
-		}
889
-
890
-		/**
891
-		 * Get inline script used if bootstrap file browser enqueued.
892
-		 *
893
-		 * If this remains small then its best to use this than to add another JS file.
894
-		 */
895
-		public function inline_script_file_browser(){
896
-			ob_start();
897
-			?>
884
+            return str_replace( array(
885
+                '<script>',
886
+                '</script>'
887
+            ), '', ob_get_clean());
888
+        }
889
+
890
+        /**
891
+         * Get inline script used if bootstrap file browser enqueued.
892
+         *
893
+         * If this remains small then its best to use this than to add another JS file.
894
+         */
895
+        public function inline_script_file_browser(){
896
+            ob_start();
897
+            ?>
898 898
 			<script>
899 899
 				// run on doc ready
900 900
 				jQuery(document).ready(function () {
@@ -902,192 +902,192 @@  discard block
 block discarded – undo
902 902
 				});
903 903
 			</script>
904 904
 			<?php
905
-			$output = ob_get_clean();
905
+            $output = ob_get_clean();
906 906
 
907
-			/*
907
+            /*
908 908
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
909 909
 			 */
910
-			return str_replace( array(
911
-				'<script>',
912
-				'</script>'
913
-			), '', $output );
914
-		}
915
-
916
-		/**
917
-		 * Adds the Font Awesome JS.
918
-		 */
919
-		public function enqueue_scripts() {
920
-
921
-			if( is_admin() && !$this->is_aui_screen()){
922
-				// don't add wp-admin scripts if not requested to
923
-			}else {
924
-
925
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
926
-
927
-				// select2
928
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
929
-
930
-				// flatpickr
931
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
932
-
933
-				// Bootstrap file browser
934
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
935
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
936
-
937
-				$load_inline = false;
938
-
939
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
940
-					// Bootstrap bundle
941
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
942
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
943
-						'select2',
944
-						'jquery'
945
-					), $this->latest, $this->is_bs3_compat() );
946
-					// if in admin then add to footer for compatibility.
947
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
948
-					$script = $this->inline_script();
949
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
950
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
951
-					$url = $this->url . 'assets/js/popper.min.js';
952
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
953
-					wp_enqueue_script( 'bootstrap-js-popper' );
954
-					$load_inline = true;
955
-				} else {
956
-					$load_inline = true;
957
-				}
958
-
959
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
960
-				if ( $load_inline ) {
961
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
962
-					wp_enqueue_script( 'bootstrap-dummy' );
963
-					$script = $this->inline_script();
964
-					wp_add_inline_script( 'bootstrap-dummy', $script );
965
-				}
966
-			}
967
-
968
-		}
969
-
970
-		/**
971
-		 * Enqueue flatpickr if called.
972
-		 */
973
-		public function enqueue_flatpickr(){
974
-			wp_enqueue_style( 'flatpickr' );
975
-			wp_enqueue_script( 'flatpickr' );
976
-		}
977
-
978
-		/**
979
-		 * Get the url path to the current folder.
980
-		 *
981
-		 * @return string
982
-		 */
983
-		public function get_url() {
984
-
985
-			$url = '';
986
-			// check if we are inside a plugin
987
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
988
-
989
-			// add check in-case user has changed wp-content dir name.
990
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
991
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
992
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
993
-
994
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
995
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
996
-			}
997
-
998
-			return $url;
999
-		}
1000
-
1001
-		/**
1002
-		 * Register the database settings with WordPress.
1003
-		 */
1004
-		public function register_settings() {
1005
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1006
-		}
1007
-
1008
-		/**
1009
-		 * Add the WordPress settings menu item.
1010
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1011
-		 */
1012
-		public function menu_item() {
1013
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1014
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1015
-				$this,
1016
-				'settings_page'
1017
-			) );
1018
-		}
1019
-
1020
-		/**
1021
-		 * Get a list of themes and their default JS settings.
1022
-		 *
1023
-		 * @return array
1024
-		 */
1025
-		public function theme_js_settings(){
1026
-			return array(
1027
-				'ayetheme' => 'popper',
1028
-				'listimia' => 'required',
1029
-				'listimia_backend' => 'core-popper',
1030
-				//'avada'    => 'required', // removed as we now add compatibility
1031
-			);
1032
-		}
1033
-
1034
-		/**
1035
-		 * Get the current Font Awesome output settings.
1036
-		 *
1037
-		 * @return array The array of settings.
1038
-		 */
1039
-		public function get_settings() {
1040
-
1041
-			$db_settings = get_option( 'ayecode-ui-settings' );
1042
-			$js_default = 'core-popper';
1043
-			$js_default_backend = $js_default;
1044
-
1045
-			// maybe set defaults (if no settings set)
1046
-			if(empty($db_settings)){
1047
-				$active_theme = strtolower( get_template() ); // active parent theme.
1048
-				$theme_js_settings = self::theme_js_settings();
1049
-				if(isset($theme_js_settings[$active_theme])){
1050
-					$js_default = $theme_js_settings[$active_theme];
1051
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1052
-				}
1053
-			}
1054
-
1055
-			$defaults = array(
1056
-				'css'       => 'compatibility', // core, compatibility
1057
-				'js'        => $js_default, // js to load, core-popper, popper
1058
-				'html_font_size'        => '16', // js to load, core-popper, popper
1059
-				'css_backend'       => 'compatibility', // core, compatibility
1060
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1061
-				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1062
-			);
1063
-
1064
-			$settings = wp_parse_args( $db_settings, $defaults );
1065
-
1066
-			/**
1067
-			 * Filter the Bootstrap settings.
1068
-			 *
1069
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1070
-			 */
1071
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1072
-		}
1073
-
910
+            return str_replace( array(
911
+                '<script>',
912
+                '</script>'
913
+            ), '', $output );
914
+        }
915
+
916
+        /**
917
+         * Adds the Font Awesome JS.
918
+         */
919
+        public function enqueue_scripts() {
920
+
921
+            if( is_admin() && !$this->is_aui_screen()){
922
+                // don't add wp-admin scripts if not requested to
923
+            }else {
924
+
925
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
926
+
927
+                // select2
928
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
929
+
930
+                // flatpickr
931
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
932
+
933
+                // Bootstrap file browser
934
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
935
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
936
+
937
+                $load_inline = false;
938
+
939
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
940
+                    // Bootstrap bundle
941
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
942
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
943
+                        'select2',
944
+                        'jquery'
945
+                    ), $this->latest, $this->is_bs3_compat() );
946
+                    // if in admin then add to footer for compatibility.
947
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
948
+                    $script = $this->inline_script();
949
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
950
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
951
+                    $url = $this->url . 'assets/js/popper.min.js';
952
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
953
+                    wp_enqueue_script( 'bootstrap-js-popper' );
954
+                    $load_inline = true;
955
+                } else {
956
+                    $load_inline = true;
957
+                }
1074 958
 
1075
-		/**
1076
-		 * The settings page html output.
1077
-		 */
1078
-		public function settings_page() {
1079
-			if ( ! current_user_can( 'manage_options' ) ) {
1080
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1081
-			}
1082
-			?>
959
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
960
+                if ( $load_inline ) {
961
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
962
+                    wp_enqueue_script( 'bootstrap-dummy' );
963
+                    $script = $this->inline_script();
964
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
965
+                }
966
+            }
967
+
968
+        }
969
+
970
+        /**
971
+         * Enqueue flatpickr if called.
972
+         */
973
+        public function enqueue_flatpickr(){
974
+            wp_enqueue_style( 'flatpickr' );
975
+            wp_enqueue_script( 'flatpickr' );
976
+        }
977
+
978
+        /**
979
+         * Get the url path to the current folder.
980
+         *
981
+         * @return string
982
+         */
983
+        public function get_url() {
984
+
985
+            $url = '';
986
+            // check if we are inside a plugin
987
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
988
+
989
+            // add check in-case user has changed wp-content dir name.
990
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
991
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
992
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
993
+
994
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
995
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
996
+            }
997
+
998
+            return $url;
999
+        }
1000
+
1001
+        /**
1002
+         * Register the database settings with WordPress.
1003
+         */
1004
+        public function register_settings() {
1005
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1006
+        }
1007
+
1008
+        /**
1009
+         * Add the WordPress settings menu item.
1010
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1011
+         */
1012
+        public function menu_item() {
1013
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1014
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1015
+                $this,
1016
+                'settings_page'
1017
+            ) );
1018
+        }
1019
+
1020
+        /**
1021
+         * Get a list of themes and their default JS settings.
1022
+         *
1023
+         * @return array
1024
+         */
1025
+        public function theme_js_settings(){
1026
+            return array(
1027
+                'ayetheme' => 'popper',
1028
+                'listimia' => 'required',
1029
+                'listimia_backend' => 'core-popper',
1030
+                //'avada'    => 'required', // removed as we now add compatibility
1031
+            );
1032
+        }
1033
+
1034
+        /**
1035
+         * Get the current Font Awesome output settings.
1036
+         *
1037
+         * @return array The array of settings.
1038
+         */
1039
+        public function get_settings() {
1040
+
1041
+            $db_settings = get_option( 'ayecode-ui-settings' );
1042
+            $js_default = 'core-popper';
1043
+            $js_default_backend = $js_default;
1044
+
1045
+            // maybe set defaults (if no settings set)
1046
+            if(empty($db_settings)){
1047
+                $active_theme = strtolower( get_template() ); // active parent theme.
1048
+                $theme_js_settings = self::theme_js_settings();
1049
+                if(isset($theme_js_settings[$active_theme])){
1050
+                    $js_default = $theme_js_settings[$active_theme];
1051
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1052
+                }
1053
+            }
1054
+
1055
+            $defaults = array(
1056
+                'css'       => 'compatibility', // core, compatibility
1057
+                'js'        => $js_default, // js to load, core-popper, popper
1058
+                'html_font_size'        => '16', // js to load, core-popper, popper
1059
+                'css_backend'       => 'compatibility', // core, compatibility
1060
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1061
+                'disable_admin'     =>  '', // URL snippets to disable loading on admin
1062
+            );
1063
+
1064
+            $settings = wp_parse_args( $db_settings, $defaults );
1065
+
1066
+            /**
1067
+             * Filter the Bootstrap settings.
1068
+             *
1069
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1070
+             */
1071
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1072
+        }
1073
+
1074
+
1075
+        /**
1076
+         * The settings page html output.
1077
+         */
1078
+        public function settings_page() {
1079
+            if ( ! current_user_can( 'manage_options' ) ) {
1080
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1081
+            }
1082
+            ?>
1083 1083
 			<div class="wrap">
1084 1084
 				<h1><?php echo $this->name; ?></h1>
1085 1085
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1086 1086
 				<form method="post" action="options.php">
1087 1087
 					<?php
1088
-					settings_fields( 'ayecode-ui-settings' );
1089
-					do_settings_sections( 'ayecode-ui-settings' );
1090
-					?>
1088
+                    settings_fields( 'ayecode-ui-settings' );
1089
+                    do_settings_sections( 'ayecode-ui-settings' );
1090
+                    ?>
1091 1091
 
1092 1092
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1093 1093
 					<table class="form-table wpbs-table-settings">
@@ -1167,60 +1167,60 @@  discard block
 block discarded – undo
1167 1167
 					</table>
1168 1168
 
1169 1169
 					<?php
1170
-					submit_button();
1171
-					?>
1170
+                    submit_button();
1171
+                    ?>
1172 1172
 				</form>
1173 1173
 
1174 1174
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
1175 1175
 			</div>
1176 1176
 
1177 1177
 			<?php
1178
-		}
1179
-
1180
-		public function customizer_settings($wp_customize){
1181
-			$wp_customize->add_section('aui_settings', array(
1182
-				'title'    => __('AyeCode UI','aui'),
1183
-				'priority' => 120,
1184
-			));
1185
-
1186
-			//  =============================
1187
-			//  = Color Picker              =
1188
-			//  =============================
1189
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1190
-				'default'           => AUI_PRIMARY_COLOR,
1191
-				'sanitize_callback' => 'sanitize_hex_color',
1192
-				'capability'        => 'edit_theme_options',
1193
-				'type'              => 'option',
1194
-				'transport'         => 'refresh',
1195
-			));
1196
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1197
-				'label'    => __('Primary Color','aui'),
1198
-				'section'  => 'aui_settings',
1199
-				'settings' => 'aui_options[color_primary]',
1200
-			)));
1201
-
1202
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1203
-				'default'           => '#6c757d',
1204
-				'sanitize_callback' => 'sanitize_hex_color',
1205
-				'capability'        => 'edit_theme_options',
1206
-				'type'              => 'option',
1207
-				'transport'         => 'refresh',
1208
-			));
1209
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1210
-				'label'    => __('Secondary Color','aui'),
1211
-				'section'  => 'aui_settings',
1212
-				'settings' => 'aui_options[color_secondary]',
1213
-			)));
1214
-		}
1215
-
1216
-		/**
1217
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1218
-		 *
1219
-		 * @return mixed
1220
-		 */
1221
-		public static function bs3_compat_css() {
1222
-			ob_start();
1223
-			?>
1178
+        }
1179
+
1180
+        public function customizer_settings($wp_customize){
1181
+            $wp_customize->add_section('aui_settings', array(
1182
+                'title'    => __('AyeCode UI','aui'),
1183
+                'priority' => 120,
1184
+            ));
1185
+
1186
+            //  =============================
1187
+            //  = Color Picker              =
1188
+            //  =============================
1189
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1190
+                'default'           => AUI_PRIMARY_COLOR,
1191
+                'sanitize_callback' => 'sanitize_hex_color',
1192
+                'capability'        => 'edit_theme_options',
1193
+                'type'              => 'option',
1194
+                'transport'         => 'refresh',
1195
+            ));
1196
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1197
+                'label'    => __('Primary Color','aui'),
1198
+                'section'  => 'aui_settings',
1199
+                'settings' => 'aui_options[color_primary]',
1200
+            )));
1201
+
1202
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1203
+                'default'           => '#6c757d',
1204
+                'sanitize_callback' => 'sanitize_hex_color',
1205
+                'capability'        => 'edit_theme_options',
1206
+                'type'              => 'option',
1207
+                'transport'         => 'refresh',
1208
+            ));
1209
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1210
+                'label'    => __('Secondary Color','aui'),
1211
+                'section'  => 'aui_settings',
1212
+                'settings' => 'aui_options[color_secondary]',
1213
+            )));
1214
+        }
1215
+
1216
+        /**
1217
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1218
+         *
1219
+         * @return mixed
1220
+         */
1221
+        public static function bs3_compat_css() {
1222
+            ob_start();
1223
+            ?>
1224 1224
 			<style>
1225 1225
 			/* Bootstrap 3 compatibility */
1226 1226
 			body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1246,579 +1246,579 @@  discard block
 block discarded – undo
1246 1246
 			<?php } ?>
1247 1247
 			</style>
1248 1248
 			<?php
1249
-			return str_replace( array(
1250
-				'<style>',
1251
-				'</style>'
1252
-			), '', ob_get_clean());
1253
-		}
1249
+            return str_replace( array(
1250
+                '<style>',
1251
+                '</style>'
1252
+            ), '', ob_get_clean());
1253
+        }
1254 1254
 
1255 1255
 
1256
-		public static function custom_css($compatibility = true) {
1257
-			$settings = get_option('aui_options');
1256
+        public static function custom_css($compatibility = true) {
1257
+            $settings = get_option('aui_options');
1258 1258
 
1259
-			ob_start();
1259
+            ob_start();
1260 1260
 
1261
-			$primary_color = !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR;
1262
-			$secondary_color = !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR;
1263
-				//AUI_PRIMARY_COLOR_ORIGINAL
1264
-			?>
1261
+            $primary_color = !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR;
1262
+            $secondary_color = !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR;
1263
+                //AUI_PRIMARY_COLOR_ORIGINAL
1264
+            ?>
1265 1265
 			<style>
1266 1266
 				<?php
1267 1267
 
1268
-					// BS v3 compat
1269
-					if( self::is_bs3_compat() ){
1270
-					    echo self::bs3_compat_css();
1271
-					}
1268
+                    // BS v3 compat
1269
+                    if( self::is_bs3_compat() ){
1270
+                        echo self::bs3_compat_css();
1271
+                    }
1272 1272
 
1273
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1274
-						echo self::css_primary($primary_color,$compatibility);
1275
-					}
1273
+                    if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1274
+                        echo self::css_primary($primary_color,$compatibility);
1275
+                    }
1276 1276
 
1277
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1278
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1279
-					}
1277
+                    if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1278
+                        echo self::css_secondary($settings['color_secondary'],$compatibility);
1279
+                    }
1280 1280
 
1281
-					// Set admin bar z-index lower when modal is open.
1282
-					echo ' body.modal-open #wpadminbar{z-index:999}';
1281
+                    // Set admin bar z-index lower when modal is open.
1282
+                    echo ' body.modal-open #wpadminbar{z-index:999}';
1283 1283
                 ?>
1284 1284
 			</style>
1285 1285
 			<?php
1286 1286
 
1287 1287
 
1288
-			/*
1288
+            /*
1289 1289
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1290 1290
 			 */
1291
-			return str_replace( array(
1292
-				'<style>',
1293
-				'</style>'
1294
-			), '', ob_get_clean());
1295
-		}
1296
-
1297
-		/**
1298
-		 * Check if we should add booststrap 3 compatibility changes.
1299
-		 *
1300
-		 * @return bool
1301
-		 */
1302
-		public static function is_bs3_compat(){
1303
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1304
-		}
1305
-
1306
-		public static function css_primary($color_code,$compatibility){;
1307
-			$color_code = sanitize_hex_color($color_code);
1308
-			if(!$color_code){return '';}
1309
-			/**
1310
-			 * c = color, b = background color, o = border-color, f = fill
1311
-			 */
1312
-			$selectors = array(
1313
-				'a' => array('c'),
1314
-				'.btn-primary' => array('b','o'),
1315
-				'.btn-primary.disabled' => array('b','o'),
1316
-				'.btn-primary:disabled' => array('b','o'),
1317
-				'.btn-outline-primary' => array('c','o'),
1318
-				'.btn-outline-primary:hover' => array('b','o'),
1319
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1320
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1321
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1322
-				'.btn-link' => array('c'),
1323
-				'.dropdown-item.active' => array('b'),
1324
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1325
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1291
+            return str_replace( array(
1292
+                '<style>',
1293
+                '</style>'
1294
+            ), '', ob_get_clean());
1295
+        }
1296
+
1297
+        /**
1298
+         * Check if we should add booststrap 3 compatibility changes.
1299
+         *
1300
+         * @return bool
1301
+         */
1302
+        public static function is_bs3_compat(){
1303
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1304
+        }
1305
+
1306
+        public static function css_primary($color_code,$compatibility){;
1307
+            $color_code = sanitize_hex_color($color_code);
1308
+            if(!$color_code){return '';}
1309
+            /**
1310
+             * c = color, b = background color, o = border-color, f = fill
1311
+             */
1312
+            $selectors = array(
1313
+                'a' => array('c'),
1314
+                '.btn-primary' => array('b','o'),
1315
+                '.btn-primary.disabled' => array('b','o'),
1316
+                '.btn-primary:disabled' => array('b','o'),
1317
+                '.btn-outline-primary' => array('c','o'),
1318
+                '.btn-outline-primary:hover' => array('b','o'),
1319
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1320
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1321
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1322
+                '.btn-link' => array('c'),
1323
+                '.dropdown-item.active' => array('b'),
1324
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1325
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1326 1326
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1327 1327
 //				'.custom-range::-moz-range-thumb' => array('b'),
1328 1328
 //				'.custom-range::-ms-thumb' => array('b'),
1329
-				'.nav-pills .nav-link.active' => array('b'),
1330
-				'.nav-pills .show>.nav-link' => array('b'),
1331
-				'.page-link' => array('c'),
1332
-				'.page-item.active .page-link' => array('b','o'),
1333
-				'.badge-primary' => array('b'),
1334
-				'.alert-primary' => array('b','o'),
1335
-				'.progress-bar' => array('b'),
1336
-				'.list-group-item.active' => array('b','o'),
1337
-				'.bg-primary' => array('b','f'),
1338
-				'.btn-link.btn-primary' => array('c'),
1339
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1340
-			);
1341
-
1342
-			$important_selectors = array(
1343
-				'.bg-primary' => array('b','f'),
1344
-				'.border-primary' => array('o'),
1345
-				'.text-primary' => array('c'),
1346
-			);
1347
-
1348
-			$color = array();
1349
-			$color_i = array();
1350
-			$background = array();
1351
-			$background_i = array();
1352
-			$border = array();
1353
-			$border_i = array();
1354
-			$fill = array();
1355
-			$fill_i = array();
1356
-
1357
-			$output = '';
1358
-
1359
-			// build rules into each type
1360
-			foreach($selectors as $selector => $types){
1361
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1362
-				$types = array_combine($types,$types);
1363
-				if(isset($types['c'])){$color[] = $selector;}
1364
-				if(isset($types['b'])){$background[] = $selector;}
1365
-				if(isset($types['o'])){$border[] = $selector;}
1366
-				if(isset($types['f'])){$fill[] = $selector;}
1367
-			}
1368
-
1369
-			// build rules into each type
1370
-			foreach($important_selectors as $selector => $types){
1371
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1372
-				$types = array_combine($types,$types);
1373
-				if(isset($types['c'])){$color_i[] = $selector;}
1374
-				if(isset($types['b'])){$background_i[] = $selector;}
1375
-				if(isset($types['o'])){$border_i[] = $selector;}
1376
-				if(isset($types['f'])){$fill_i[] = $selector;}
1377
-			}
1378
-
1379
-			// add any color rules
1380
-			if(!empty($color)){
1381
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1382
-			}
1383
-			if(!empty($color_i)){
1384
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1385
-			}
1386
-
1387
-			// add any background color rules
1388
-			if(!empty($background)){
1389
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1390
-			}
1391
-			if(!empty($background_i)){
1392
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1393
-			}
1394
-
1395
-			// add any border color rules
1396
-			if(!empty($border)){
1397
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1398
-			}
1399
-			if(!empty($border_i)){
1400
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1401
-			}
1402
-
1403
-			// add any fill color rules
1404
-			if(!empty($fill)){
1405
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1406
-			}
1407
-			if(!empty($fill_i)){
1408
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1409
-			}
1410
-
1411
-
1412
-			$prefix = $compatibility ? ".bsui " : "";
1413
-
1414
-			// darken
1415
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1416
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1417
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1418
-
1419
-			// lighten
1420
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1421
-
1422
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1423
-			$op_25 = $color_code."40"; // 25% opacity
1424
-
1425
-
1426
-			// button states
1427
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1428
-			$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;} ";
1429
-			$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.";} ";
1430
-			$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;} ";
1431
-
1432
-
1433
-			// dropdown's
1434
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1435
-
1436
-
1437
-			// input states
1438
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1439
-
1440
-			// page link
1441
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1442
-
1443
-			return $output;
1444
-		}
1445
-
1446
-		public static function css_secondary($color_code,$compatibility){;
1447
-			$color_code = sanitize_hex_color($color_code);
1448
-			if(!$color_code){return '';}
1449
-			/**
1450
-			 * c = color, b = background color, o = border-color, f = fill
1451
-			 */
1452
-			$selectors = array(
1453
-				'.btn-secondary' => array('b','o'),
1454
-				'.btn-secondary.disabled' => array('b','o'),
1455
-				'.btn-secondary:disabled' => array('b','o'),
1456
-				'.btn-outline-secondary' => array('c','o'),
1457
-				'.btn-outline-secondary:hover' => array('b','o'),
1458
-				'.btn-outline-secondary.disabled' => array('c'),
1459
-				'.btn-outline-secondary:disabled' => array('c'),
1460
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1461
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1462
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1463
-				'.badge-secondary' => array('b'),
1464
-				'.alert-secondary' => array('b','o'),
1465
-				'.btn-link.btn-secondary' => array('c'),
1466
-			);
1467
-
1468
-			$important_selectors = array(
1469
-				'.bg-secondary' => array('b','f'),
1470
-				'.border-secondary' => array('o'),
1471
-				'.text-secondary' => array('c'),
1472
-			);
1473
-
1474
-			$color = array();
1475
-			$color_i = array();
1476
-			$background = array();
1477
-			$background_i = array();
1478
-			$border = array();
1479
-			$border_i = array();
1480
-			$fill = array();
1481
-			$fill_i = array();
1482
-
1483
-			$output = '';
1484
-
1485
-			// build rules into each type
1486
-			foreach($selectors as $selector => $types){
1487
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1488
-				$types = array_combine($types,$types);
1489
-				if(isset($types['c'])){$color[] = $selector;}
1490
-				if(isset($types['b'])){$background[] = $selector;}
1491
-				if(isset($types['o'])){$border[] = $selector;}
1492
-				if(isset($types['f'])){$fill[] = $selector;}
1493
-			}
1494
-
1495
-			// build rules into each type
1496
-			foreach($important_selectors as $selector => $types){
1497
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1498
-				$types = array_combine($types,$types);
1499
-				if(isset($types['c'])){$color_i[] = $selector;}
1500
-				if(isset($types['b'])){$background_i[] = $selector;}
1501
-				if(isset($types['o'])){$border_i[] = $selector;}
1502
-				if(isset($types['f'])){$fill_i[] = $selector;}
1503
-			}
1504
-
1505
-			// add any color rules
1506
-			if(!empty($color)){
1507
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1508
-			}
1509
-			if(!empty($color_i)){
1510
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1511
-			}
1512
-
1513
-			// add any background color rules
1514
-			if(!empty($background)){
1515
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1516
-			}
1517
-			if(!empty($background_i)){
1518
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1519
-			}
1520
-
1521
-			// add any border color rules
1522
-			if(!empty($border)){
1523
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1524
-			}
1525
-			if(!empty($border_i)){
1526
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1527
-			}
1528
-
1529
-			// add any fill color rules
1530
-			if(!empty($fill)){
1531
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1532
-			}
1533
-			if(!empty($fill_i)){
1534
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1535
-			}
1536
-
1537
-
1538
-			$prefix = $compatibility ? ".bsui " : "";
1539
-
1540
-			// darken
1541
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1542
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1543
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1544
-
1545
-			// lighten
1546
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1547
-
1548
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1549
-			$op_25 = $color_code."40"; // 25% opacity
1550
-
1551
-
1552
-			// button states
1553
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1554
-			$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;} ";
1555
-			$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.";} ";
1556
-			$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;} ";
1557
-
1558
-
1559
-			return $output;
1560
-		}
1561
-
1562
-		/**
1563
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
1564
-		 *
1565
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1566
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1567
-		 *
1568
-		 * @return  string
1569
-		 */
1570
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1571
-			$hexCode = ltrim($hexCode, '#');
1572
-
1573
-			if (strlen($hexCode) == 3) {
1574
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1575
-			}
1576
-
1577
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
1578
-
1579
-			foreach ($hexCode as & $color) {
1580
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1581
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
1582
-
1583
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1584
-			}
1585
-
1586
-			return '#' . implode($hexCode);
1587
-		}
1588
-
1589
-		/**
1590
-		 * Check if we should display examples.
1591
-		 */
1592
-		public function maybe_show_examples(){
1593
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1594
-				echo "<head>";
1595
-				wp_head();
1596
-				echo "</head>";
1597
-				echo "<body>";
1598
-				echo $this->get_examples();
1599
-				echo "</body>";
1600
-				exit;
1601
-			}
1602
-		}
1603
-
1604
-		/**
1605
-		 * Get developer examples.
1606
-		 *
1607
-		 * @return string
1608
-		 */
1609
-		public function get_examples(){
1610
-			$output = '';
1611
-
1612
-
1613
-			// open form
1614
-			$output .= "<form class='p-5 m-5 border rounded'>";
1615
-
1616
-			// input example
1617
-			$output .= aui()->input(array(
1618
-				'type'  =>  'text',
1619
-				'id'    =>  'text-example',
1620
-				'name'    =>  'text-example',
1621
-				'placeholder'   => 'text placeholder',
1622
-				'title'   => 'Text input example',
1623
-				'value' =>  '',
1624
-				'required'  => false,
1625
-				'help_text' => 'help text',
1626
-				'label' => 'Text input example label'
1627
-			));
1628
-
1629
-			// input example
1630
-			$output .= aui()->input(array(
1631
-				'type'  =>  'url',
1632
-				'id'    =>  'text-example2',
1633
-				'name'    =>  'text-example',
1634
-				'placeholder'   => 'url placeholder',
1635
-				'title'   => 'Text input example',
1636
-				'value' =>  '',
1637
-				'required'  => false,
1638
-				'help_text' => 'help text',
1639
-				'label' => 'Text input example label'
1640
-			));
1641
-
1642
-			// checkbox example
1643
-			$output .= aui()->input(array(
1644
-				'type'  =>  'checkbox',
1645
-				'id'    =>  'checkbox-example',
1646
-				'name'    =>  'checkbox-example',
1647
-				'placeholder'   => 'checkbox-example',
1648
-				'title'   => 'Checkbox example',
1649
-				'value' =>  '1',
1650
-				'checked'   => true,
1651
-				'required'  => false,
1652
-				'help_text' => 'help text',
1653
-				'label' => 'Checkbox checked'
1654
-			));
1655
-
1656
-			// checkbox example
1657
-			$output .= aui()->input(array(
1658
-				'type'  =>  'checkbox',
1659
-				'id'    =>  'checkbox-example2',
1660
-				'name'    =>  'checkbox-example2',
1661
-				'placeholder'   => 'checkbox-example',
1662
-				'title'   => 'Checkbox example',
1663
-				'value' =>  '1',
1664
-				'checked'   => false,
1665
-				'required'  => false,
1666
-				'help_text' => 'help text',
1667
-				'label' => 'Checkbox un-checked'
1668
-			));
1669
-
1670
-			// switch example
1671
-			$output .= aui()->input(array(
1672
-				'type'  =>  'checkbox',
1673
-				'id'    =>  'switch-example',
1674
-				'name'    =>  'switch-example',
1675
-				'placeholder'   => 'checkbox-example',
1676
-				'title'   => 'Switch example',
1677
-				'value' =>  '1',
1678
-				'checked'   => true,
1679
-				'switch'    => true,
1680
-				'required'  => false,
1681
-				'help_text' => 'help text',
1682
-				'label' => 'Switch on'
1683
-			));
1684
-
1685
-			// switch example
1686
-			$output .= aui()->input(array(
1687
-				'type'  =>  'checkbox',
1688
-				'id'    =>  'switch-example2',
1689
-				'name'    =>  'switch-example2',
1690
-				'placeholder'   => 'checkbox-example',
1691
-				'title'   => 'Switch example',
1692
-				'value' =>  '1',
1693
-				'checked'   => false,
1694
-				'switch'    => true,
1695
-				'required'  => false,
1696
-				'help_text' => 'help text',
1697
-				'label' => 'Switch off'
1698
-			));
1699
-
1700
-			// close form
1701
-			$output .= "</form>";
1702
-
1703
-			return $output;
1704
-		}
1705
-
1706
-		/**
1707
-		 * Calendar params.
1708
-		 *
1709
-		 * @since 0.1.44
1710
-		 *
1711
-		 * @return array Calendar params.
1712
-		 */
1713
-		public static function calendar_params() {
1714
-			$params = array(
1715
-				'month_long_1' => __( 'January', 'aui' ),
1716
-				'month_long_2' => __( 'February', 'aui' ),
1717
-				'month_long_3' => __( 'March', 'aui' ),
1718
-				'month_long_4' => __( 'April', 'aui' ),
1719
-				'month_long_5' => __( 'May', 'aui' ),
1720
-				'month_long_6' => __( 'June', 'aui' ),
1721
-				'month_long_7' => __( 'July', 'aui' ),
1722
-				'month_long_8' => __( 'August', 'aui' ),
1723
-				'month_long_9' => __( 'September', 'aui' ),
1724
-				'month_long_10' => __( 'October', 'aui' ),
1725
-				'month_long_11' => __( 'November', 'aui' ),
1726
-				'month_long_12' => __( 'December', 'aui' ),
1727
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
1728
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
1729
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
1730
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
1731
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
1732
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
1733
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
1734
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
1735
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
1736
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
1737
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
1738
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
1739
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
1740
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
1741
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
1742
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
1743
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
1744
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
1745
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
1746
-				'day_s2_1' => __( 'Su', 'aui' ),
1747
-				'day_s2_2' => __( 'Mo', 'aui' ),
1748
-				'day_s2_3' => __( 'Tu', 'aui' ),
1749
-				'day_s2_4' => __( 'We', 'aui' ),
1750
-				'day_s2_5' => __( 'Th', 'aui' ),
1751
-				'day_s2_6' => __( 'Fr', 'aui' ),
1752
-				'day_s2_7' => __( 'Sa', 'aui' ),
1753
-				'day_s3_1' => __( 'Sun', 'aui' ),
1754
-				'day_s3_2' => __( 'Mon', 'aui' ),
1755
-				'day_s3_3' => __( 'Tue', 'aui' ),
1756
-				'day_s3_4' => __( 'Wed', 'aui' ),
1757
-				'day_s3_5' => __( 'Thu', 'aui' ),
1758
-				'day_s3_6' => __( 'Fri', 'aui' ),
1759
-				'day_s3_7' => __( 'Sat', 'aui' ),
1760
-				'day_s5_1' => __( 'Sunday', 'aui' ),
1761
-				'day_s5_2' => __( 'Monday', 'aui' ),
1762
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
1763
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
1764
-				'day_s5_5' => __( 'Thursday', 'aui' ),
1765
-				'day_s5_6' => __( 'Friday', 'aui' ),
1766
-				'day_s5_7' => __( 'Saturday', 'aui' ),
1767
-				'am_lower' => __( 'am', 'aui' ),
1768
-				'pm_lower' => __( 'pm', 'aui' ),
1769
-				'am_upper' => __( 'AM', 'aui' ),
1770
-				'pm_upper' => __( 'PM', 'aui' ),
1771
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
1772
-				'time_24hr' => false,
1773
-				'year' => __( 'Year', 'aui' ),
1774
-				'hour' => __( 'Hour', 'aui' ),
1775
-				'minute' => __( 'Minute', 'aui' ),
1776
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
1777
-				'rangeSeparator' => __( ' to ', 'aui' ),
1778
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
1779
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
1780
-			);
1781
-
1782
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
1783
-		}
1784
-
1785
-		/**
1786
-		 * Flatpickr calendar localize.
1787
-		 *
1788
-		 * @since 0.1.44
1789
-		 *
1790
-		 * @return string Calendar locale.
1791
-		 */
1792
-		public static function flatpickr_locale() {
1793
-			$params = self::calendar_params();
1794
-
1795
-			if ( is_string( $params ) ) {
1796
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
1797
-			} else {
1798
-				foreach ( (array) $params as $key => $value ) {
1799
-					if ( ! is_scalar( $value ) ) {
1800
-						continue;
1801
-					}
1802
-
1803
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1804
-				}
1805
-			}
1329
+                '.nav-pills .nav-link.active' => array('b'),
1330
+                '.nav-pills .show>.nav-link' => array('b'),
1331
+                '.page-link' => array('c'),
1332
+                '.page-item.active .page-link' => array('b','o'),
1333
+                '.badge-primary' => array('b'),
1334
+                '.alert-primary' => array('b','o'),
1335
+                '.progress-bar' => array('b'),
1336
+                '.list-group-item.active' => array('b','o'),
1337
+                '.bg-primary' => array('b','f'),
1338
+                '.btn-link.btn-primary' => array('c'),
1339
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1340
+            );
1341
+
1342
+            $important_selectors = array(
1343
+                '.bg-primary' => array('b','f'),
1344
+                '.border-primary' => array('o'),
1345
+                '.text-primary' => array('c'),
1346
+            );
1347
+
1348
+            $color = array();
1349
+            $color_i = array();
1350
+            $background = array();
1351
+            $background_i = array();
1352
+            $border = array();
1353
+            $border_i = array();
1354
+            $fill = array();
1355
+            $fill_i = array();
1356
+
1357
+            $output = '';
1358
+
1359
+            // build rules into each type
1360
+            foreach($selectors as $selector => $types){
1361
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1362
+                $types = array_combine($types,$types);
1363
+                if(isset($types['c'])){$color[] = $selector;}
1364
+                if(isset($types['b'])){$background[] = $selector;}
1365
+                if(isset($types['o'])){$border[] = $selector;}
1366
+                if(isset($types['f'])){$fill[] = $selector;}
1367
+            }
1368
+
1369
+            // build rules into each type
1370
+            foreach($important_selectors as $selector => $types){
1371
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1372
+                $types = array_combine($types,$types);
1373
+                if(isset($types['c'])){$color_i[] = $selector;}
1374
+                if(isset($types['b'])){$background_i[] = $selector;}
1375
+                if(isset($types['o'])){$border_i[] = $selector;}
1376
+                if(isset($types['f'])){$fill_i[] = $selector;}
1377
+            }
1378
+
1379
+            // add any color rules
1380
+            if(!empty($color)){
1381
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1382
+            }
1383
+            if(!empty($color_i)){
1384
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1385
+            }
1386
+
1387
+            // add any background color rules
1388
+            if(!empty($background)){
1389
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1390
+            }
1391
+            if(!empty($background_i)){
1392
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1393
+            }
1394
+
1395
+            // add any border color rules
1396
+            if(!empty($border)){
1397
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1398
+            }
1399
+            if(!empty($border_i)){
1400
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1401
+            }
1402
+
1403
+            // add any fill color rules
1404
+            if(!empty($fill)){
1405
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1406
+            }
1407
+            if(!empty($fill_i)){
1408
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1409
+            }
1410
+
1411
+
1412
+            $prefix = $compatibility ? ".bsui " : "";
1413
+
1414
+            // darken
1415
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1416
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1417
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1418
+
1419
+            // lighten
1420
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1421
+
1422
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1423
+            $op_25 = $color_code."40"; // 25% opacity
1424
+
1425
+
1426
+            // button states
1427
+            $output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1428
+            $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;} ";
1429
+            $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.";} ";
1430
+            $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;} ";
1431
+
1432
+
1433
+            // dropdown's
1434
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1435
+
1436
+
1437
+            // input states
1438
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1439
+
1440
+            // page link
1441
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1442
+
1443
+            return $output;
1444
+        }
1445
+
1446
+        public static function css_secondary($color_code,$compatibility){;
1447
+            $color_code = sanitize_hex_color($color_code);
1448
+            if(!$color_code){return '';}
1449
+            /**
1450
+             * c = color, b = background color, o = border-color, f = fill
1451
+             */
1452
+            $selectors = array(
1453
+                '.btn-secondary' => array('b','o'),
1454
+                '.btn-secondary.disabled' => array('b','o'),
1455
+                '.btn-secondary:disabled' => array('b','o'),
1456
+                '.btn-outline-secondary' => array('c','o'),
1457
+                '.btn-outline-secondary:hover' => array('b','o'),
1458
+                '.btn-outline-secondary.disabled' => array('c'),
1459
+                '.btn-outline-secondary:disabled' => array('c'),
1460
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1461
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1462
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1463
+                '.badge-secondary' => array('b'),
1464
+                '.alert-secondary' => array('b','o'),
1465
+                '.btn-link.btn-secondary' => array('c'),
1466
+            );
1467
+
1468
+            $important_selectors = array(
1469
+                '.bg-secondary' => array('b','f'),
1470
+                '.border-secondary' => array('o'),
1471
+                '.text-secondary' => array('c'),
1472
+            );
1473
+
1474
+            $color = array();
1475
+            $color_i = array();
1476
+            $background = array();
1477
+            $background_i = array();
1478
+            $border = array();
1479
+            $border_i = array();
1480
+            $fill = array();
1481
+            $fill_i = array();
1482
+
1483
+            $output = '';
1484
+
1485
+            // build rules into each type
1486
+            foreach($selectors as $selector => $types){
1487
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1488
+                $types = array_combine($types,$types);
1489
+                if(isset($types['c'])){$color[] = $selector;}
1490
+                if(isset($types['b'])){$background[] = $selector;}
1491
+                if(isset($types['o'])){$border[] = $selector;}
1492
+                if(isset($types['f'])){$fill[] = $selector;}
1493
+            }
1494
+
1495
+            // build rules into each type
1496
+            foreach($important_selectors as $selector => $types){
1497
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1498
+                $types = array_combine($types,$types);
1499
+                if(isset($types['c'])){$color_i[] = $selector;}
1500
+                if(isset($types['b'])){$background_i[] = $selector;}
1501
+                if(isset($types['o'])){$border_i[] = $selector;}
1502
+                if(isset($types['f'])){$fill_i[] = $selector;}
1503
+            }
1504
+
1505
+            // add any color rules
1506
+            if(!empty($color)){
1507
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1508
+            }
1509
+            if(!empty($color_i)){
1510
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1511
+            }
1512
+
1513
+            // add any background color rules
1514
+            if(!empty($background)){
1515
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1516
+            }
1517
+            if(!empty($background_i)){
1518
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1519
+            }
1520
+
1521
+            // add any border color rules
1522
+            if(!empty($border)){
1523
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1524
+            }
1525
+            if(!empty($border_i)){
1526
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1527
+            }
1528
+
1529
+            // add any fill color rules
1530
+            if(!empty($fill)){
1531
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1532
+            }
1533
+            if(!empty($fill_i)){
1534
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1535
+            }
1536
+
1537
+
1538
+            $prefix = $compatibility ? ".bsui " : "";
1539
+
1540
+            // darken
1541
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1542
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1543
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1544
+
1545
+            // lighten
1546
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1547
+
1548
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1549
+            $op_25 = $color_code."40"; // 25% opacity
1550
+
1551
+
1552
+            // button states
1553
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1554
+            $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;} ";
1555
+            $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.";} ";
1556
+            $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;} ";
1557
+
1558
+
1559
+            return $output;
1560
+        }
1561
+
1562
+        /**
1563
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
1564
+         *
1565
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1566
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1567
+         *
1568
+         * @return  string
1569
+         */
1570
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1571
+            $hexCode = ltrim($hexCode, '#');
1572
+
1573
+            if (strlen($hexCode) == 3) {
1574
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1575
+            }
1576
+
1577
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1578
+
1579
+            foreach ($hexCode as & $color) {
1580
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1581
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1582
+
1583
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1584
+            }
1585
+
1586
+            return '#' . implode($hexCode);
1587
+        }
1588
+
1589
+        /**
1590
+         * Check if we should display examples.
1591
+         */
1592
+        public function maybe_show_examples(){
1593
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1594
+                echo "<head>";
1595
+                wp_head();
1596
+                echo "</head>";
1597
+                echo "<body>";
1598
+                echo $this->get_examples();
1599
+                echo "</body>";
1600
+                exit;
1601
+            }
1602
+        }
1603
+
1604
+        /**
1605
+         * Get developer examples.
1606
+         *
1607
+         * @return string
1608
+         */
1609
+        public function get_examples(){
1610
+            $output = '';
1611
+
1612
+
1613
+            // open form
1614
+            $output .= "<form class='p-5 m-5 border rounded'>";
1615
+
1616
+            // input example
1617
+            $output .= aui()->input(array(
1618
+                'type'  =>  'text',
1619
+                'id'    =>  'text-example',
1620
+                'name'    =>  'text-example',
1621
+                'placeholder'   => 'text placeholder',
1622
+                'title'   => 'Text input example',
1623
+                'value' =>  '',
1624
+                'required'  => false,
1625
+                'help_text' => 'help text',
1626
+                'label' => 'Text input example label'
1627
+            ));
1628
+
1629
+            // input example
1630
+            $output .= aui()->input(array(
1631
+                'type'  =>  'url',
1632
+                'id'    =>  'text-example2',
1633
+                'name'    =>  'text-example',
1634
+                'placeholder'   => 'url placeholder',
1635
+                'title'   => 'Text input example',
1636
+                'value' =>  '',
1637
+                'required'  => false,
1638
+                'help_text' => 'help text',
1639
+                'label' => 'Text input example label'
1640
+            ));
1641
+
1642
+            // checkbox example
1643
+            $output .= aui()->input(array(
1644
+                'type'  =>  'checkbox',
1645
+                'id'    =>  'checkbox-example',
1646
+                'name'    =>  'checkbox-example',
1647
+                'placeholder'   => 'checkbox-example',
1648
+                'title'   => 'Checkbox example',
1649
+                'value' =>  '1',
1650
+                'checked'   => true,
1651
+                'required'  => false,
1652
+                'help_text' => 'help text',
1653
+                'label' => 'Checkbox checked'
1654
+            ));
1655
+
1656
+            // checkbox example
1657
+            $output .= aui()->input(array(
1658
+                'type'  =>  'checkbox',
1659
+                'id'    =>  'checkbox-example2',
1660
+                'name'    =>  'checkbox-example2',
1661
+                'placeholder'   => 'checkbox-example',
1662
+                'title'   => 'Checkbox example',
1663
+                'value' =>  '1',
1664
+                'checked'   => false,
1665
+                'required'  => false,
1666
+                'help_text' => 'help text',
1667
+                'label' => 'Checkbox un-checked'
1668
+            ));
1669
+
1670
+            // switch example
1671
+            $output .= aui()->input(array(
1672
+                'type'  =>  'checkbox',
1673
+                'id'    =>  'switch-example',
1674
+                'name'    =>  'switch-example',
1675
+                'placeholder'   => 'checkbox-example',
1676
+                'title'   => 'Switch example',
1677
+                'value' =>  '1',
1678
+                'checked'   => true,
1679
+                'switch'    => true,
1680
+                'required'  => false,
1681
+                'help_text' => 'help text',
1682
+                'label' => 'Switch on'
1683
+            ));
1684
+
1685
+            // switch example
1686
+            $output .= aui()->input(array(
1687
+                'type'  =>  'checkbox',
1688
+                'id'    =>  'switch-example2',
1689
+                'name'    =>  'switch-example2',
1690
+                'placeholder'   => 'checkbox-example',
1691
+                'title'   => 'Switch example',
1692
+                'value' =>  '1',
1693
+                'checked'   => false,
1694
+                'switch'    => true,
1695
+                'required'  => false,
1696
+                'help_text' => 'help text',
1697
+                'label' => 'Switch off'
1698
+            ));
1699
+
1700
+            // close form
1701
+            $output .= "</form>";
1702
+
1703
+            return $output;
1704
+        }
1705
+
1706
+        /**
1707
+         * Calendar params.
1708
+         *
1709
+         * @since 0.1.44
1710
+         *
1711
+         * @return array Calendar params.
1712
+         */
1713
+        public static function calendar_params() {
1714
+            $params = array(
1715
+                'month_long_1' => __( 'January', 'aui' ),
1716
+                'month_long_2' => __( 'February', 'aui' ),
1717
+                'month_long_3' => __( 'March', 'aui' ),
1718
+                'month_long_4' => __( 'April', 'aui' ),
1719
+                'month_long_5' => __( 'May', 'aui' ),
1720
+                'month_long_6' => __( 'June', 'aui' ),
1721
+                'month_long_7' => __( 'July', 'aui' ),
1722
+                'month_long_8' => __( 'August', 'aui' ),
1723
+                'month_long_9' => __( 'September', 'aui' ),
1724
+                'month_long_10' => __( 'October', 'aui' ),
1725
+                'month_long_11' => __( 'November', 'aui' ),
1726
+                'month_long_12' => __( 'December', 'aui' ),
1727
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
1728
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
1729
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
1730
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
1731
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
1732
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
1733
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
1734
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
1735
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
1736
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
1737
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
1738
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
1739
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
1740
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
1741
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
1742
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
1743
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
1744
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
1745
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
1746
+                'day_s2_1' => __( 'Su', 'aui' ),
1747
+                'day_s2_2' => __( 'Mo', 'aui' ),
1748
+                'day_s2_3' => __( 'Tu', 'aui' ),
1749
+                'day_s2_4' => __( 'We', 'aui' ),
1750
+                'day_s2_5' => __( 'Th', 'aui' ),
1751
+                'day_s2_6' => __( 'Fr', 'aui' ),
1752
+                'day_s2_7' => __( 'Sa', 'aui' ),
1753
+                'day_s3_1' => __( 'Sun', 'aui' ),
1754
+                'day_s3_2' => __( 'Mon', 'aui' ),
1755
+                'day_s3_3' => __( 'Tue', 'aui' ),
1756
+                'day_s3_4' => __( 'Wed', 'aui' ),
1757
+                'day_s3_5' => __( 'Thu', 'aui' ),
1758
+                'day_s3_6' => __( 'Fri', 'aui' ),
1759
+                'day_s3_7' => __( 'Sat', 'aui' ),
1760
+                'day_s5_1' => __( 'Sunday', 'aui' ),
1761
+                'day_s5_2' => __( 'Monday', 'aui' ),
1762
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
1763
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
1764
+                'day_s5_5' => __( 'Thursday', 'aui' ),
1765
+                'day_s5_6' => __( 'Friday', 'aui' ),
1766
+                'day_s5_7' => __( 'Saturday', 'aui' ),
1767
+                'am_lower' => __( 'am', 'aui' ),
1768
+                'pm_lower' => __( 'pm', 'aui' ),
1769
+                'am_upper' => __( 'AM', 'aui' ),
1770
+                'pm_upper' => __( 'PM', 'aui' ),
1771
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
1772
+                'time_24hr' => false,
1773
+                'year' => __( 'Year', 'aui' ),
1774
+                'hour' => __( 'Hour', 'aui' ),
1775
+                'minute' => __( 'Minute', 'aui' ),
1776
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
1777
+                'rangeSeparator' => __( ' to ', 'aui' ),
1778
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
1779
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
1780
+            );
1781
+
1782
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
1783
+        }
1784
+
1785
+        /**
1786
+         * Flatpickr calendar localize.
1787
+         *
1788
+         * @since 0.1.44
1789
+         *
1790
+         * @return string Calendar locale.
1791
+         */
1792
+        public static function flatpickr_locale() {
1793
+            $params = self::calendar_params();
1794
+
1795
+            if ( is_string( $params ) ) {
1796
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
1797
+            } else {
1798
+                foreach ( (array) $params as $key => $value ) {
1799
+                    if ( ! is_scalar( $value ) ) {
1800
+                        continue;
1801
+                    }
1802
+
1803
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1804
+                }
1805
+            }
1806 1806
 
1807
-			$day_s3 = array();
1808
-			$day_s5 = array();
1807
+            $day_s3 = array();
1808
+            $day_s5 = array();
1809 1809
 
1810
-			for ( $i = 1; $i <= 7; $i ++ ) {
1811
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
1812
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
1813
-			}
1810
+            for ( $i = 1; $i <= 7; $i ++ ) {
1811
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
1812
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
1813
+            }
1814 1814
 
1815
-			$month_s = array();
1816
-			$month_long = array();
1815
+            $month_s = array();
1816
+            $month_long = array();
1817 1817
 
1818
-			for ( $i = 1; $i <= 12; $i ++ ) {
1819
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
1820
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
1821
-			}
1818
+            for ( $i = 1; $i <= 12; $i ++ ) {
1819
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
1820
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
1821
+            }
1822 1822
 
1823 1823
 ob_start();
1824 1824
 if ( 0 ) { ?><script><?php } ?>
@@ -1860,62 +1860,62 @@  discard block
 block discarded – undo
1860 1860
 }
1861 1861
 <?php if ( 0 ) { ?></script><?php } ?>
1862 1862
 <?php
1863
-			$locale = ob_get_clean();
1864
-
1865
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
1866
-		}
1867
-
1868
-		/**
1869
-		 * Select2 JS params.
1870
-		 *
1871
-		 * @since 0.1.44
1872
-		 *
1873
-		 * @return array Select2 JS params.
1874
-		 */
1875
-		public static function select2_params() {
1876
-			$params = array(
1877
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
1878
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
1879
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
1880
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
1881
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
1882
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
1883
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
1884
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
1885
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
1886
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
1887
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
1888
-			);
1889
-
1890
-			return apply_filters( 'ayecode_ui_select2_params', $params );
1891
-		}
1892
-
1893
-		/**
1894
-		 * Select2 JS localize.
1895
-		 *
1896
-		 * @since 0.1.44
1897
-		 *
1898
-		 * @return string Select2 JS locale.
1899
-		 */
1900
-		public static function select2_locale() {
1901
-			$params = self::select2_params();
1902
-
1903
-			foreach ( (array) $params as $key => $value ) {
1904
-				if ( ! is_scalar( $value ) ) {
1905
-					continue;
1906
-				}
1863
+            $locale = ob_get_clean();
1864
+
1865
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
1866
+        }
1867
+
1868
+        /**
1869
+         * Select2 JS params.
1870
+         *
1871
+         * @since 0.1.44
1872
+         *
1873
+         * @return array Select2 JS params.
1874
+         */
1875
+        public static function select2_params() {
1876
+            $params = array(
1877
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
1878
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
1879
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
1880
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
1881
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
1882
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
1883
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
1884
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
1885
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
1886
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
1887
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
1888
+            );
1889
+
1890
+            return apply_filters( 'ayecode_ui_select2_params', $params );
1891
+        }
1892
+
1893
+        /**
1894
+         * Select2 JS localize.
1895
+         *
1896
+         * @since 0.1.44
1897
+         *
1898
+         * @return string Select2 JS locale.
1899
+         */
1900
+        public static function select2_locale() {
1901
+            $params = self::select2_params();
1902
+
1903
+            foreach ( (array) $params as $key => $value ) {
1904
+                if ( ! is_scalar( $value ) ) {
1905
+                    continue;
1906
+                }
1907 1907
 
1908
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1909
-			}
1908
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1909
+            }
1910 1910
 
1911
-			$locale = json_encode( $params );
1911
+            $locale = json_encode( $params );
1912 1912
 
1913
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
1914
-		}
1915
-	}
1913
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
1914
+        }
1915
+    }
1916 1916
 
1917
-	/**
1918
-	 * Run the class if found.
1919
-	 */
1920
-	AyeCode_UI_Settings::instance();
1917
+    /**
1918
+     * Run the class if found.
1919
+     */
1920
+    AyeCode_UI_Settings::instance();
1921 1921
 }
1922 1922
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 		 * @return AyeCode_UI_Settings - Main instance.
99 99
 		 */
100 100
 		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
101
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
102 102
 
103 103
 				self::$instance = new AyeCode_UI_Settings;
104 104
 
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+				add_action('init', array(self::$instance, 'init')); // set settings
106 106
 
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
107
+				if (is_admin()) {
108
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
109
+					add_action('admin_init', array(self::$instance, 'register_settings'));
110 110
 
111 111
 					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
113 113
 				}
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
117
+				do_action('ayecode_ui_settings_loaded');
118 118
 			}
119 119
 
120 120
 			return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		/**
124 124
 		 * Setup some constants.
125 125
 		 */
126
-		public function constants(){
126
+		public function constants() {
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129 129
 			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
@@ -143,25 +143,25 @@  discard block
 block discarded – undo
143 143
 			 *
144 144
 			 * We load super early in case there is a theme version that might change the colors
145 145
 			 */
146
-			if ( $this->settings['css'] ) {
147
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
146
+			if ($this->settings['css']) {
147
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1);
148 148
 			}
149
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
149
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
150
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
151 151
 			}
152 152
 
153 153
 			// maybe load JS
154
-			if ( $this->settings['js'] ) {
154
+			if ($this->settings['js']) {
155 155
 				$priority = $this->is_bs3_compat() ? 100 : 1;
156
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
156
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority);
157 157
 			}
158
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
159
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
158
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
159
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
160 160
 			}
161 161
 
162 162
 			// Maybe set the HTML font size
163
-			if ( $this->settings['html_font_size'] ) {
164
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
163
+			if ($this->settings['html_font_size']) {
164
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
165 165
 			}
166 166
 
167 167
 
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 		 *
173 173
 		 * @return bool
174 174
 		 */
175
-		public function load_admin_scripts(){
175
+		public function load_admin_scripts() {
176 176
 			$result = true;
177 177
 
178 178
 			// check if specifically disabled
179
-			if(!empty($this->settings['disable_admin'])){
180
-				$url_parts = explode("\n",$this->settings['disable_admin']);
181
-				foreach($url_parts as $part){
182
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
179
+			if (!empty($this->settings['disable_admin'])) {
180
+				$url_parts = explode("\n", $this->settings['disable_admin']);
181
+				foreach ($url_parts as $part) {
182
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
183 183
 						return false; // return early, no point checking further
184 184
 					}
185 185
 				}
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 		/**
192 192
 		 * Add a html font size to the footer.
193 193
 		 */
194
-		public function html_font_size(){
194
+		public function html_font_size() {
195 195
 			$this->settings = $this->get_settings();
196
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
196
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
197 197
 		}
198 198
 
199 199
 		/**
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 		 * 
202 202
 		 * @return bool
203 203
 		 */
204
-		public function is_aui_screen(){
204
+		public function is_aui_screen() {
205 205
 			$load = false;
206 206
 			// check if we should load or not
207
-			if ( is_admin() ) {
207
+			if (is_admin()) {
208 208
 				// Only enable on set pages
209 209
 				$aui_screens = array(
210 210
 					'page',
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 					'settings_page_ayecode-ui-settings',
213 213
 					'appearance_page_gutenberg-widgets'
214 214
 				);
215
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
215
+				$screen_ids = apply_filters('aui_screen_ids', $aui_screens);
216 216
 
217 217
 				$screen = get_current_screen();
218 218
 
219 219
 //				echo '###'.$screen->id;
220 220
 				
221
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
221
+				if ($screen && in_array($screen->id, $screen_ids)) {
222 222
 					$load = true;
223 223
 				}
224 224
 			}
@@ -231,25 +231,25 @@  discard block
 block discarded – undo
231 231
 		 */
232 232
 		public function enqueue_style() {
233 233
 
234
-			if( is_admin() && !$this->is_aui_screen()){
234
+			if (is_admin() && !$this->is_aui_screen()) {
235 235
 				// don't add wp-admin scripts if not requested to
236
-			}else{
236
+			} else {
237 237
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
238 238
 
239 239
 				$rtl = is_rtl() ? '-rtl' : '';
240 240
 
241
-				if($this->settings[$css_setting]){
242
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
243
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
244
-					wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
245
-					wp_enqueue_style( 'ayecode-ui' );
241
+				if ($this->settings[$css_setting]) {
242
+					$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
243
+					$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css';
244
+					wp_register_style('ayecode-ui', $url, array(), $this->latest);
245
+					wp_enqueue_style('ayecode-ui');
246 246
 
247 247
 					// flatpickr
248
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
248
+					wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest);
249 249
 
250 250
 
251 251
 					// fix some wp-admin issues
252
-					if(is_admin()){
252
+					if (is_admin()) {
253 253
 						$custom_css = "
254 254
                 body{
255 255
                     background-color: #f1f1f1;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 						    padding: 0;
296 296
 						}
297 297
 					";
298
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
298
+						wp_add_inline_style('ayecode-ui', $custom_css);
299 299
 					}
300 300
 
301 301
 					// custom changes
302
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
302
+					wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
303 303
 
304 304
 				}
305 305
 			}
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 				function aui_init_flatpickr(){
559 559
 					if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
560 560
 						$aui_doing_init_flatpickr = true;
561
-						<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
561
+						<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
562 562
 						jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
563 563
 					}
564 564
 					$aui_doing_init_flatpickr = false;
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
 			/*
859 859
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
860 860
 			 */
861
-			return str_replace( array(
861
+			return str_replace(array(
862 862
 				'<script>',
863 863
 				'</script>'
864
-			), '', $output );
864
+			), '', $output);
865 865
 		}
866 866
 
867 867
 
@@ -875,13 +875,13 @@  discard block
 block discarded – undo
875 875
 			ob_start();
876 876
 			?>
877 877
 			<script>
878
-				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
878
+				<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
879 879
 				/* With Avada builder */
880 880
 
881 881
 				<?php } ?>
882 882
 			</script>
883 883
 			<?php
884
-			return str_replace( array(
884
+			return str_replace(array(
885 885
 				'<script>',
886 886
 				'</script>'
887 887
 			), '', ob_get_clean());
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		 *
893 893
 		 * If this remains small then its best to use this than to add another JS file.
894 894
 		 */
895
-		public function inline_script_file_browser(){
895
+		public function inline_script_file_browser() {
896 896
 			ob_start();
897 897
 			?>
898 898
 			<script>
@@ -907,10 +907,10 @@  discard block
 block discarded – undo
907 907
 			/*
908 908
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
909 909
 			 */
910
-			return str_replace( array(
910
+			return str_replace(array(
911 911
 				'<script>',
912 912
 				'</script>'
913
-			), '', $output );
913
+			), '', $output);
914 914
 		}
915 915
 
916 916
 		/**
@@ -918,50 +918,50 @@  discard block
 block discarded – undo
918 918
 		 */
919 919
 		public function enqueue_scripts() {
920 920
 
921
-			if( is_admin() && !$this->is_aui_screen()){
921
+			if (is_admin() && !$this->is_aui_screen()) {
922 922
 				// don't add wp-admin scripts if not requested to
923
-			}else {
923
+			} else {
924 924
 
925 925
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
926 926
 
927 927
 				// select2
928
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
928
+				wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
929 929
 
930 930
 				// flatpickr
931
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
931
+				wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest);
932 932
 
933 933
 				// Bootstrap file browser
934
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
935
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
934
+				wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
935
+				wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
936 936
 
937 937
 				$load_inline = false;
938 938
 
939
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
939
+				if ($this->settings[$js_setting] == 'core-popper') {
940 940
 					// Bootstrap bundle
941 941
 					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
942
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
942
+					wp_register_script('bootstrap-js-bundle', $url, array(
943 943
 						'select2',
944 944
 						'jquery'
945
-					), $this->latest, $this->is_bs3_compat() );
945
+					), $this->latest, $this->is_bs3_compat());
946 946
 					// if in admin then add to footer for compatibility.
947
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
947
+					is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
948 948
 					$script = $this->inline_script();
949
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
950
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
949
+					wp_add_inline_script('bootstrap-js-bundle', $script);
950
+				} elseif ($this->settings[$js_setting] == 'popper') {
951 951
 					$url = $this->url . 'assets/js/popper.min.js';
952
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
953
-					wp_enqueue_script( 'bootstrap-js-popper' );
952
+					wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->latest);
953
+					wp_enqueue_script('bootstrap-js-popper');
954 954
 					$load_inline = true;
955 955
 				} else {
956 956
 					$load_inline = true;
957 957
 				}
958 958
 
959 959
 				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
960
-				if ( $load_inline ) {
961
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
962
-					wp_enqueue_script( 'bootstrap-dummy' );
960
+				if ($load_inline) {
961
+					wp_register_script('bootstrap-dummy', '', array('select2', 'jquery'));
962
+					wp_enqueue_script('bootstrap-dummy');
963 963
 					$script = $this->inline_script();
964
-					wp_add_inline_script( 'bootstrap-dummy', $script );
964
+					wp_add_inline_script('bootstrap-dummy', $script);
965 965
 				}
966 966
 			}
967 967
 
@@ -970,9 +970,9 @@  discard block
 block discarded – undo
970 970
 		/**
971 971
 		 * Enqueue flatpickr if called.
972 972
 		 */
973
-		public function enqueue_flatpickr(){
974
-			wp_enqueue_style( 'flatpickr' );
975
-			wp_enqueue_script( 'flatpickr' );
973
+		public function enqueue_flatpickr() {
974
+			wp_enqueue_style('flatpickr');
975
+			wp_enqueue_script('flatpickr');
976 976
 		}
977 977
 
978 978
 		/**
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 
985 985
 			$url = '';
986 986
 			// check if we are inside a plugin
987
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
987
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
988 988
 
989 989
 			// add check in-case user has changed wp-content dir name.
990 990
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
991
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
992
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
991
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
992
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
993 993
 
994
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
995
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
994
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
995
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
996 996
 			}
997 997
 
998 998
 			return $url;
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 		 * Register the database settings with WordPress.
1003 1003
 		 */
1004 1004
 		public function register_settings() {
1005
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1005
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
1006 1006
 		}
1007 1007
 
1008 1008
 		/**
@@ -1011,10 +1011,10 @@  discard block
 block discarded – undo
1011 1011
 		 */
1012 1012
 		public function menu_item() {
1013 1013
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1014
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1014
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1015 1015
 				$this,
1016 1016
 				'settings_page'
1017
-			) );
1017
+			));
1018 1018
 		}
1019 1019
 
1020 1020
 		/**
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 		 *
1023 1023
 		 * @return array
1024 1024
 		 */
1025
-		public function theme_js_settings(){
1025
+		public function theme_js_settings() {
1026 1026
 			return array(
1027 1027
 				'ayetheme' => 'popper',
1028 1028
 				'listimia' => 'required',
@@ -1038,17 +1038,17 @@  discard block
 block discarded – undo
1038 1038
 		 */
1039 1039
 		public function get_settings() {
1040 1040
 
1041
-			$db_settings = get_option( 'ayecode-ui-settings' );
1041
+			$db_settings = get_option('ayecode-ui-settings');
1042 1042
 			$js_default = 'core-popper';
1043 1043
 			$js_default_backend = $js_default;
1044 1044
 
1045 1045
 			// maybe set defaults (if no settings set)
1046
-			if(empty($db_settings)){
1047
-				$active_theme = strtolower( get_template() ); // active parent theme.
1046
+			if (empty($db_settings)) {
1047
+				$active_theme = strtolower(get_template()); // active parent theme.
1048 1048
 				$theme_js_settings = self::theme_js_settings();
1049
-				if(isset($theme_js_settings[$active_theme])){
1049
+				if (isset($theme_js_settings[$active_theme])) {
1050 1050
 					$js_default = $theme_js_settings[$active_theme];
1051
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1051
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
1052 1052
 				}
1053 1053
 			}
1054 1054
 
@@ -1061,14 +1061,14 @@  discard block
 block discarded – undo
1061 1061
 				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1062 1062
 			);
1063 1063
 
1064
-			$settings = wp_parse_args( $db_settings, $defaults );
1064
+			$settings = wp_parse_args($db_settings, $defaults);
1065 1065
 
1066 1066
 			/**
1067 1067
 			 * Filter the Bootstrap settings.
1068 1068
 			 *
1069 1069
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1070 1070
 			 */
1071
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1071
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
1072 1072
 		}
1073 1073
 
1074 1074
 
@@ -1076,90 +1076,90 @@  discard block
 block discarded – undo
1076 1076
 		 * The settings page html output.
1077 1077
 		 */
1078 1078
 		public function settings_page() {
1079
-			if ( ! current_user_can( 'manage_options' ) ) {
1080
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1079
+			if (!current_user_can('manage_options')) {
1080
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
1081 1081
 			}
1082 1082
 			?>
1083 1083
 			<div class="wrap">
1084 1084
 				<h1><?php echo $this->name; ?></h1>
1085
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1085
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", 'aui'); ?></p>
1086 1086
 				<form method="post" action="options.php">
1087 1087
 					<?php
1088
-					settings_fields( 'ayecode-ui-settings' );
1089
-					do_settings_sections( 'ayecode-ui-settings' );
1088
+					settings_fields('ayecode-ui-settings');
1089
+					do_settings_sections('ayecode-ui-settings');
1090 1090
 					?>
1091 1091
 
1092
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1092
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
1093 1093
 					<table class="form-table wpbs-table-settings">
1094 1094
 						<tr valign="top">
1095 1095
 							<th scope="row"><label
1096
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1096
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
1097 1097
 							<td>
1098 1098
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
1099
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1100
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1101
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1099
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1100
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1101
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1102 1102
 								</select>
1103 1103
 							</td>
1104 1104
 						</tr>
1105 1105
 
1106 1106
 						<tr valign="top">
1107 1107
 							<th scope="row"><label
1108
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1108
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
1109 1109
 							<td>
1110 1110
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
1111
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1112
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1113
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1114
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1111
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1112
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1113
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1114
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1115 1115
 								</select>
1116 1116
 							</td>
1117 1117
 						</tr>
1118 1118
 
1119 1119
 						<tr valign="top">
1120 1120
 							<th scope="row"><label
1121
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
1121
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
1122 1122
 							<td>
1123
-								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" />
1124
-								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.",'aui');?></p>
1123
+								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" />
1124
+								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'aui'); ?></p>
1125 1125
 							</td>
1126 1126
 						</tr>
1127 1127
 
1128 1128
 					</table>
1129 1129
 
1130
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1130
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1131 1131
 					<table class="form-table wpbs-table-settings">
1132 1132
 						<tr valign="top">
1133 1133
 							<th scope="row"><label
1134
-									for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1134
+									for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1135 1135
 							<td>
1136 1136
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1137
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1138
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option>
1139
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1137
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1138
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option>
1139
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1140 1140
 								</select>
1141 1141
 							</td>
1142 1142
 						</tr>
1143 1143
 
1144 1144
 						<tr valign="top">
1145 1145
 							<th scope="row"><label
1146
-									for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1146
+									for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1147 1147
 							<td>
1148 1148
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1149
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1150
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1151
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1152
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1149
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1150
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1151
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1152
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1153 1153
 								</select>
1154 1154
 							</td>
1155 1155
 						</tr>
1156 1156
 
1157 1157
 						<tr valign="top">
1158 1158
 							<th scope="row"><label
1159
-									for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1159
+									for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1160 1160
 							<td>
1161
-								<p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p>
1162
-								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin'];?></textarea>
1161
+								<p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p>
1162
+								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin']; ?></textarea>
1163 1163
 
1164 1164
 							</td>
1165 1165
 						</tr>
@@ -1177,9 +1177,9 @@  discard block
 block discarded – undo
1177 1177
 			<?php
1178 1178
 		}
1179 1179
 
1180
-		public function customizer_settings($wp_customize){
1180
+		public function customizer_settings($wp_customize) {
1181 1181
 			$wp_customize->add_section('aui_settings', array(
1182
-				'title'    => __('AyeCode UI','aui'),
1182
+				'title'    => __('AyeCode UI', 'aui'),
1183 1183
 				'priority' => 120,
1184 1184
 			));
1185 1185
 
@@ -1193,8 +1193,8 @@  discard block
 block discarded – undo
1193 1193
 				'type'              => 'option',
1194 1194
 				'transport'         => 'refresh',
1195 1195
 			));
1196
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1197
-				'label'    => __('Primary Color','aui'),
1196
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1197
+				'label'    => __('Primary Color', 'aui'),
1198 1198
 				'section'  => 'aui_settings',
1199 1199
 				'settings' => 'aui_options[color_primary]',
1200 1200
 			)));
@@ -1206,8 +1206,8 @@  discard block
 block discarded – undo
1206 1206
 				'type'              => 'option',
1207 1207
 				'transport'         => 'refresh',
1208 1208
 			));
1209
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1210
-				'label'    => __('Secondary Color','aui'),
1209
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1210
+				'label'    => __('Secondary Color', 'aui'),
1211 1211
 				'section'  => 'aui_settings',
1212 1212
 				'settings' => 'aui_options[color_secondary]',
1213 1213
 			)));
@@ -1233,12 +1233,12 @@  discard block
 block discarded – undo
1233 1233
 			.collapse.show:not(.in){display: inherit;}
1234 1234
 			.fade.show{opacity: 1;}
1235 1235
 
1236
-			<?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?>
1236
+			<?php if (defined('SVQ_THEME_VERSION')) { ?>
1237 1237
 			/* KLEO theme specific */
1238 1238
 			.kleo-main-header .navbar-collapse.collapse.show:not(.in){display: inherit !important;}
1239 1239
 			<?php } ?>
1240 1240
 
1241
-			<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1241
+			<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1242 1242
 			/* With Avada builder */
1243 1243
 			body.modal-open .modal.in  {opacity:1;z-index: 99999}
1244 1244
 			body.modal-open .modal.bsui.in .modal-content  {box-shadow: none;}
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 			<?php } ?>
1247 1247
 			</style>
1248 1248
 			<?php
1249
-			return str_replace( array(
1249
+			return str_replace(array(
1250 1250
 				'<style>',
1251 1251
 				'</style>'
1252 1252
 			), '', ob_get_clean());
@@ -1266,16 +1266,16 @@  discard block
 block discarded – undo
1266 1266
 				<?php
1267 1267
 
1268 1268
 					// BS v3 compat
1269
-					if( self::is_bs3_compat() ){
1269
+					if (self::is_bs3_compat()) {
1270 1270
 					    echo self::bs3_compat_css();
1271 1271
 					}
1272 1272
 
1273
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1274
-						echo self::css_primary($primary_color,$compatibility);
1273
+					if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) {
1274
+						echo self::css_primary($primary_color, $compatibility);
1275 1275
 					}
1276 1276
 
1277
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1278
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1277
+					if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) {
1278
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
1279 1279
 					}
1280 1280
 
1281 1281
 					// Set admin bar z-index lower when modal is open.
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 			/*
1289 1289
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1290 1290
 			 */
1291
-			return str_replace( array(
1291
+			return str_replace(array(
1292 1292
 				'<style>',
1293 1293
 				'</style>'
1294 1294
 			), '', ob_get_clean());
@@ -1299,48 +1299,48 @@  discard block
 block discarded – undo
1299 1299
 		 *
1300 1300
 		 * @return bool
1301 1301
 		 */
1302
-		public static function is_bs3_compat(){
1302
+		public static function is_bs3_compat() {
1303 1303
 			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1304 1304
 		}
1305 1305
 
1306
-		public static function css_primary($color_code,$compatibility){;
1306
+		public static function css_primary($color_code, $compatibility) {;
1307 1307
 			$color_code = sanitize_hex_color($color_code);
1308
-			if(!$color_code){return '';}
1308
+			if (!$color_code) {return ''; }
1309 1309
 			/**
1310 1310
 			 * c = color, b = background color, o = border-color, f = fill
1311 1311
 			 */
1312 1312
 			$selectors = array(
1313 1313
 				'a' => array('c'),
1314
-				'.btn-primary' => array('b','o'),
1315
-				'.btn-primary.disabled' => array('b','o'),
1316
-				'.btn-primary:disabled' => array('b','o'),
1317
-				'.btn-outline-primary' => array('c','o'),
1318
-				'.btn-outline-primary:hover' => array('b','o'),
1319
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1320
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1321
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1314
+				'.btn-primary' => array('b', 'o'),
1315
+				'.btn-primary.disabled' => array('b', 'o'),
1316
+				'.btn-primary:disabled' => array('b', 'o'),
1317
+				'.btn-outline-primary' => array('c', 'o'),
1318
+				'.btn-outline-primary:hover' => array('b', 'o'),
1319
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1320
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1321
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1322 1322
 				'.btn-link' => array('c'),
1323 1323
 				'.dropdown-item.active' => array('b'),
1324
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1325
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1324
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1325
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1326 1326
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1327 1327
 //				'.custom-range::-moz-range-thumb' => array('b'),
1328 1328
 //				'.custom-range::-ms-thumb' => array('b'),
1329 1329
 				'.nav-pills .nav-link.active' => array('b'),
1330 1330
 				'.nav-pills .show>.nav-link' => array('b'),
1331 1331
 				'.page-link' => array('c'),
1332
-				'.page-item.active .page-link' => array('b','o'),
1332
+				'.page-item.active .page-link' => array('b', 'o'),
1333 1333
 				'.badge-primary' => array('b'),
1334
-				'.alert-primary' => array('b','o'),
1334
+				'.alert-primary' => array('b', 'o'),
1335 1335
 				'.progress-bar' => array('b'),
1336
-				'.list-group-item.active' => array('b','o'),
1337
-				'.bg-primary' => array('b','f'),
1336
+				'.list-group-item.active' => array('b', 'o'),
1337
+				'.bg-primary' => array('b', 'f'),
1338 1338
 				'.btn-link.btn-primary' => array('c'),
1339 1339
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1340 1340
 			);
1341 1341
 
1342 1342
 			$important_selectors = array(
1343
-				'.bg-primary' => array('b','f'),
1343
+				'.bg-primary' => array('b', 'f'),
1344 1344
 				'.border-primary' => array('o'),
1345 1345
 				'.text-primary' => array('c'),
1346 1346
 			);
@@ -1357,116 +1357,116 @@  discard block
 block discarded – undo
1357 1357
 			$output = '';
1358 1358
 
1359 1359
 			// build rules into each type
1360
-			foreach($selectors as $selector => $types){
1361
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1362
-				$types = array_combine($types,$types);
1363
-				if(isset($types['c'])){$color[] = $selector;}
1364
-				if(isset($types['b'])){$background[] = $selector;}
1365
-				if(isset($types['o'])){$border[] = $selector;}
1366
-				if(isset($types['f'])){$fill[] = $selector;}
1360
+			foreach ($selectors as $selector => $types) {
1361
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1362
+				$types = array_combine($types, $types);
1363
+				if (isset($types['c'])) {$color[] = $selector; }
1364
+				if (isset($types['b'])) {$background[] = $selector; }
1365
+				if (isset($types['o'])) {$border[] = $selector; }
1366
+				if (isset($types['f'])) {$fill[] = $selector; }
1367 1367
 			}
1368 1368
 
1369 1369
 			// build rules into each type
1370
-			foreach($important_selectors as $selector => $types){
1371
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1372
-				$types = array_combine($types,$types);
1373
-				if(isset($types['c'])){$color_i[] = $selector;}
1374
-				if(isset($types['b'])){$background_i[] = $selector;}
1375
-				if(isset($types['o'])){$border_i[] = $selector;}
1376
-				if(isset($types['f'])){$fill_i[] = $selector;}
1370
+			foreach ($important_selectors as $selector => $types) {
1371
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1372
+				$types = array_combine($types, $types);
1373
+				if (isset($types['c'])) {$color_i[] = $selector; }
1374
+				if (isset($types['b'])) {$background_i[] = $selector; }
1375
+				if (isset($types['o'])) {$border_i[] = $selector; }
1376
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1377 1377
 			}
1378 1378
 
1379 1379
 			// add any color rules
1380
-			if(!empty($color)){
1381
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1380
+			if (!empty($color)) {
1381
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1382 1382
 			}
1383
-			if(!empty($color_i)){
1384
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1383
+			if (!empty($color_i)) {
1384
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1385 1385
 			}
1386 1386
 
1387 1387
 			// add any background color rules
1388
-			if(!empty($background)){
1389
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1388
+			if (!empty($background)) {
1389
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1390 1390
 			}
1391
-			if(!empty($background_i)){
1392
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1391
+			if (!empty($background_i)) {
1392
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1393 1393
 			}
1394 1394
 
1395 1395
 			// add any border color rules
1396
-			if(!empty($border)){
1397
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1396
+			if (!empty($border)) {
1397
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1398 1398
 			}
1399
-			if(!empty($border_i)){
1400
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1399
+			if (!empty($border_i)) {
1400
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1401 1401
 			}
1402 1402
 
1403 1403
 			// add any fill color rules
1404
-			if(!empty($fill)){
1405
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1404
+			if (!empty($fill)) {
1405
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1406 1406
 			}
1407
-			if(!empty($fill_i)){
1408
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1407
+			if (!empty($fill_i)) {
1408
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1409 1409
 			}
1410 1410
 
1411 1411
 
1412 1412
 			$prefix = $compatibility ? ".bsui " : "";
1413 1413
 
1414 1414
 			// darken
1415
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1416
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1417
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1415
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1416
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1417
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1418 1418
 
1419 1419
 			// lighten
1420
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1420
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1421 1421
 
1422 1422
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1423
-			$op_25 = $color_code."40"; // 25% opacity
1423
+			$op_25 = $color_code . "40"; // 25% opacity
1424 1424
 
1425 1425
 
1426 1426
 			// button states
1427
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1428
-			$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;} ";
1429
-			$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.";} ";
1430
-			$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;} ";
1427
+			$output .= $prefix . " .btn-primary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1428
+			$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;} ";
1429
+			$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 . ";} ";
1430
+			$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;} ";
1431 1431
 
1432 1432
 
1433 1433
 			// dropdown's
1434
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1434
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1435 1435
 
1436 1436
 
1437 1437
 			// input states
1438
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1438
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1439 1439
 
1440 1440
 			// page link
1441
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1441
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1442 1442
 
1443 1443
 			return $output;
1444 1444
 		}
1445 1445
 
1446
-		public static function css_secondary($color_code,$compatibility){;
1446
+		public static function css_secondary($color_code, $compatibility) {;
1447 1447
 			$color_code = sanitize_hex_color($color_code);
1448
-			if(!$color_code){return '';}
1448
+			if (!$color_code) {return ''; }
1449 1449
 			/**
1450 1450
 			 * c = color, b = background color, o = border-color, f = fill
1451 1451
 			 */
1452 1452
 			$selectors = array(
1453
-				'.btn-secondary' => array('b','o'),
1454
-				'.btn-secondary.disabled' => array('b','o'),
1455
-				'.btn-secondary:disabled' => array('b','o'),
1456
-				'.btn-outline-secondary' => array('c','o'),
1457
-				'.btn-outline-secondary:hover' => array('b','o'),
1453
+				'.btn-secondary' => array('b', 'o'),
1454
+				'.btn-secondary.disabled' => array('b', 'o'),
1455
+				'.btn-secondary:disabled' => array('b', 'o'),
1456
+				'.btn-outline-secondary' => array('c', 'o'),
1457
+				'.btn-outline-secondary:hover' => array('b', 'o'),
1458 1458
 				'.btn-outline-secondary.disabled' => array('c'),
1459 1459
 				'.btn-outline-secondary:disabled' => array('c'),
1460
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1461
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1462
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1460
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1461
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1462
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
1463 1463
 				'.badge-secondary' => array('b'),
1464
-				'.alert-secondary' => array('b','o'),
1464
+				'.alert-secondary' => array('b', 'o'),
1465 1465
 				'.btn-link.btn-secondary' => array('c'),
1466 1466
 			);
1467 1467
 
1468 1468
 			$important_selectors = array(
1469
-				'.bg-secondary' => array('b','f'),
1469
+				'.bg-secondary' => array('b', 'f'),
1470 1470
 				'.border-secondary' => array('o'),
1471 1471
 				'.text-secondary' => array('c'),
1472 1472
 			);
@@ -1483,77 +1483,77 @@  discard block
 block discarded – undo
1483 1483
 			$output = '';
1484 1484
 
1485 1485
 			// build rules into each type
1486
-			foreach($selectors as $selector => $types){
1487
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1488
-				$types = array_combine($types,$types);
1489
-				if(isset($types['c'])){$color[] = $selector;}
1490
-				if(isset($types['b'])){$background[] = $selector;}
1491
-				if(isset($types['o'])){$border[] = $selector;}
1492
-				if(isset($types['f'])){$fill[] = $selector;}
1486
+			foreach ($selectors as $selector => $types) {
1487
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1488
+				$types = array_combine($types, $types);
1489
+				if (isset($types['c'])) {$color[] = $selector; }
1490
+				if (isset($types['b'])) {$background[] = $selector; }
1491
+				if (isset($types['o'])) {$border[] = $selector; }
1492
+				if (isset($types['f'])) {$fill[] = $selector; }
1493 1493
 			}
1494 1494
 
1495 1495
 			// build rules into each type
1496
-			foreach($important_selectors as $selector => $types){
1497
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1498
-				$types = array_combine($types,$types);
1499
-				if(isset($types['c'])){$color_i[] = $selector;}
1500
-				if(isset($types['b'])){$background_i[] = $selector;}
1501
-				if(isset($types['o'])){$border_i[] = $selector;}
1502
-				if(isset($types['f'])){$fill_i[] = $selector;}
1496
+			foreach ($important_selectors as $selector => $types) {
1497
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1498
+				$types = array_combine($types, $types);
1499
+				if (isset($types['c'])) {$color_i[] = $selector; }
1500
+				if (isset($types['b'])) {$background_i[] = $selector; }
1501
+				if (isset($types['o'])) {$border_i[] = $selector; }
1502
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1503 1503
 			}
1504 1504
 
1505 1505
 			// add any color rules
1506
-			if(!empty($color)){
1507
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1506
+			if (!empty($color)) {
1507
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1508 1508
 			}
1509
-			if(!empty($color_i)){
1510
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1509
+			if (!empty($color_i)) {
1510
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1511 1511
 			}
1512 1512
 
1513 1513
 			// add any background color rules
1514
-			if(!empty($background)){
1515
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1514
+			if (!empty($background)) {
1515
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1516 1516
 			}
1517
-			if(!empty($background_i)){
1518
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1517
+			if (!empty($background_i)) {
1518
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1519 1519
 			}
1520 1520
 
1521 1521
 			// add any border color rules
1522
-			if(!empty($border)){
1523
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1522
+			if (!empty($border)) {
1523
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1524 1524
 			}
1525
-			if(!empty($border_i)){
1526
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1525
+			if (!empty($border_i)) {
1526
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1527 1527
 			}
1528 1528
 
1529 1529
 			// add any fill color rules
1530
-			if(!empty($fill)){
1531
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1530
+			if (!empty($fill)) {
1531
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1532 1532
 			}
1533
-			if(!empty($fill_i)){
1534
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1533
+			if (!empty($fill_i)) {
1534
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1535 1535
 			}
1536 1536
 
1537 1537
 
1538 1538
 			$prefix = $compatibility ? ".bsui " : "";
1539 1539
 
1540 1540
 			// darken
1541
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1542
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1543
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1541
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1542
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1543
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1544 1544
 
1545 1545
 			// lighten
1546
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1546
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1547 1547
 
1548 1548
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1549
-			$op_25 = $color_code."40"; // 25% opacity
1549
+			$op_25 = $color_code . "40"; // 25% opacity
1550 1550
 
1551 1551
 
1552 1552
 			// button states
1553
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1554
-			$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;} ";
1555
-			$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.";} ";
1556
-			$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;} ";
1553
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1554
+			$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;} ";
1555
+			$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 . ";} ";
1556
+			$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;} ";
1557 1557
 
1558 1558
 
1559 1559
 			return $output;
@@ -1589,8 +1589,8 @@  discard block
 block discarded – undo
1589 1589
 		/**
1590 1590
 		 * Check if we should display examples.
1591 1591
 		 */
1592
-		public function maybe_show_examples(){
1593
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1592
+		public function maybe_show_examples() {
1593
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1594 1594
 				echo "<head>";
1595 1595
 				wp_head();
1596 1596
 				echo "</head>";
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 		 *
1607 1607
 		 * @return string
1608 1608
 		 */
1609
-		public function get_examples(){
1609
+		public function get_examples() {
1610 1610
 			$output = '';
1611 1611
 
1612 1612
 
@@ -1712,74 +1712,74 @@  discard block
 block discarded – undo
1712 1712
 		 */
1713 1713
 		public static function calendar_params() {
1714 1714
 			$params = array(
1715
-				'month_long_1' => __( 'January', 'aui' ),
1716
-				'month_long_2' => __( 'February', 'aui' ),
1717
-				'month_long_3' => __( 'March', 'aui' ),
1718
-				'month_long_4' => __( 'April', 'aui' ),
1719
-				'month_long_5' => __( 'May', 'aui' ),
1720
-				'month_long_6' => __( 'June', 'aui' ),
1721
-				'month_long_7' => __( 'July', 'aui' ),
1722
-				'month_long_8' => __( 'August', 'aui' ),
1723
-				'month_long_9' => __( 'September', 'aui' ),
1724
-				'month_long_10' => __( 'October', 'aui' ),
1725
-				'month_long_11' => __( 'November', 'aui' ),
1726
-				'month_long_12' => __( 'December', 'aui' ),
1727
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
1728
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
1729
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
1730
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
1731
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
1732
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
1733
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
1734
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
1735
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
1736
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
1737
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
1738
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
1739
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
1740
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
1741
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
1742
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
1743
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
1744
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
1745
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
1746
-				'day_s2_1' => __( 'Su', 'aui' ),
1747
-				'day_s2_2' => __( 'Mo', 'aui' ),
1748
-				'day_s2_3' => __( 'Tu', 'aui' ),
1749
-				'day_s2_4' => __( 'We', 'aui' ),
1750
-				'day_s2_5' => __( 'Th', 'aui' ),
1751
-				'day_s2_6' => __( 'Fr', 'aui' ),
1752
-				'day_s2_7' => __( 'Sa', 'aui' ),
1753
-				'day_s3_1' => __( 'Sun', 'aui' ),
1754
-				'day_s3_2' => __( 'Mon', 'aui' ),
1755
-				'day_s3_3' => __( 'Tue', 'aui' ),
1756
-				'day_s3_4' => __( 'Wed', 'aui' ),
1757
-				'day_s3_5' => __( 'Thu', 'aui' ),
1758
-				'day_s3_6' => __( 'Fri', 'aui' ),
1759
-				'day_s3_7' => __( 'Sat', 'aui' ),
1760
-				'day_s5_1' => __( 'Sunday', 'aui' ),
1761
-				'day_s5_2' => __( 'Monday', 'aui' ),
1762
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
1763
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
1764
-				'day_s5_5' => __( 'Thursday', 'aui' ),
1765
-				'day_s5_6' => __( 'Friday', 'aui' ),
1766
-				'day_s5_7' => __( 'Saturday', 'aui' ),
1767
-				'am_lower' => __( 'am', 'aui' ),
1768
-				'pm_lower' => __( 'pm', 'aui' ),
1769
-				'am_upper' => __( 'AM', 'aui' ),
1770
-				'pm_upper' => __( 'PM', 'aui' ),
1771
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
1715
+				'month_long_1' => __('January', 'aui'),
1716
+				'month_long_2' => __('February', 'aui'),
1717
+				'month_long_3' => __('March', 'aui'),
1718
+				'month_long_4' => __('April', 'aui'),
1719
+				'month_long_5' => __('May', 'aui'),
1720
+				'month_long_6' => __('June', 'aui'),
1721
+				'month_long_7' => __('July', 'aui'),
1722
+				'month_long_8' => __('August', 'aui'),
1723
+				'month_long_9' => __('September', 'aui'),
1724
+				'month_long_10' => __('October', 'aui'),
1725
+				'month_long_11' => __('November', 'aui'),
1726
+				'month_long_12' => __('December', 'aui'),
1727
+				'month_s_1' => _x('Jan', 'January abbreviation', 'aui'),
1728
+				'month_s_2' => _x('Feb', 'February abbreviation', 'aui'),
1729
+				'month_s_3' => _x('Mar', 'March abbreviation', 'aui'),
1730
+				'month_s_4' => _x('Apr', 'April abbreviation', 'aui'),
1731
+				'month_s_5' => _x('May', 'May abbreviation', 'aui'),
1732
+				'month_s_6' => _x('Jun', 'June abbreviation', 'aui'),
1733
+				'month_s_7' => _x('Jul', 'July abbreviation', 'aui'),
1734
+				'month_s_8' => _x('Aug', 'August abbreviation', 'aui'),
1735
+				'month_s_9' => _x('Sep', 'September abbreviation', 'aui'),
1736
+				'month_s_10' => _x('Oct', 'October abbreviation', 'aui'),
1737
+				'month_s_11' => _x('Nov', 'November abbreviation', 'aui'),
1738
+				'month_s_12' => _x('Dec', 'December abbreviation', 'aui'),
1739
+				'day_s1_1' => _x('S', 'Sunday initial', 'aui'),
1740
+				'day_s1_2' => _x('M', 'Monday initial', 'aui'),
1741
+				'day_s1_3' => _x('T', 'Tuesday initial', 'aui'),
1742
+				'day_s1_4' => _x('W', 'Wednesday initial', 'aui'),
1743
+				'day_s1_5' => _x('T', 'Friday initial', 'aui'),
1744
+				'day_s1_6' => _x('F', 'Thursday initial', 'aui'),
1745
+				'day_s1_7' => _x('S', 'Saturday initial', 'aui'),
1746
+				'day_s2_1' => __('Su', 'aui'),
1747
+				'day_s2_2' => __('Mo', 'aui'),
1748
+				'day_s2_3' => __('Tu', 'aui'),
1749
+				'day_s2_4' => __('We', 'aui'),
1750
+				'day_s2_5' => __('Th', 'aui'),
1751
+				'day_s2_6' => __('Fr', 'aui'),
1752
+				'day_s2_7' => __('Sa', 'aui'),
1753
+				'day_s3_1' => __('Sun', 'aui'),
1754
+				'day_s3_2' => __('Mon', 'aui'),
1755
+				'day_s3_3' => __('Tue', 'aui'),
1756
+				'day_s3_4' => __('Wed', 'aui'),
1757
+				'day_s3_5' => __('Thu', 'aui'),
1758
+				'day_s3_6' => __('Fri', 'aui'),
1759
+				'day_s3_7' => __('Sat', 'aui'),
1760
+				'day_s5_1' => __('Sunday', 'aui'),
1761
+				'day_s5_2' => __('Monday', 'aui'),
1762
+				'day_s5_3' => __('Tuesday', 'aui'),
1763
+				'day_s5_4' => __('Wednesday', 'aui'),
1764
+				'day_s5_5' => __('Thursday', 'aui'),
1765
+				'day_s5_6' => __('Friday', 'aui'),
1766
+				'day_s5_7' => __('Saturday', 'aui'),
1767
+				'am_lower' => __('am', 'aui'),
1768
+				'pm_lower' => __('pm', 'aui'),
1769
+				'am_upper' => __('AM', 'aui'),
1770
+				'pm_upper' => __('PM', 'aui'),
1771
+				'firstDayOfWeek' => (int) get_option('start_of_week'),
1772 1772
 				'time_24hr' => false,
1773
-				'year' => __( 'Year', 'aui' ),
1774
-				'hour' => __( 'Hour', 'aui' ),
1775
-				'minute' => __( 'Minute', 'aui' ),
1776
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
1777
-				'rangeSeparator' => __( ' to ', 'aui' ),
1778
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
1779
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
1773
+				'year' => __('Year', 'aui'),
1774
+				'hour' => __('Hour', 'aui'),
1775
+				'minute' => __('Minute', 'aui'),
1776
+				'weekAbbreviation' => __('Wk', 'aui'),
1777
+				'rangeSeparator' => __(' to ', 'aui'),
1778
+				'scrollTitle' => __('Scroll to increment', 'aui'),
1779
+				'toggleTitle' => __('Click to toggle', 'aui')
1780 1780
 			);
1781 1781
 
1782
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
1782
+			return apply_filters('ayecode_ui_calendar_params', $params);
1783 1783
 		}
1784 1784
 
1785 1785
 		/**
@@ -1792,47 +1792,47 @@  discard block
 block discarded – undo
1792 1792
 		public static function flatpickr_locale() {
1793 1793
 			$params = self::calendar_params();
1794 1794
 
1795
-			if ( is_string( $params ) ) {
1796
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
1795
+			if (is_string($params)) {
1796
+				$params = html_entity_decode($params, ENT_QUOTES, 'UTF-8');
1797 1797
 			} else {
1798
-				foreach ( (array) $params as $key => $value ) {
1799
-					if ( ! is_scalar( $value ) ) {
1798
+				foreach ((array) $params as $key => $value) {
1799
+					if (!is_scalar($value)) {
1800 1800
 						continue;
1801 1801
 					}
1802 1802
 
1803
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1803
+					$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1804 1804
 				}
1805 1805
 			}
1806 1806
 
1807 1807
 			$day_s3 = array();
1808 1808
 			$day_s5 = array();
1809 1809
 
1810
-			for ( $i = 1; $i <= 7; $i ++ ) {
1811
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
1812
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
1810
+			for ($i = 1; $i <= 7; $i++) {
1811
+				$day_s3[] = addslashes($params['day_s3_' . $i]);
1812
+				$day_s5[] = addslashes($params['day_s3_' . $i]);
1813 1813
 			}
1814 1814
 
1815 1815
 			$month_s = array();
1816 1816
 			$month_long = array();
1817 1817
 
1818
-			for ( $i = 1; $i <= 12; $i ++ ) {
1819
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
1820
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
1818
+			for ($i = 1; $i <= 12; $i++) {
1819
+				$month_s[] = addslashes($params['month_s_' . $i]);
1820
+				$month_long[] = addslashes($params['month_long_' . $i]);
1821 1821
 			}
1822 1822
 
1823 1823
 ob_start();
1824
-if ( 0 ) { ?><script><?php } ?>
1824
+if (0) { ?><script><?php } ?>
1825 1825
 {
1826 1826
 	weekdays: {
1827
-		shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
1828
-		longhand: ['<?php echo implode( "','", $day_s5 ); ?>'],
1827
+		shorthand: ['<?php echo implode("','", $day_s3); ?>'],
1828
+		longhand: ['<?php echo implode("','", $day_s5); ?>'],
1829 1829
 	},
1830 1830
 	months: {
1831
-		shorthand: ['<?php echo implode( "','", $month_s ); ?>'],
1832
-		longhand: ['<?php echo implode( "','", $month_long ); ?>'],
1831
+		shorthand: ['<?php echo implode("','", $month_s); ?>'],
1832
+		longhand: ['<?php echo implode("','", $month_long); ?>'],
1833 1833
 	},
1834 1834
 	daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31],
1835
-	firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>,
1835
+	firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>,
1836 1836
 	ordinal: function (nth) {
1837 1837
 		var s = nth % 100;
1838 1838
 		if (s > 3 && s < 21)
@@ -1848,21 +1848,21 @@  discard block
 block discarded – undo
1848 1848
 				return "th";
1849 1849
 		}
1850 1850
 	},
1851
-	rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>',
1852
-	weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>',
1853
-	scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>',
1854
-	toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>',
1855
-	amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'],
1856
-	yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>',
1857
-	hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>',
1858
-	minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>',
1859
-	time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?>
1851
+	rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>',
1852
+	weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>',
1853
+	scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>',
1854
+	toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>',
1855
+	amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'],
1856
+	yearAriaLabel: '<?php echo addslashes($params['year']); ?>',
1857
+	hourAriaLabel: '<?php echo addslashes($params['hour']); ?>',
1858
+	minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>',
1859
+	time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?>
1860 1860
 }
1861
-<?php if ( 0 ) { ?></script><?php } ?>
1861
+<?php if (0) { ?></script><?php } ?>
1862 1862
 <?php
1863 1863
 			$locale = ob_get_clean();
1864 1864
 
1865
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
1865
+			return apply_filters('ayecode_ui_flatpickr_locale', trim($locale));
1866 1866
 		}
1867 1867
 
1868 1868
 		/**
@@ -1874,20 +1874,20 @@  discard block
 block discarded – undo
1874 1874
 		 */
1875 1875
 		public static function select2_params() {
1876 1876
 			$params = array(
1877
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
1878
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
1879
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
1880
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
1881
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
1882
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
1883
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
1884
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
1885
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
1886
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
1887
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
1877
+				'i18n_select_state_text'    => esc_attr__('Select an option&hellip;', 'aui'),
1878
+				'i18n_no_matches'           => _x('No matches found', 'enhanced select', 'aui'),
1879
+				'i18n_ajax_error'           => _x('Loading failed', 'enhanced select', 'aui'),
1880
+				'i18n_input_too_short_1'    => _x('Please enter 1 or more characters', 'enhanced select', 'aui'),
1881
+				'i18n_input_too_short_n'    => _x('Please enter %item% or more characters', 'enhanced select', 'aui'),
1882
+				'i18n_input_too_long_1'     => _x('Please delete 1 character', 'enhanced select', 'aui'),
1883
+				'i18n_input_too_long_n'     => _x('Please delete %item% characters', 'enhanced select', 'aui'),
1884
+				'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'aui'),
1885
+				'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'aui'),
1886
+				'i18n_load_more'            => _x('Loading more results&hellip;', 'enhanced select', 'aui'),
1887
+				'i18n_searching'            => _x('Searching&hellip;', 'enhanced select', 'aui')
1888 1888
 			);
1889 1889
 
1890
-			return apply_filters( 'ayecode_ui_select2_params', $params );
1890
+			return apply_filters('ayecode_ui_select2_params', $params);
1891 1891
 		}
1892 1892
 
1893 1893
 		/**
@@ -1900,17 +1900,17 @@  discard block
 block discarded – undo
1900 1900
 		public static function select2_locale() {
1901 1901
 			$params = self::select2_params();
1902 1902
 
1903
-			foreach ( (array) $params as $key => $value ) {
1904
-				if ( ! is_scalar( $value ) ) {
1903
+			foreach ((array) $params as $key => $value) {
1904
+				if (!is_scalar($value)) {
1905 1905
 					continue;
1906 1906
 				}
1907 1907
 
1908
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
1908
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1909 1909
 			}
1910 1910
 
1911
-			$locale = json_encode( $params );
1911
+			$locale = json_encode($params);
1912 1912
 
1913
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
1913
+			return apply_filters('ayecode_ui_select2_locale', trim($locale));
1914 1914
 		}
1915 1915
 	}
1916 1916
 
Please login to merge, or discard this patch.