Passed
Push — master ( bcec86...578d12 )
by Brian
10:46
created
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-details.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Invoice_Details {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the invoice.
Please login to merge, or discard this patch.
includes/wpinv-user-functions.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
161 161
 
162
-	if ( current_user_can( 'manage_options' ) ) {
163
-		return 'manage_options';
164
-	};
162
+    if ( current_user_can( 'manage_options' ) ) {
163
+        return 'manage_options';
164
+    };
165 165
 
166
-	return $capalibilty;
166
+    return $capalibilty;
167 167
 }
168 168
 
169 169
 /**
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 function wpinv_create_user( $email ) {
186 186
 
187 187
     // Prepare user values.
188
-	$args = array(
189
-		'user_login' => wpinv_generate_user_name( $email ),
190
-		'user_pass'  => wp_generate_password(),
191
-		'user_email' => $email,
188
+    $args = array(
189
+        'user_login' => wpinv_generate_user_name( $email ),
190
+        'user_pass'  => wp_generate_password(),
191
+        'user_email' => $email,
192 192
         'role'       => 'subscriber',
193 193
     );
194 194
 
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 function wpinv_generate_user_name( $prefix = '' ) {
206 206
 
207 207
     // If prefix is an email, retrieve the part before the email.
208
-	$prefix = strtok( $prefix, '@' );
208
+    $prefix = strtok( $prefix, '@' );
209 209
 
210
-	// Trim to 4 characters max.
211
-	$prefix = sanitize_user( $prefix );
210
+    // Trim to 4 characters max.
211
+    $prefix = sanitize_user( $prefix );
212 212
 
213
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
215
-		$prefix = 'gtp';
216
-	}
213
+    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
+    if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
215
+        $prefix = 'gtp';
216
+    }
217 217
 
218
-	$username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
-	if ( username_exists( $username ) ) {
220
-		return wpinv_generate_user_name( $username );
221
-	}
218
+    $username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
+    if ( username_exists( $username ) ) {
220
+        return wpinv_generate_user_name( $username );
221
+    }
222 222
 
223 223
     return $username;
224 224
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-resend-invoice.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit; // Exit if accessed directly
9
+    exit; // Exit if accessed directly
10 10
 }
11 11
 
12 12
 /**
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 class GetPaid_Meta_Box_Resend_Invoice {
16 16
 
17 17
     /**
18
-	 * Output the metabox.
19
-	 *
20
-	 * @param WP_Post $post
21
-	 */
18
+     * Output the metabox.
19
+     *
20
+     * @param WP_Post $post
21
+     */
22 22
     public static function output( $post ) {
23 23
 
24 24
         // Fetch the invoice.
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-item-details.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Item_Details {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the item.
@@ -289,35 +289,35 @@  discard block
 block discarded – undo
289 289
     }
290 290
 
291 291
     /**
292
-	 * Save meta box data.
293
-	 *
294
-	 * @param int $post_id
295
-	 */
296
-	public static function save( $post_id ) {
292
+     * Save meta box data.
293
+     *
294
+     * @param int $post_id
295
+     */
296
+    public static function save( $post_id ) {
297 297
 
298 298
         // Prepare the item.
299 299
         $item = new WPInv_Item( $post_id );
300 300
 
301 301
         // Load new data.
302 302
         $item->set_props(
303
-			array(
304
-				'price'                => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null,
305
-				'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
306
-				'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
307
-				'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
308
-				'is_dynamic_pricing'   => isset( $_POST['wpinv_name_your_price'] ),
303
+            array(
304
+                'price'                => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null,
305
+                'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
306
+                'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
307
+                'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
308
+                'is_dynamic_pricing'   => isset( $_POST['wpinv_name_your_price'] ),
309 309
                 'minimum_price'        => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null,
310
-				'is_recurring'         => isset( $_POST['wpinv_is_recurring'] ),
311
-				'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
312
-				'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
-				'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
-				'is_free_trial'        => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
315
-				'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
316
-				'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
317
-			)
310
+                'is_recurring'         => isset( $_POST['wpinv_is_recurring'] ),
311
+                'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
312
+                'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
+                'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
+                'is_free_trial'        => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
315
+                'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
316
+                'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
317
+            )
318 318
         );
319 319
 
320
-		$item->save();
321
-		do_action( 'getpaid_item_metabox_save', $post_id, $item );
322
-	}
320
+        $item->save();
321
+        do_action( 'getpaid_item_metabox_save', $post_id, $item );
322
+    }
323 323
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-address.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Invoice_Address {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the invoice.
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
     }
301 301
 
302 302
     /**
303
-	 * Save meta box data.
304
-	 *
305
-	 * @param int $post_id
306
-	 */
307
-	public static function save( $post_id ) {
303
+     * Save meta box data.
304
+     *
305
+     * @param int $post_id
306
+     */
307
+    public static function save( $post_id ) {
308 308
 
309 309
         // Prepare the invoice.
310 310
         $invoice = new WPInv_Invoice( $post_id );
311 311
 
312 312
         // Load new data.
313 313
         $invoice->set_props(
314
-			array(
314
+            array(
315 315
                 'template'             => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
316 316
                 'email_cc'             => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
317 317
                 'disable_taxes'        => isset( $_POST['disable_taxes'] ),
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 'due_date'             => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
333 333
                 'number'               => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
334 334
                 'status'               => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
335
-			)
335
+            )
336 336
         );
337 337
 
338 338
         // Recalculate totals.
@@ -362,6 +362,6 @@  discard block
 block discarded – undo
362 362
         }
363 363
 
364 364
         // Fires after an invoice is saved.
365
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
366
-	}
365
+        do_action( 'wpinv_invoice_metabox_saved', $invoice );
366
+    }
367 367
 }
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -56,69 +56,69 @@
 block discarded – undo
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	global $wpinv_options, $pagenow, $post;
59
+    global $wpinv_options, $pagenow, $post;
60 60
 
61
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
-	}
61
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
+    }
64 64
 
65
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
-	}
65
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
+    }
68 68
 
69
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
-	}
69
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
+    }
72 72
 
73
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
-	}
73
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
+    }
76 76
 
77
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
-	}
77
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
+    }
80 80
 
81
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
-	}
81
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
+        add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
+    }
84 84
 
85
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
-	}
85
+    if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
+    }
88 88
 
89
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
89
+    if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
+        add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
91 91
     }
92 92
     
93 93
     if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
94
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
94
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
95 95
     }
96 96
 
97 97
     if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
98 98
         add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
99 99
     }
100 100
 
101
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
-	}
101
+    if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
+        add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
+    }
104 104
 
105
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
-	}
105
+    if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
+        add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
+    }
108 108
 
109
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
-	}
109
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
+        add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
+    }
112 112
     
113
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
113
+    if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
+        $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
115 115
 
116
-		if ( !empty( $message ) ) {
117
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
-		}
119
-	}
116
+        if ( !empty( $message ) ) {
117
+            add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
+        }
119
+    }
120 120
 
121
-	settings_errors( 'wpinv-notices' );
121
+    settings_errors( 'wpinv-notices' );
122 122
 }
123 123
 add_action( 'admin_notices', 'wpinv_admin_messages' );
124 124
 
Please login to merge, or discard this patch.
widgets/checkout.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,17 +45,17 @@
 block discarded – undo
45 45
         parent::__construct( $options );
46 46
     }
47 47
 
48
-	/**
49
-	 * The Super block output function.
50
-	 *
51
-	 * @param array $args
52
-	 * @param array $widget_args
53
-	 * @param string $content
54
-	 *
55
-	 * @return mixed|string|bool
56
-	 */
48
+    /**
49
+     * The Super block output function.
50
+     *
51
+     * @param array $args
52
+     * @param array $widget_args
53
+     * @param string $content
54
+     *
55
+     * @return mixed|string|bool
56
+     */
57 57
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
58
-	    return wpinv_checkout_form();
58
+        return wpinv_checkout_form();
59 59
     }
60 60
 
61 61
 }
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-button.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,143 +11,143 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Button {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'a', // a, button, badge
24
-			'href'       => '#',
25
-			'new_window' => false,
26
-			'class'      => 'btn btn-primary',
27
-			'id'         => '',
28
-			'title'      => '',
29
-			'value'      => '',
30
-			'content'    => '',
31
-			'icon'       => '',
32
-			'hover_content' => '',
33
-			'hover_icon'    => '',
34
-			'new_line_after' => true,
35
-			'no_wrap'    => true,
36
-			'onclick'    => '',
37
-			'style'  => '',
38
-			'extra_attributes'  => array(), // an array of extra attributes
39
-			'icon_extra_attributes'  => array() // an array of icon extra attributes
40
-		);
41
-
42
-		/**
43
-		 * Parse incoming $args into an array and merge it with $defaults
44
-		 */
45
-		$args   = wp_parse_args( $args, $defaults );
46
-		$output = '';
47
-		if ( ! empty( $args['type'] ) ) {
48
-			$type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
49
-
50
-			// open/type
51
-			if($type=='a'){
52
-				$new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
53
-				$output .= '<a href="' . $args['href'] . '"'.$new_window;
54
-			}elseif($type=='badge'){
55
-				$output .= '<span ';
56
-			}else{
57
-				$output .= '<button type="' . $type . '" ';
58
-			}
59
-
60
-			// name
61
-			if(!empty($args['name'])){
62
-				$output .= AUI_Component_Helper::name($args['name']);
63
-			}
64
-
65
-			// id
66
-			if(!empty($args['id'])){
67
-				$output .= AUI_Component_Helper::id($args['id']);
68
-			}
69
-
70
-			// title
71
-			if(!empty($args['title'])){
72
-				$output .= AUI_Component_Helper::title($args['title']);
73
-			}
74
-
75
-			// value
76
-			if(!empty($args['value'])){
77
-				$output .= AUI_Component_Helper::value($args['value']);
78
-			}
79
-
80
-			// class
81
-			$class = !empty($args['class']) ? $args['class'] : '';
82
-			$output .= AUI_Component_Helper::class_attr($class);
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function get($args = array()){
22
+        $defaults = array(
23
+            'type'       => 'a', // a, button, badge
24
+            'href'       => '#',
25
+            'new_window' => false,
26
+            'class'      => 'btn btn-primary',
27
+            'id'         => '',
28
+            'title'      => '',
29
+            'value'      => '',
30
+            'content'    => '',
31
+            'icon'       => '',
32
+            'hover_content' => '',
33
+            'hover_icon'    => '',
34
+            'new_line_after' => true,
35
+            'no_wrap'    => true,
36
+            'onclick'    => '',
37
+            'style'  => '',
38
+            'extra_attributes'  => array(), // an array of extra attributes
39
+            'icon_extra_attributes'  => array() // an array of icon extra attributes
40
+        );
41
+
42
+        /**
43
+         * Parse incoming $args into an array and merge it with $defaults
44
+         */
45
+        $args   = wp_parse_args( $args, $defaults );
46
+        $output = '';
47
+        if ( ! empty( $args['type'] ) ) {
48
+            $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
49
+
50
+            // open/type
51
+            if($type=='a'){
52
+                $new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
53
+                $output .= '<a href="' . $args['href'] . '"'.$new_window;
54
+            }elseif($type=='badge'){
55
+                $output .= '<span ';
56
+            }else{
57
+                $output .= '<button type="' . $type . '" ';
58
+            }
59
+
60
+            // name
61
+            if(!empty($args['name'])){
62
+                $output .= AUI_Component_Helper::name($args['name']);
63
+            }
64
+
65
+            // id
66
+            if(!empty($args['id'])){
67
+                $output .= AUI_Component_Helper::id($args['id']);
68
+            }
69
+
70
+            // title
71
+            if(!empty($args['title'])){
72
+                $output .= AUI_Component_Helper::title($args['title']);
73
+            }
74
+
75
+            // value
76
+            if(!empty($args['value'])){
77
+                $output .= AUI_Component_Helper::value($args['value']);
78
+            }
79
+
80
+            // class
81
+            $class = !empty($args['class']) ? $args['class'] : '';
82
+            $output .= AUI_Component_Helper::class_attr($class);
83 83
 			
84
-			// data-attributes
85
-			$output .= AUI_Component_Helper::data_attributes($args);
84
+            // data-attributes
85
+            $output .= AUI_Component_Helper::data_attributes($args);
86 86
 
87
-			// aria-attributes
88
-			$output .= AUI_Component_Helper::aria_attributes($args);
87
+            // aria-attributes
88
+            $output .= AUI_Component_Helper::aria_attributes($args);
89 89
 
90
-			// extra attributes
91
-			if(!empty($args['extra_attributes'])){
92
-				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
93
-			}
90
+            // extra attributes
91
+            if(!empty($args['extra_attributes'])){
92
+                $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
93
+            }
94 94
 
95
-			// onclick, we don't escape this
96
-			if(!empty($args['onclick'])){
97
-				$output .= ' onclick="'.$args['onclick'].'" ';
98
-			}
95
+            // onclick, we don't escape this
96
+            if(!empty($args['onclick'])){
97
+                $output .= ' onclick="'.$args['onclick'].'" ';
98
+            }
99 99
 
100
-			// style, we don't escape this
101
-			if(!empty($args['style'])){
102
-				$output .= ' style="'.$args['style'].'" ';
103
-			}
100
+            // style, we don't escape this
101
+            if(!empty($args['style'])){
102
+                $output .= ' style="'.$args['style'].'" ';
103
+            }
104 104
 
105
-			// close opening tag
106
-			$output .= ' >';
105
+            // close opening tag
106
+            $output .= ' >';
107 107
 
108 108
 
109
-			// hover content
110
-			$hover_content = false;
111
-			if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
112
-				$output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
113
-				$hover_content = true;
114
-			}
109
+            // hover content
110
+            $hover_content = false;
111
+            if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
112
+                $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
113
+                $hover_content = true;
114
+            }
115 115
 			
116
-			// content
117
-			if($hover_content){$output .= "<span class='hover-content-original'>";}
118
-			if(!empty($args['content']) || !empty($args['icon'])){
119
-				$output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content'];
120
-			}
121
-			if($hover_content){$output .= "</span>";}
116
+            // content
117
+            if($hover_content){$output .= "<span class='hover-content-original'>";}
118
+            if(!empty($args['content']) || !empty($args['icon'])){
119
+                $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content'];
120
+            }
121
+            if($hover_content){$output .= "</span>";}
122 122
 					
123 123
 
124 124
 
125
-			// close
126
-			if($type=='a'){
127
-				$output .= '</a>';
128
-			}elseif($type=='badge'){
129
-				$output .= '</span>';
130
-			}else{
131
-				$output .= '</button>';
132
-			}
125
+            // close
126
+            if($type=='a'){
127
+                $output .= '</a>';
128
+            }elseif($type=='badge'){
129
+                $output .= '</span>';
130
+            }else{
131
+                $output .= '</button>';
132
+            }
133 133
 
134
-			// maybe new line after?  This adds better spacing between buttons.
135
-			if(!empty($args['new_line_after'])){
136
-				$output .= PHP_EOL;
137
-			}
134
+            // maybe new line after?  This adds better spacing between buttons.
135
+            if(!empty($args['new_line_after'])){
136
+                $output .= PHP_EOL;
137
+            }
138 138
 
139 139
 
140
-			// wrap
141
-			if(!$args['no_wrap']){
142
-				$output = AUI_Component_Input::wrap(array(
143
-					'content' => $output,
144
-				));
145
-			}
140
+            // wrap
141
+            if(!$args['no_wrap']){
142
+                $output = AUI_Component_Input::wrap(array(
143
+                    'content' => $output,
144
+                ));
145
+            }
146 146
 
147 147
 
148
-		}
148
+        }
149 149
 
150
-		return $output;
151
-	}
150
+        return $output;
151
+    }
152 152
 
153 153
 }
154 154
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Indentation   +837 added lines, -837 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,187 +21,187 @@  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 = '1.0.1';
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.3.1";
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
-				self::$instance = new AyeCode_UI_Settings;
103
-
104
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
-
106
-				if ( is_admin() ) {
107
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
108
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
109
-
110
-					// Maybe show example page
111
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
-				}
113
-
114
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
-
116
-				do_action( 'ayecode_ui_settings_loaded' );
117
-			}
118
-
119
-			return self::$instance;
120
-		}
121
-
122
-		/**
123
-		 * Initiate the settings and add the required action hooks.
124
-		 */
125
-		public function init() {
126
-			$this->settings = $this->get_settings();
127
-			$this->url = $this->get_url();
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 = '1.0.1';
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.3.1";
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
+                self::$instance = new AyeCode_UI_Settings;
103
+
104
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+
106
+                if ( is_admin() ) {
107
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
108
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
109
+
110
+                    // Maybe show example page
111
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+                }
128 113
 
129
-			/**
130
-			 * Maybe load CSS
131
-			 *
132
-			 * We load super early in case there is a theme version that might change the colors
133
-			 */
134
-			if ( $this->settings['css'] ) {
135
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
136
-			}
137
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
138
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
139
-			}
140
-
141
-			// maybe load JS
142
-			if ( $this->settings['js'] ) {
143
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
144
-			}
145
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
146
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
147
-			}
148
-
149
-			// Maybe set the HTML font size
150
-			if ( $this->settings['html_font_size'] ) {
151
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
152
-			}
153
-
154
-
155
-		}
156
-
157
-		/**
158
-		 * Check if we should load the admin scripts or not.
159
-		 *
160
-		 * @return bool
161
-		 */
162
-		public function load_admin_scripts(){
163
-			$result = true;
164
-
165
-			if(!empty($this->settings['disable_admin'])){
166
-				$url_parts = explode("\n",$this->settings['disable_admin']);
167
-				foreach($url_parts as $part){
168
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
169
-						return false; // return early, no point checking further
170
-					}
171
-				}
172
-			}
114
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+
116
+                do_action( 'ayecode_ui_settings_loaded' );
117
+            }
118
+
119
+            return self::$instance;
120
+        }
121
+
122
+        /**
123
+         * Initiate the settings and add the required action hooks.
124
+         */
125
+        public function init() {
126
+            $this->settings = $this->get_settings();
127
+            $this->url = $this->get_url();
128
+
129
+            /**
130
+             * Maybe load CSS
131
+             *
132
+             * We load super early in case there is a theme version that might change the colors
133
+             */
134
+            if ( $this->settings['css'] ) {
135
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
136
+            }
137
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
138
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
139
+            }
140
+
141
+            // maybe load JS
142
+            if ( $this->settings['js'] ) {
143
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
144
+            }
145
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
146
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
147
+            }
148
+
149
+            // Maybe set the HTML font size
150
+            if ( $this->settings['html_font_size'] ) {
151
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
152
+            }
153
+
154
+
155
+        }
156
+
157
+        /**
158
+         * Check if we should load the admin scripts or not.
159
+         *
160
+         * @return bool
161
+         */
162
+        public function load_admin_scripts(){
163
+            $result = true;
164
+
165
+            if(!empty($this->settings['disable_admin'])){
166
+                $url_parts = explode("\n",$this->settings['disable_admin']);
167
+                foreach($url_parts as $part){
168
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
169
+                        return false; // return early, no point checking further
170
+                    }
171
+                }
172
+            }
173 173
 
174
-			return $result;
175
-		}
174
+            return $result;
175
+        }
176 176
 
177
-		/**
178
-		 * Add a html font size to the footer.
179
-		 */
180
-		public function html_font_size(){
181
-			$this->settings = $this->get_settings();
182
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
183
-		}
177
+        /**
178
+         * Add a html font size to the footer.
179
+         */
180
+        public function html_font_size(){
181
+            $this->settings = $this->get_settings();
182
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
183
+        }
184 184
 
185
-		/**
186
-		 * Adds the Font Awesome styles.
187
-		 */
188
-		public function enqueue_style() {
185
+        /**
186
+         * Adds the Font Awesome styles.
187
+         */
188
+        public function enqueue_style() {
189 189
 
190
-			$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
190
+            $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
191 191
 
192
-			if($this->settings[$css_setting]){
193
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
194
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
195
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
196
-				wp_enqueue_style( 'ayecode-ui' );
192
+            if($this->settings[$css_setting]){
193
+                $compatibility = $this->settings[$css_setting]=='core' ? false : true;
194
+                $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
195
+                wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
196
+                wp_enqueue_style( 'ayecode-ui' );
197 197
 
198
-				// flatpickr
199
-				wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
198
+                // flatpickr
199
+                wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
200 200
 
201 201
 
202
-				// fix some wp-admin issues
203
-				if(is_admin()){
204
-					$custom_css = "
202
+                // fix some wp-admin issues
203
+                if(is_admin()){
204
+                    $custom_css = "
205 205
                 body{
206 206
                     background-color: #f1f1f1;
207 207
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -237,29 +237,29 @@  discard block
 block discarded – undo
237 237
 				}
238 238
                 ";
239 239
 
240
-					// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
241
-					$custom_css .= "
240
+                    // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
241
+                    $custom_css .= "
242 242
 						.edit-post-sidebar input[type=color].components-text-control__input{
243 243
 						    padding: 0;
244 244
 						}
245 245
 					";
246
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
247
-				}
246
+                    wp_add_inline_style( 'ayecode-ui', $custom_css );
247
+                }
248 248
 
249
-				// custom changes
250
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
249
+                // custom changes
250
+                wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
251 251
 
252
-			}
253
-		}
252
+            }
253
+        }
254 254
 
255
-		/**
256
-		 * Get inline script used if bootstrap enqueued
257
-		 *
258
-		 * If this remains small then its best to use this than to add another JS file.
259
-		 */
260
-		public function inline_script(){
261
-			ob_start();
262
-			?>
255
+        /**
256
+         * Get inline script used if bootstrap enqueued
257
+         *
258
+         * If this remains small then its best to use this than to add another JS file.
259
+         */
260
+        public function inline_script(){
261
+            ob_start();
262
+            ?>
263 263
 			<script>
264 264
 
265 265
 				/**
@@ -478,25 +478,25 @@  discard block
 block discarded – undo
478 478
 				});
479 479
 			</script>
480 480
 			<?php
481
-			$output = ob_get_clean();
481
+            $output = ob_get_clean();
482 482
 
483
-			/*
483
+            /*
484 484
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
485 485
 			 */
486
-			return str_replace( array(
487
-				'<script>',
488
-				'</script>'
489
-			), '', $output );
490
-		}
491
-
492
-		/**
493
-		 * Get inline script used if bootstrap file browser enqueued.
494
-		 *
495
-		 * If this remains small then its best to use this than to add another JS file.
496
-		 */
497
-		public function inline_script_file_browser(){
498
-			ob_start();
499
-			?>
486
+            return str_replace( array(
487
+                '<script>',
488
+                '</script>'
489
+            ), '', $output );
490
+        }
491
+
492
+        /**
493
+         * Get inline script used if bootstrap file browser enqueued.
494
+         *
495
+         * If this remains small then its best to use this than to add another JS file.
496
+         */
497
+        public function inline_script_file_browser(){
498
+            ob_start();
499
+            ?>
500 500
 			<script>
501 501
 				// run on doc ready
502 502
 				jQuery(document).ready(function () {
@@ -504,184 +504,184 @@  discard block
 block discarded – undo
504 504
 				});
505 505
 			</script>
506 506
 			<?php
507
-			$output = ob_get_clean();
507
+            $output = ob_get_clean();
508 508
 
509
-			/*
509
+            /*
510 510
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
511 511
 			 */
512
-			return str_replace( array(
513
-				'<script>',
514
-				'</script>'
515
-			), '', $output );
516
-		}
517
-
518
-		/**
519
-		 * Adds the Font Awesome JS.
520
-		 */
521
-		public function enqueue_scripts() {
522
-
523
-			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
524
-
525
-			// select2
526
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
527
-
528
-			// flatpickr
529
-			wp_register_script( 'flatpickr', $this->url.'assets/js/flatpickr.min.js', array(), $this->latest );
530
-
531
-			// Bootstrap file browser
532
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
533
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
534
-
535
-			$load_inline = false;
536
-
537
-			if($this->settings[$js_setting]=='core-popper'){
538
-				// Bootstrap bundle
539
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
540
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
541
-				// if in admin then add to footer for compatibility.
542
-				is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle');
543
-				$script = $this->inline_script();
544
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
545
-			}elseif($this->settings[$js_setting]=='popper'){
546
-				$url = $this->url.'assets/js/popper.min.js';
547
-				wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
548
-				wp_enqueue_script( 'bootstrap-js-popper' );
549
-				$load_inline = true;
550
-			}else{
551
-				$load_inline = true;
552
-			}
553
-
554
-			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
555
-			if($load_inline){
556
-				wp_register_script( 'bootstrap-dummy', '',array('jquery') );
557
-				wp_enqueue_script( 'bootstrap-dummy' );
558
-				$script = $this->inline_script();
559
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
560
-			}
561
-
562
-		}
563
-
564
-		/**
565
-		 * Enqueue flatpickr if called.
566
-		 */
567
-		public function enqueue_flatpickr(){
568
-			wp_enqueue_style( 'flatpickr' );
569
-			wp_enqueue_script( 'flatpickr' );
570
-		}
571
-
572
-		/**
573
-		 * Get the url path to the current folder.
574
-		 *
575
-		 * @return string
576
-		 */
577
-		public function get_url() {
578
-
579
-			$url = '';
580
-			// check if we are inside a plugin
581
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
582
-
583
-			// add check in-case user has changed wp-content dir name.
584
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
585
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
586
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
587
-
588
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
589
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
590
-			}
591
-
592
-			return $url;
593
-		}
594
-
595
-		/**
596
-		 * Register the database settings with WordPress.
597
-		 */
598
-		public function register_settings() {
599
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
600
-		}
601
-
602
-		/**
603
-		 * Add the WordPress settings menu item.
604
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
605
-		 */
606
-		public function menu_item() {
607
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
608
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
609
-				$this,
610
-				'settings_page'
611
-			) );
612
-		}
613
-
614
-		/**
615
-		 * Get a list of themes and their default JS settings.
616
-		 *
617
-		 * @return array
618
-		 */
619
-		public function theme_js_settings(){
620
-			return array(
621
-				'ayetheme' => 'popper',
622
-				'listimia' => 'required',
623
-				'listimia_backend' => 'core-popper',
624
-				'avada'    => 'required',
625
-			);
626
-		}
627
-
628
-		/**
629
-		 * Get the current Font Awesome output settings.
630
-		 *
631
-		 * @return array The array of settings.
632
-		 */
633
-		public function get_settings() {
634
-
635
-			$db_settings = get_option( 'ayecode-ui-settings' );
636
-			$js_default = 'core-popper';
637
-			$js_default_backend = $js_default;
638
-
639
-			// maybe set defaults (if no settings set)
640
-			if(empty($db_settings)){
641
-				$active_theme = strtolower( get_template() ); // active parent theme.
642
-				$theme_js_settings = self::theme_js_settings();
643
-				if(isset($theme_js_settings[$active_theme])){
644
-					$js_default = $theme_js_settings[$active_theme];
645
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
646
-				}
647
-			}
648
-
649
-			$defaults = array(
650
-				'css'       => 'compatibility', // core, compatibility
651
-				'js'        => $js_default, // js to load, core-popper, popper
652
-				'html_font_size'        => '16', // js to load, core-popper, popper
653
-				'css_backend'       => 'compatibility', // core, compatibility
654
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
655
-				'disable_admin'     =>  '', // URL snippets to disable loading on admin
656
-			);
657
-
658
-			$settings = wp_parse_args( $db_settings, $defaults );
659
-
660
-			/**
661
-			 * Filter the Bootstrap settings.
662
-			 *
663
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
664
-			 */
665
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
666
-		}
667
-
668
-
669
-		/**
670
-		 * The settings page html output.
671
-		 */
672
-		public function settings_page() {
673
-			if ( ! current_user_can( 'manage_options' ) ) {
674
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
675
-			}
676
-			?>
512
+            return str_replace( array(
513
+                '<script>',
514
+                '</script>'
515
+            ), '', $output );
516
+        }
517
+
518
+        /**
519
+         * Adds the Font Awesome JS.
520
+         */
521
+        public function enqueue_scripts() {
522
+
523
+            $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
524
+
525
+            // select2
526
+            wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
527
+
528
+            // flatpickr
529
+            wp_register_script( 'flatpickr', $this->url.'assets/js/flatpickr.min.js', array(), $this->latest );
530
+
531
+            // Bootstrap file browser
532
+            wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
533
+            wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
534
+
535
+            $load_inline = false;
536
+
537
+            if($this->settings[$js_setting]=='core-popper'){
538
+                // Bootstrap bundle
539
+                $url = $this->url.'assets/js/bootstrap.bundle.min.js';
540
+                wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
541
+                // if in admin then add to footer for compatibility.
542
+                is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle');
543
+                $script = $this->inline_script();
544
+                wp_add_inline_script( 'bootstrap-js-bundle', $script );
545
+            }elseif($this->settings[$js_setting]=='popper'){
546
+                $url = $this->url.'assets/js/popper.min.js';
547
+                wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
548
+                wp_enqueue_script( 'bootstrap-js-popper' );
549
+                $load_inline = true;
550
+            }else{
551
+                $load_inline = true;
552
+            }
553
+
554
+            // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
555
+            if($load_inline){
556
+                wp_register_script( 'bootstrap-dummy', '',array('jquery') );
557
+                wp_enqueue_script( 'bootstrap-dummy' );
558
+                $script = $this->inline_script();
559
+                wp_add_inline_script( 'bootstrap-dummy', $script  );
560
+            }
561
+
562
+        }
563
+
564
+        /**
565
+         * Enqueue flatpickr if called.
566
+         */
567
+        public function enqueue_flatpickr(){
568
+            wp_enqueue_style( 'flatpickr' );
569
+            wp_enqueue_script( 'flatpickr' );
570
+        }
571
+
572
+        /**
573
+         * Get the url path to the current folder.
574
+         *
575
+         * @return string
576
+         */
577
+        public function get_url() {
578
+
579
+            $url = '';
580
+            // check if we are inside a plugin
581
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
582
+
583
+            // add check in-case user has changed wp-content dir name.
584
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
585
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
586
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
587
+
588
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
589
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
590
+            }
591
+
592
+            return $url;
593
+        }
594
+
595
+        /**
596
+         * Register the database settings with WordPress.
597
+         */
598
+        public function register_settings() {
599
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
600
+        }
601
+
602
+        /**
603
+         * Add the WordPress settings menu item.
604
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
605
+         */
606
+        public function menu_item() {
607
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
608
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
609
+                $this,
610
+                'settings_page'
611
+            ) );
612
+        }
613
+
614
+        /**
615
+         * Get a list of themes and their default JS settings.
616
+         *
617
+         * @return array
618
+         */
619
+        public function theme_js_settings(){
620
+            return array(
621
+                'ayetheme' => 'popper',
622
+                'listimia' => 'required',
623
+                'listimia_backend' => 'core-popper',
624
+                'avada'    => 'required',
625
+            );
626
+        }
627
+
628
+        /**
629
+         * Get the current Font Awesome output settings.
630
+         *
631
+         * @return array The array of settings.
632
+         */
633
+        public function get_settings() {
634
+
635
+            $db_settings = get_option( 'ayecode-ui-settings' );
636
+            $js_default = 'core-popper';
637
+            $js_default_backend = $js_default;
638
+
639
+            // maybe set defaults (if no settings set)
640
+            if(empty($db_settings)){
641
+                $active_theme = strtolower( get_template() ); // active parent theme.
642
+                $theme_js_settings = self::theme_js_settings();
643
+                if(isset($theme_js_settings[$active_theme])){
644
+                    $js_default = $theme_js_settings[$active_theme];
645
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
646
+                }
647
+            }
648
+
649
+            $defaults = array(
650
+                'css'       => 'compatibility', // core, compatibility
651
+                'js'        => $js_default, // js to load, core-popper, popper
652
+                'html_font_size'        => '16', // js to load, core-popper, popper
653
+                'css_backend'       => 'compatibility', // core, compatibility
654
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
655
+                'disable_admin'     =>  '', // URL snippets to disable loading on admin
656
+            );
657
+
658
+            $settings = wp_parse_args( $db_settings, $defaults );
659
+
660
+            /**
661
+             * Filter the Bootstrap settings.
662
+             *
663
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
664
+             */
665
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
666
+        }
667
+
668
+
669
+        /**
670
+         * The settings page html output.
671
+         */
672
+        public function settings_page() {
673
+            if ( ! current_user_can( 'manage_options' ) ) {
674
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
675
+            }
676
+            ?>
677 677
 			<div class="wrap">
678 678
 				<h1><?php echo $this->name; ?></h1>
679 679
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
680 680
 				<form method="post" action="options.php">
681 681
 					<?php
682
-					settings_fields( 'ayecode-ui-settings' );
683
-					do_settings_sections( 'ayecode-ui-settings' );
684
-					?>
682
+                    settings_fields( 'ayecode-ui-settings' );
683
+                    do_settings_sections( 'ayecode-ui-settings' );
684
+                    ?>
685 685
 
686 686
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
687 687
 					<table class="form-table wpbs-table-settings">
@@ -761,485 +761,485 @@  discard block
 block discarded – undo
761 761
 					</table>
762 762
 
763 763
 					<?php
764
-					submit_button();
765
-					?>
764
+                    submit_button();
765
+                    ?>
766 766
 				</form>
767 767
 
768 768
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
769 769
 			</div>
770 770
 
771 771
 			<?php
772
-		}
773
-
774
-		public function customizer_settings($wp_customize){
775
-			$wp_customize->add_section('aui_settings', array(
776
-				'title'    => __('AyeCode UI'),
777
-				'priority' => 120,
778
-			));
779
-
780
-			//  =============================
781
-			//  = Color Picker              =
782
-			//  =============================
783
-			$wp_customize->add_setting('aui_options[color_primary]', array(
784
-				'default'           => '#1e73be',
785
-				'sanitize_callback' => 'sanitize_hex_color',
786
-				'capability'        => 'edit_theme_options',
787
-				'type'              => 'option',
788
-				'transport'         => 'refresh',
789
-			));
790
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
791
-				'label'    => __('Primary Color'),
792
-				'section'  => 'aui_settings',
793
-				'settings' => 'aui_options[color_primary]',
794
-			)));
795
-
796
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
797
-				'default'           => '#6c757d',
798
-				'sanitize_callback' => 'sanitize_hex_color',
799
-				'capability'        => 'edit_theme_options',
800
-				'type'              => 'option',
801
-				'transport'         => 'refresh',
802
-			));
803
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
804
-				'label'    => __('Secondary Color'),
805
-				'section'  => 'aui_settings',
806
-				'settings' => 'aui_options[color_secondary]',
807
-			)));
808
-		}
809
-
810
-
811
-		public static function custom_css($compatibility = true) {
812
-			$settings = get_option('aui_options');
813
-
814
-			ob_start();
815
-			?>
772
+        }
773
+
774
+        public function customizer_settings($wp_customize){
775
+            $wp_customize->add_section('aui_settings', array(
776
+                'title'    => __('AyeCode UI'),
777
+                'priority' => 120,
778
+            ));
779
+
780
+            //  =============================
781
+            //  = Color Picker              =
782
+            //  =============================
783
+            $wp_customize->add_setting('aui_options[color_primary]', array(
784
+                'default'           => '#1e73be',
785
+                'sanitize_callback' => 'sanitize_hex_color',
786
+                'capability'        => 'edit_theme_options',
787
+                'type'              => 'option',
788
+                'transport'         => 'refresh',
789
+            ));
790
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
791
+                'label'    => __('Primary Color'),
792
+                'section'  => 'aui_settings',
793
+                'settings' => 'aui_options[color_primary]',
794
+            )));
795
+
796
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
797
+                'default'           => '#6c757d',
798
+                'sanitize_callback' => 'sanitize_hex_color',
799
+                'capability'        => 'edit_theme_options',
800
+                'type'              => 'option',
801
+                'transport'         => 'refresh',
802
+            ));
803
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
804
+                'label'    => __('Secondary Color'),
805
+                'section'  => 'aui_settings',
806
+                'settings' => 'aui_options[color_secondary]',
807
+            )));
808
+        }
809
+
810
+
811
+        public static function custom_css($compatibility = true) {
812
+            $settings = get_option('aui_options');
813
+
814
+            ob_start();
815
+            ?>
816 816
 			<style>
817 817
 				<?php
818
-					if(!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be"){
819
-						echo self::css_primary($settings['color_primary'],$compatibility);
820
-					}
818
+                    if(!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be"){
819
+                        echo self::css_primary($settings['color_primary'],$compatibility);
820
+                    }
821 821
 
822
-					if(!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d"){
823
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
824
-					}
822
+                    if(!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d"){
823
+                        echo self::css_secondary($settings['color_secondary'],$compatibility);
824
+                    }
825 825
                 ?>
826 826
 			</style>
827 827
 			<?php
828 828
 
829 829
 
830
-			/*
830
+            /*
831 831
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
832 832
 			 */
833
-			return str_replace( array(
834
-				'<style>',
835
-				'</style>'
836
-			), '', ob_get_clean());
837
-		}
838
-
839
-		public static function css_primary($color_code,$compatibility){;
840
-			$color_code = sanitize_hex_color($color_code);
841
-			if(!$color_code){return '';}
842
-			/**
843
-			 * c = color, b = background color, o = border-color, f = fill
844
-			 */
845
-			$selectors = array(
846
-				'a' => array('c'),
847
-				'.btn-primary' => array('b','o'),
848
-				'.btn-primary.disabled' => array('b','o'),
849
-				'.btn-primary:disabled' => array('b','o'),
850
-				'.btn-outline-primary' => array('c','o'),
851
-				'.btn-outline-primary:hover' => array('b','o'),
852
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
853
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
854
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
855
-				'.btn-link' => array('c'),
856
-				'.dropdown-item.active' => array('b'),
857
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
858
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
833
+            return str_replace( array(
834
+                '<style>',
835
+                '</style>'
836
+            ), '', ob_get_clean());
837
+        }
838
+
839
+        public static function css_primary($color_code,$compatibility){;
840
+            $color_code = sanitize_hex_color($color_code);
841
+            if(!$color_code){return '';}
842
+            /**
843
+             * c = color, b = background color, o = border-color, f = fill
844
+             */
845
+            $selectors = array(
846
+                'a' => array('c'),
847
+                '.btn-primary' => array('b','o'),
848
+                '.btn-primary.disabled' => array('b','o'),
849
+                '.btn-primary:disabled' => array('b','o'),
850
+                '.btn-outline-primary' => array('c','o'),
851
+                '.btn-outline-primary:hover' => array('b','o'),
852
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
853
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
854
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
855
+                '.btn-link' => array('c'),
856
+                '.dropdown-item.active' => array('b'),
857
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
858
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
859 859
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
860 860
 //				'.custom-range::-moz-range-thumb' => array('b'),
861 861
 //				'.custom-range::-ms-thumb' => array('b'),
862
-				'.nav-pills .nav-link.active' => array('b'),
863
-				'.nav-pills .show>.nav-link' => array('b'),
864
-				'.page-link' => array('c'),
865
-				'.page-item.active .page-link' => array('b','o'),
866
-				'.badge-primary' => array('b'),
867
-				'.alert-primary' => array('b','o'),
868
-				'.progress-bar' => array('b'),
869
-				'.list-group-item.active' => array('b','o'),
870
-				'.bg-primary' => array('b','f'),
871
-				'.btn-link.btn-primary' => array('c'),
872
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
873
-			);
874
-
875
-			$important_selectors = array(
876
-				'.bg-primary' => array('b','f'),
877
-				'.border-primary' => array('o'),
878
-				'.text-primary' => array('c'),
879
-			);
880
-
881
-			$color = array();
882
-			$color_i = array();
883
-			$background = array();
884
-			$background_i = array();
885
-			$border = array();
886
-			$border_i = array();
887
-			$fill = array();
888
-			$fill_i = array();
889
-
890
-			$output = '';
891
-
892
-			// build rules into each type
893
-			foreach($selectors as $selector => $types){
894
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
895
-				$types = array_combine($types,$types);
896
-				if(isset($types['c'])){$color[] = $selector;}
897
-				if(isset($types['b'])){$background[] = $selector;}
898
-				if(isset($types['o'])){$border[] = $selector;}
899
-				if(isset($types['f'])){$fill[] = $selector;}
900
-			}
901
-
902
-			// build rules into each type
903
-			foreach($important_selectors as $selector => $types){
904
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
905
-				$types = array_combine($types,$types);
906
-				if(isset($types['c'])){$color_i[] = $selector;}
907
-				if(isset($types['b'])){$background_i[] = $selector;}
908
-				if(isset($types['o'])){$border_i[] = $selector;}
909
-				if(isset($types['f'])){$fill_i[] = $selector;}
910
-			}
911
-
912
-			// add any color rules
913
-			if(!empty($color)){
914
-				$output .= implode(",",$color) . "{color: $color_code;} ";
915
-			}
916
-			if(!empty($color_i)){
917
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
918
-			}
919
-
920
-			// add any background color rules
921
-			if(!empty($background)){
922
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
923
-			}
924
-			if(!empty($background_i)){
925
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
926
-			}
927
-
928
-			// add any border color rules
929
-			if(!empty($border)){
930
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
931
-			}
932
-			if(!empty($border_i)){
933
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
934
-			}
935
-
936
-			// add any fill color rules
937
-			if(!empty($fill)){
938
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
939
-			}
940
-			if(!empty($fill_i)){
941
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
942
-			}
943
-
944
-
945
-			$prefix = $compatibility ? ".bsui " : "";
946
-
947
-			// darken
948
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
949
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
950
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
951
-
952
-			// lighten
953
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
954
-
955
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
956
-			$op_25 = $color_code."40"; // 25% opacity
957
-
958
-
959
-			// button states
960
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
961
-			$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;} ";
962
-			$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.";} ";
963
-			$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;} ";
964
-
965
-
966
-			// dropdown's
967
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
968
-
969
-
970
-			// input states
971
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
972
-
973
-			// page link
974
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
975
-
976
-			return $output;
977
-		}
978
-
979
-		public static function css_secondary($color_code,$compatibility){;
980
-			$color_code = sanitize_hex_color($color_code);
981
-			if(!$color_code){return '';}
982
-			/**
983
-			 * c = color, b = background color, o = border-color, f = fill
984
-			 */
985
-			$selectors = array(
986
-				'.btn-secondary' => array('b','o'),
987
-				'.btn-secondary.disabled' => array('b','o'),
988
-				'.btn-secondary:disabled' => array('b','o'),
989
-				'.btn-outline-secondary' => array('c','o'),
990
-				'.btn-outline-secondary:hover' => array('b','o'),
991
-				'.btn-outline-secondary.disabled' => array('c'),
992
-				'.btn-outline-secondary:disabled' => array('c'),
993
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
994
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
995
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
996
-				'.badge-secondary' => array('b'),
997
-				'.alert-secondary' => array('b','o'),
998
-				'.btn-link.btn-secondary' => array('c'),
999
-			);
1000
-
1001
-			$important_selectors = array(
1002
-				'.bg-secondary' => array('b','f'),
1003
-				'.border-secondary' => array('o'),
1004
-				'.text-secondary' => array('c'),
1005
-			);
1006
-
1007
-			$color = array();
1008
-			$color_i = array();
1009
-			$background = array();
1010
-			$background_i = array();
1011
-			$border = array();
1012
-			$border_i = array();
1013
-			$fill = array();
1014
-			$fill_i = array();
1015
-
1016
-			$output = '';
1017
-
1018
-			// build rules into each type
1019
-			foreach($selectors as $selector => $types){
1020
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1021
-				$types = array_combine($types,$types);
1022
-				if(isset($types['c'])){$color[] = $selector;}
1023
-				if(isset($types['b'])){$background[] = $selector;}
1024
-				if(isset($types['o'])){$border[] = $selector;}
1025
-				if(isset($types['f'])){$fill[] = $selector;}
1026
-			}
1027
-
1028
-			// build rules into each type
1029
-			foreach($important_selectors as $selector => $types){
1030
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1031
-				$types = array_combine($types,$types);
1032
-				if(isset($types['c'])){$color_i[] = $selector;}
1033
-				if(isset($types['b'])){$background_i[] = $selector;}
1034
-				if(isset($types['o'])){$border_i[] = $selector;}
1035
-				if(isset($types['f'])){$fill_i[] = $selector;}
1036
-			}
1037
-
1038
-			// add any color rules
1039
-			if(!empty($color)){
1040
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1041
-			}
1042
-			if(!empty($color_i)){
1043
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1044
-			}
1045
-
1046
-			// add any background color rules
1047
-			if(!empty($background)){
1048
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1049
-			}
1050
-			if(!empty($background_i)){
1051
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1052
-			}
1053
-
1054
-			// add any border color rules
1055
-			if(!empty($border)){
1056
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1057
-			}
1058
-			if(!empty($border_i)){
1059
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1060
-			}
1061
-
1062
-			// add any fill color rules
1063
-			if(!empty($fill)){
1064
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1065
-			}
1066
-			if(!empty($fill_i)){
1067
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1068
-			}
1069
-
1070
-
1071
-			$prefix = $compatibility ? ".bsui " : "";
1072
-
1073
-			// darken
1074
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1075
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1076
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1077
-
1078
-			// lighten
1079
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1080
-
1081
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1082
-			$op_25 = $color_code."40"; // 25% opacity
1083
-
1084
-
1085
-			// button states
1086
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1087
-			$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;} ";
1088
-			$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.";} ";
1089
-			$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;} ";
1090
-
1091
-
1092
-			return $output;
1093
-		}
1094
-
1095
-		/**
1096
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
1097
-		 *
1098
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1099
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1100
-		 *
1101
-		 * @return  string
1102
-		 */
1103
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1104
-			$hexCode = ltrim($hexCode, '#');
1105
-
1106
-			if (strlen($hexCode) == 3) {
1107
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1108
-			}
1109
-
1110
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
1111
-
1112
-			foreach ($hexCode as & $color) {
1113
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1114
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
1115
-
1116
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1117
-			}
1118
-
1119
-			return '#' . implode($hexCode);
1120
-		}
1121
-
1122
-		/**
1123
-		 * Check if we should display examples.
1124
-		 */
1125
-		public function maybe_show_examples(){
1126
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1127
-				echo "<head>";
1128
-				wp_head();
1129
-				echo "</head>";
1130
-				echo "<body>";
1131
-				echo $this->get_examples();
1132
-				echo "</body>";
1133
-				exit;
1134
-			}
1135
-		}
1136
-
1137
-		/**
1138
-		 * Get developer examples.
1139
-		 *
1140
-		 * @return string
1141
-		 */
1142
-		public function get_examples(){
1143
-			$output = '';
1144
-
1145
-
1146
-			// open form
1147
-			$output .= "<form class='p-5 m-5 border rounded'>";
1148
-
1149
-			// input example
1150
-			$output .= aui()->input(array(
1151
-				'type'  =>  'text',
1152
-				'id'    =>  'text-example',
1153
-				'name'    =>  'text-example',
1154
-				'placeholder'   => 'text placeholder',
1155
-				'title'   => 'Text input example',
1156
-				'value' =>  '',
1157
-				'required'  => false,
1158
-				'help_text' => 'help text',
1159
-				'label' => 'Text input example label'
1160
-			));
1161
-
1162
-			// input example
1163
-			$output .= aui()->input(array(
1164
-				'type'  =>  'url',
1165
-				'id'    =>  'text-example2',
1166
-				'name'    =>  'text-example',
1167
-				'placeholder'   => 'url placeholder',
1168
-				'title'   => 'Text input example',
1169
-				'value' =>  '',
1170
-				'required'  => false,
1171
-				'help_text' => 'help text',
1172
-				'label' => 'Text input example label'
1173
-			));
1174
-
1175
-			// checkbox example
1176
-			$output .= aui()->input(array(
1177
-				'type'  =>  'checkbox',
1178
-				'id'    =>  'checkbox-example',
1179
-				'name'    =>  'checkbox-example',
1180
-				'placeholder'   => 'checkbox-example',
1181
-				'title'   => 'Checkbox example',
1182
-				'value' =>  '1',
1183
-				'checked'   => true,
1184
-				'required'  => false,
1185
-				'help_text' => 'help text',
1186
-				'label' => 'Checkbox checked'
1187
-			));
1188
-
1189
-			// checkbox example
1190
-			$output .= aui()->input(array(
1191
-				'type'  =>  'checkbox',
1192
-				'id'    =>  'checkbox-example2',
1193
-				'name'    =>  'checkbox-example2',
1194
-				'placeholder'   => 'checkbox-example',
1195
-				'title'   => 'Checkbox example',
1196
-				'value' =>  '1',
1197
-				'checked'   => false,
1198
-				'required'  => false,
1199
-				'help_text' => 'help text',
1200
-				'label' => 'Checkbox un-checked'
1201
-			));
1202
-
1203
-			// switch example
1204
-			$output .= aui()->input(array(
1205
-				'type'  =>  'checkbox',
1206
-				'id'    =>  'switch-example',
1207
-				'name'    =>  'switch-example',
1208
-				'placeholder'   => 'checkbox-example',
1209
-				'title'   => 'Switch example',
1210
-				'value' =>  '1',
1211
-				'checked'   => true,
1212
-				'switch'    => true,
1213
-				'required'  => false,
1214
-				'help_text' => 'help text',
1215
-				'label' => 'Switch on'
1216
-			));
1217
-
1218
-			// switch example
1219
-			$output .= aui()->input(array(
1220
-				'type'  =>  'checkbox',
1221
-				'id'    =>  'switch-example2',
1222
-				'name'    =>  'switch-example2',
1223
-				'placeholder'   => 'checkbox-example',
1224
-				'title'   => 'Switch example',
1225
-				'value' =>  '1',
1226
-				'checked'   => false,
1227
-				'switch'    => true,
1228
-				'required'  => false,
1229
-				'help_text' => 'help text',
1230
-				'label' => 'Switch off'
1231
-			));
1232
-
1233
-			// close form
1234
-			$output .= "</form>";
1235
-
1236
-			return $output;
1237
-		}
1238
-
1239
-	}
1240
-
1241
-	/**
1242
-	 * Run the class if found.
1243
-	 */
1244
-	AyeCode_UI_Settings::instance();
862
+                '.nav-pills .nav-link.active' => array('b'),
863
+                '.nav-pills .show>.nav-link' => array('b'),
864
+                '.page-link' => array('c'),
865
+                '.page-item.active .page-link' => array('b','o'),
866
+                '.badge-primary' => array('b'),
867
+                '.alert-primary' => array('b','o'),
868
+                '.progress-bar' => array('b'),
869
+                '.list-group-item.active' => array('b','o'),
870
+                '.bg-primary' => array('b','f'),
871
+                '.btn-link.btn-primary' => array('c'),
872
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
873
+            );
874
+
875
+            $important_selectors = array(
876
+                '.bg-primary' => array('b','f'),
877
+                '.border-primary' => array('o'),
878
+                '.text-primary' => array('c'),
879
+            );
880
+
881
+            $color = array();
882
+            $color_i = array();
883
+            $background = array();
884
+            $background_i = array();
885
+            $border = array();
886
+            $border_i = array();
887
+            $fill = array();
888
+            $fill_i = array();
889
+
890
+            $output = '';
891
+
892
+            // build rules into each type
893
+            foreach($selectors as $selector => $types){
894
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
895
+                $types = array_combine($types,$types);
896
+                if(isset($types['c'])){$color[] = $selector;}
897
+                if(isset($types['b'])){$background[] = $selector;}
898
+                if(isset($types['o'])){$border[] = $selector;}
899
+                if(isset($types['f'])){$fill[] = $selector;}
900
+            }
901
+
902
+            // build rules into each type
903
+            foreach($important_selectors as $selector => $types){
904
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
905
+                $types = array_combine($types,$types);
906
+                if(isset($types['c'])){$color_i[] = $selector;}
907
+                if(isset($types['b'])){$background_i[] = $selector;}
908
+                if(isset($types['o'])){$border_i[] = $selector;}
909
+                if(isset($types['f'])){$fill_i[] = $selector;}
910
+            }
911
+
912
+            // add any color rules
913
+            if(!empty($color)){
914
+                $output .= implode(",",$color) . "{color: $color_code;} ";
915
+            }
916
+            if(!empty($color_i)){
917
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
918
+            }
919
+
920
+            // add any background color rules
921
+            if(!empty($background)){
922
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
923
+            }
924
+            if(!empty($background_i)){
925
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
926
+            }
927
+
928
+            // add any border color rules
929
+            if(!empty($border)){
930
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
931
+            }
932
+            if(!empty($border_i)){
933
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
934
+            }
935
+
936
+            // add any fill color rules
937
+            if(!empty($fill)){
938
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
939
+            }
940
+            if(!empty($fill_i)){
941
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
942
+            }
943
+
944
+
945
+            $prefix = $compatibility ? ".bsui " : "";
946
+
947
+            // darken
948
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
949
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
950
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
951
+
952
+            // lighten
953
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
954
+
955
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
956
+            $op_25 = $color_code."40"; // 25% opacity
957
+
958
+
959
+            // button states
960
+            $output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
961
+            $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;} ";
962
+            $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.";} ";
963
+            $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;} ";
964
+
965
+
966
+            // dropdown's
967
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
968
+
969
+
970
+            // input states
971
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
972
+
973
+            // page link
974
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
975
+
976
+            return $output;
977
+        }
978
+
979
+        public static function css_secondary($color_code,$compatibility){;
980
+            $color_code = sanitize_hex_color($color_code);
981
+            if(!$color_code){return '';}
982
+            /**
983
+             * c = color, b = background color, o = border-color, f = fill
984
+             */
985
+            $selectors = array(
986
+                '.btn-secondary' => array('b','o'),
987
+                '.btn-secondary.disabled' => array('b','o'),
988
+                '.btn-secondary:disabled' => array('b','o'),
989
+                '.btn-outline-secondary' => array('c','o'),
990
+                '.btn-outline-secondary:hover' => array('b','o'),
991
+                '.btn-outline-secondary.disabled' => array('c'),
992
+                '.btn-outline-secondary:disabled' => array('c'),
993
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
994
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
995
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
996
+                '.badge-secondary' => array('b'),
997
+                '.alert-secondary' => array('b','o'),
998
+                '.btn-link.btn-secondary' => array('c'),
999
+            );
1000
+
1001
+            $important_selectors = array(
1002
+                '.bg-secondary' => array('b','f'),
1003
+                '.border-secondary' => array('o'),
1004
+                '.text-secondary' => array('c'),
1005
+            );
1006
+
1007
+            $color = array();
1008
+            $color_i = array();
1009
+            $background = array();
1010
+            $background_i = array();
1011
+            $border = array();
1012
+            $border_i = array();
1013
+            $fill = array();
1014
+            $fill_i = array();
1015
+
1016
+            $output = '';
1017
+
1018
+            // build rules into each type
1019
+            foreach($selectors as $selector => $types){
1020
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1021
+                $types = array_combine($types,$types);
1022
+                if(isset($types['c'])){$color[] = $selector;}
1023
+                if(isset($types['b'])){$background[] = $selector;}
1024
+                if(isset($types['o'])){$border[] = $selector;}
1025
+                if(isset($types['f'])){$fill[] = $selector;}
1026
+            }
1027
+
1028
+            // build rules into each type
1029
+            foreach($important_selectors as $selector => $types){
1030
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1031
+                $types = array_combine($types,$types);
1032
+                if(isset($types['c'])){$color_i[] = $selector;}
1033
+                if(isset($types['b'])){$background_i[] = $selector;}
1034
+                if(isset($types['o'])){$border_i[] = $selector;}
1035
+                if(isset($types['f'])){$fill_i[] = $selector;}
1036
+            }
1037
+
1038
+            // add any color rules
1039
+            if(!empty($color)){
1040
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1041
+            }
1042
+            if(!empty($color_i)){
1043
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1044
+            }
1045
+
1046
+            // add any background color rules
1047
+            if(!empty($background)){
1048
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1049
+            }
1050
+            if(!empty($background_i)){
1051
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1052
+            }
1053
+
1054
+            // add any border color rules
1055
+            if(!empty($border)){
1056
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1057
+            }
1058
+            if(!empty($border_i)){
1059
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1060
+            }
1061
+
1062
+            // add any fill color rules
1063
+            if(!empty($fill)){
1064
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1065
+            }
1066
+            if(!empty($fill_i)){
1067
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1068
+            }
1069
+
1070
+
1071
+            $prefix = $compatibility ? ".bsui " : "";
1072
+
1073
+            // darken
1074
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1075
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1076
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1077
+
1078
+            // lighten
1079
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1080
+
1081
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1082
+            $op_25 = $color_code."40"; // 25% opacity
1083
+
1084
+
1085
+            // button states
1086
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1087
+            $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;} ";
1088
+            $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.";} ";
1089
+            $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;} ";
1090
+
1091
+
1092
+            return $output;
1093
+        }
1094
+
1095
+        /**
1096
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
1097
+         *
1098
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1099
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1100
+         *
1101
+         * @return  string
1102
+         */
1103
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1104
+            $hexCode = ltrim($hexCode, '#');
1105
+
1106
+            if (strlen($hexCode) == 3) {
1107
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1108
+            }
1109
+
1110
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1111
+
1112
+            foreach ($hexCode as & $color) {
1113
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1114
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1115
+
1116
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1117
+            }
1118
+
1119
+            return '#' . implode($hexCode);
1120
+        }
1121
+
1122
+        /**
1123
+         * Check if we should display examples.
1124
+         */
1125
+        public function maybe_show_examples(){
1126
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1127
+                echo "<head>";
1128
+                wp_head();
1129
+                echo "</head>";
1130
+                echo "<body>";
1131
+                echo $this->get_examples();
1132
+                echo "</body>";
1133
+                exit;
1134
+            }
1135
+        }
1136
+
1137
+        /**
1138
+         * Get developer examples.
1139
+         *
1140
+         * @return string
1141
+         */
1142
+        public function get_examples(){
1143
+            $output = '';
1144
+
1145
+
1146
+            // open form
1147
+            $output .= "<form class='p-5 m-5 border rounded'>";
1148
+
1149
+            // input example
1150
+            $output .= aui()->input(array(
1151
+                'type'  =>  'text',
1152
+                'id'    =>  'text-example',
1153
+                'name'    =>  'text-example',
1154
+                'placeholder'   => 'text placeholder',
1155
+                'title'   => 'Text input example',
1156
+                'value' =>  '',
1157
+                'required'  => false,
1158
+                'help_text' => 'help text',
1159
+                'label' => 'Text input example label'
1160
+            ));
1161
+
1162
+            // input example
1163
+            $output .= aui()->input(array(
1164
+                'type'  =>  'url',
1165
+                'id'    =>  'text-example2',
1166
+                'name'    =>  'text-example',
1167
+                'placeholder'   => 'url placeholder',
1168
+                'title'   => 'Text input example',
1169
+                'value' =>  '',
1170
+                'required'  => false,
1171
+                'help_text' => 'help text',
1172
+                'label' => 'Text input example label'
1173
+            ));
1174
+
1175
+            // checkbox example
1176
+            $output .= aui()->input(array(
1177
+                'type'  =>  'checkbox',
1178
+                'id'    =>  'checkbox-example',
1179
+                'name'    =>  'checkbox-example',
1180
+                'placeholder'   => 'checkbox-example',
1181
+                'title'   => 'Checkbox example',
1182
+                'value' =>  '1',
1183
+                'checked'   => true,
1184
+                'required'  => false,
1185
+                'help_text' => 'help text',
1186
+                'label' => 'Checkbox checked'
1187
+            ));
1188
+
1189
+            // checkbox example
1190
+            $output .= aui()->input(array(
1191
+                'type'  =>  'checkbox',
1192
+                'id'    =>  'checkbox-example2',
1193
+                'name'    =>  'checkbox-example2',
1194
+                'placeholder'   => 'checkbox-example',
1195
+                'title'   => 'Checkbox example',
1196
+                'value' =>  '1',
1197
+                'checked'   => false,
1198
+                'required'  => false,
1199
+                'help_text' => 'help text',
1200
+                'label' => 'Checkbox un-checked'
1201
+            ));
1202
+
1203
+            // switch example
1204
+            $output .= aui()->input(array(
1205
+                'type'  =>  'checkbox',
1206
+                'id'    =>  'switch-example',
1207
+                'name'    =>  'switch-example',
1208
+                'placeholder'   => 'checkbox-example',
1209
+                'title'   => 'Switch example',
1210
+                'value' =>  '1',
1211
+                'checked'   => true,
1212
+                'switch'    => true,
1213
+                'required'  => false,
1214
+                'help_text' => 'help text',
1215
+                'label' => 'Switch on'
1216
+            ));
1217
+
1218
+            // switch example
1219
+            $output .= aui()->input(array(
1220
+                'type'  =>  'checkbox',
1221
+                'id'    =>  'switch-example2',
1222
+                'name'    =>  'switch-example2',
1223
+                'placeholder'   => 'checkbox-example',
1224
+                'title'   => 'Switch example',
1225
+                'value' =>  '1',
1226
+                'checked'   => false,
1227
+                'switch'    => true,
1228
+                'required'  => false,
1229
+                'help_text' => 'help text',
1230
+                'label' => 'Switch off'
1231
+            ));
1232
+
1233
+            // close form
1234
+            $output .= "</form>";
1235
+
1236
+            return $output;
1237
+        }
1238
+
1239
+    }
1240
+
1241
+    /**
1242
+     * Run the class if found.
1243
+     */
1244
+    AyeCode_UI_Settings::instance();
1245 1245
 }
1246 1246
\ No newline at end of file
Please login to merge, or discard this patch.