Passed
Push — master ( c4c78b...c15536 )
by Brian
08:03 queued 02:54
created
includes/wpinv-item-functions.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
     $args = wp_parse_args(
58 58
         $args,
59 59
         array(
60
-			'status'     => array( 'publish' ),
61
-			'limit'      => get_option( 'posts_per_page' ),
62
-			'page'       => 1,
63
-			'exclude'    => array(),
64
-			'orderby'    => 'date',
65
-			'order'      => 'DESC',
66
-			'type'       => wpinv_item_types(),
67
-			'meta_query' => array(),
68
-			'return'     => 'objects',
69
-			'paginate'   => false,
60
+            'status'     => array( 'publish' ),
61
+            'limit'      => get_option( 'posts_per_page' ),
62
+            'page'       => 1,
63
+            'exclude'    => array(),
64
+            'orderby'    => 'date',
65
+            'order'      => 'DESC',
66
+            'type'       => wpinv_item_types(),
67
+            'meta_query' => array(),
68
+            'return'     => 'objects',
69
+            'paginate'   => false,
70 70
         )
71 71
     );
72 72
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 
207 207
 function wpinv_get_item_types() {
208 208
     $item_types = array(
209
-		'custom' => __( 'Standard', 'invoicing' ),
210
-		'fee'    => __( 'Fee', 'invoicing' ),
211
-	);
209
+        'custom' => __( 'Standard', 'invoicing' ),
210
+        'fee'    => __( 'Fee', 'invoicing' ),
211
+    );
212 212
     return apply_filters( 'wpinv_get_item_types', $item_types );
213 213
 }
214 214
 
@@ -249,17 +249,17 @@  discard block
 block discarded – undo
249 249
 function wpinv_get_random_items( $num = 3, $post_ids = true ) {
250 250
     if ( $post_ids ) {
251 251
         $args = array(
252
-			'post_type'  => 'wpi_item',
253
-			'orderby'    => 'rand',
254
-			'post_count' => $num,
255
-			'fields'     => 'ids',
256
-		);
252
+            'post_type'  => 'wpi_item',
253
+            'orderby'    => 'rand',
254
+            'post_count' => $num,
255
+            'fields'     => 'ids',
256
+        );
257 257
     } else {
258 258
         $args = array(
259
-			'post_type'  => 'wpi_item',
260
-			'orderby'    => 'rand',
261
-			'post_count' => $num,
262
-		);
259
+            'post_type'  => 'wpi_item',
260
+            'orderby'    => 'rand',
261
+            'post_count' => $num,
262
+        );
263 263
     }
264 264
 
265 265
     $args  = apply_filters( 'wpinv_get_random_items', $args );
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
     $bill_times_less = $bill_times - 1;
428 428
 
429 429
     if ( ! empty( $bill_times ) ) {
430
-		$bill_times = $item->get_recurring_interval() * $bill_times;
430
+        $bill_times = $item->get_recurring_interval() * $bill_times;
431 431
         $bill_times_less = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times - $item->get_recurring_interval() );
432
-		$bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
433
-	}
432
+        $bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
433
+    }
434 434
 
435 435
     if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
436 436
         $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves an item by it's ID.
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * @param int the item ID to retrieve.
15 15
  * @return WPInv_Item|false
16 16
  */
17
-function wpinv_get_item_by_id( $id ) {
18
-    $item = wpinv_get_item( $id );
19
-    return empty( $item ) || $id != $item->get_id() ? false : $item;
17
+function wpinv_get_item_by_id($id) {
18
+    $item = wpinv_get_item($id);
19
+    return empty($item) || $id != $item->get_id() ? false : $item;
20 20
 }
21 21
 
22 22
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return WPInv_Item|false
26 26
  */
27
-function wpinv_get_item_by( $field = '', $value = '', $type = '' ) {
27
+function wpinv_get_item_by($field = '', $value = '', $type = '') {
28 28
 
29
-    if ( 'id' == strtolower( $field ) ) {
30
-        return wpinv_get_item_by_id( $field );
29
+    if ('id' == strtolower($field)) {
30
+        return wpinv_get_item_by_id($field);
31 31
     }
32 32
 
33
-    $id = WPInv_Item::get_item_id_by_field( $value, strtolower( $field ), $type );
34
-    return empty( $id ) ? false : wpinv_get_item( $id );
33
+    $id = WPInv_Item::get_item_id_by_field($value, strtolower($field), $type);
34
+    return empty($id) ? false : wpinv_get_item($id);
35 35
 
36 36
 }
37 37
 
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
  * @param int|WPInv_Item the item to retrieve.
42 42
  * @return WPInv_Item|false
43 43
  */
44
-function wpinv_get_item( $item = 0 ) {
44
+function wpinv_get_item($item = 0) {
45 45
 
46
-    if ( empty( $item ) ) {
46
+    if (empty($item)) {
47 47
         return false;
48 48
     }
49 49
 
50
-    $item = new WPInv_Item( $item );
50
+    $item = new WPInv_Item($item);
51 51
     return $item->exists() ? $item : false;
52 52
 
53 53
 }
54 54
 
55
-function wpinv_get_all_items( $args = array() ) {
55
+function wpinv_get_all_items($args = array()) {
56 56
 
57 57
     $args = wp_parse_args(
58 58
         $args,
59 59
         array(
60
-			'status'     => array( 'publish' ),
61
-			'limit'      => get_option( 'posts_per_page' ),
60
+			'status'     => array('publish'),
61
+			'limit'      => get_option('posts_per_page'),
62 62
 			'page'       => 1,
63 63
 			'exclude'    => array(),
64 64
 			'orderby'    => 'date',
@@ -78,44 +78,44 @@  discard block
 block discarded – undo
78 78
         'fields'         => 'ids',
79 79
         'orderby'        => $args['orderby'],
80 80
         'order'          => $args['order'],
81
-        'paged'          => absint( $args['page'] ),
81
+        'paged'          => absint($args['page']),
82 82
     );
83 83
 
84
-    if ( ! empty( $args['exclude'] ) ) {
85
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
84
+    if (!empty($args['exclude'])) {
85
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
86 86
     }
87 87
 
88
-    if ( ! $args['paginate'] ) {
88
+    if (!$args['paginate']) {
89 89
         $wp_query_args['no_found_rows'] = true;
90 90
     }
91 91
 
92
-    if ( ! empty( $args['search'] ) ) {
92
+    if (!empty($args['search'])) {
93 93
         $wp_query_args['s'] = $args['search'];
94 94
     }
95 95
 
96
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
97
-        $types = wpinv_parse_list( $args['type'] );
96
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
97
+        $types = wpinv_parse_list($args['type']);
98 98
         $wp_query_args['meta_query'][] = array(
99 99
             'key'     => '_wpinv_type',
100
-            'value'   => implode( ',', $types ),
100
+            'value'   => implode(',', $types),
101 101
             'compare' => 'IN',
102 102
         );
103 103
     }
104 104
 
105
-    $wp_query_args = apply_filters( 'wpinv_get_items_args', $wp_query_args, $args );
105
+    $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
106 106
 
107 107
     // Get results.
108
-    $items = new WP_Query( $wp_query_args );
108
+    $items = new WP_Query($wp_query_args);
109 109
 
110
-    if ( 'objects' === $args['return'] ) {
111
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
112
-    } elseif ( 'self' === $args['return'] ) {
110
+    if ('objects' === $args['return']) {
111
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
112
+    } elseif ('self' === $args['return']) {
113 113
         return $items;
114 114
     } else {
115 115
         $return = $items->posts;
116 116
     }
117 117
 
118
-    if ( $args['paginate'] ) {
118
+    if ($args['paginate']) {
119 119
         return (object) array(
120 120
             'items'         => $return,
121 121
             'total'         => $items->found_posts,
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 
128 128
 }
129 129
 
130
-function wpinv_is_free_item( $item_id = 0 ) {
131
-    if ( empty( $item_id ) ) {
130
+function wpinv_is_free_item($item_id = 0) {
131
+    if (empty($item_id)) {
132 132
         return false;
133 133
     }
134 134
 
135
-    $item = new WPInv_Item( $item_id );
135
+    $item = new WPInv_Item($item_id);
136 136
 
137 137
     return $item->is_free();
138 138
 }
@@ -142,21 +142,21 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @param WP_Post|WPInv_Item|Int $item The item to check for.
144 144
  */
145
-function wpinv_item_is_editable( $item = 0 ) {
145
+function wpinv_item_is_editable($item = 0) {
146 146
 
147 147
     // Fetch the item.
148
-    $item = new WPInv_Item( $item );
148
+    $item = new WPInv_Item($item);
149 149
 
150 150
     // Check if it is editable.
151 151
     return $item->is_editable();
152 152
 }
153 153
 
154
-function wpinv_get_item_price( $item_id = 0 ) {
155
-    if ( empty( $item_id ) ) {
154
+function wpinv_get_item_price($item_id = 0) {
155
+    if (empty($item_id)) {
156 156
         return false;
157 157
     }
158 158
 
159
-    $item = new WPInv_Item( $item_id );
159
+    $item = new WPInv_Item($item_id);
160 160
 
161 161
     return $item->get_price();
162 162
 }
@@ -166,88 +166,88 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @param WPInv_Item|int $item
168 168
  */
169
-function wpinv_is_recurring_item( $item = 0 ) {
170
-    $item = new WPInv_Item( $item );
169
+function wpinv_is_recurring_item($item = 0) {
170
+    $item = new WPInv_Item($item);
171 171
     return $item->is_recurring();
172 172
 }
173 173
 
174
-function wpinv_item_price( $item_id = 0 ) {
175
-    if ( empty( $item_id ) ) {
174
+function wpinv_item_price($item_id = 0) {
175
+    if (empty($item_id)) {
176 176
         return false;
177 177
     }
178 178
 
179
-    $price = wpinv_get_item_price( $item_id );
180
-    $price = wpinv_price( $price );
179
+    $price = wpinv_get_item_price($item_id);
180
+    $price = wpinv_price($price);
181 181
 
182
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
182
+    return apply_filters('wpinv_item_price', $price, $item_id);
183 183
 }
184 184
 
185
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
186
-    if ( is_null( $amount_override ) ) {
187
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
185
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
186
+    if (is_null($amount_override)) {
187
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
188 188
     } else {
189 189
         $original_price = $amount_override;
190 190
     }
191 191
 
192 192
     $price = $original_price;
193 193
 
194
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
194
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
195 195
 }
196 196
 
197
-function wpinv_item_custom_singular_name( $item_id ) {
198
-    if ( empty( $item_id ) ) {
197
+function wpinv_item_custom_singular_name($item_id) {
198
+    if (empty($item_id)) {
199 199
         return false;
200 200
     }
201 201
 
202
-    $item = new WPInv_Item( $item_id );
202
+    $item = new WPInv_Item($item_id);
203 203
 
204 204
     return $item->get_custom_singular_name();
205 205
 }
206 206
 
207 207
 function wpinv_get_item_types() {
208 208
     $item_types = array(
209
-		'custom' => __( 'Standard', 'invoicing' ),
210
-		'fee'    => __( 'Fee', 'invoicing' ),
209
+		'custom' => __('Standard', 'invoicing'),
210
+		'fee'    => __('Fee', 'invoicing'),
211 211
 	);
212
-    return apply_filters( 'wpinv_get_item_types', $item_types );
212
+    return apply_filters('wpinv_get_item_types', $item_types);
213 213
 }
214 214
 
215 215
 function wpinv_item_types() {
216 216
     $item_types = wpinv_get_item_types();
217 217
 
218
-    return ( ! empty( $item_types ) ? array_keys( $item_types ) : array() );
218
+    return (!empty($item_types) ? array_keys($item_types) : array());
219 219
 }
220 220
 
221
-function wpinv_get_item_type( $item_id ) {
222
-    if ( empty( $item_id ) ) {
221
+function wpinv_get_item_type($item_id) {
222
+    if (empty($item_id)) {
223 223
         return false;
224 224
     }
225 225
 
226
-    $item = new WPInv_Item( $item_id );
226
+    $item = new WPInv_Item($item_id);
227 227
 
228 228
     return $item->get_type();
229 229
 }
230 230
 
231
-function wpinv_item_type( $item_id ) {
231
+function wpinv_item_type($item_id) {
232 232
     $item_types = wpinv_get_item_types();
233 233
 
234
-    $item_type = wpinv_get_item_type( $item_id );
234
+    $item_type = wpinv_get_item_type($item_id);
235 235
 
236
-    if ( empty( $item_type ) ) {
236
+    if (empty($item_type)) {
237 237
         $item_type = '-';
238 238
     }
239 239
 
240
-    $item_type = isset( $item_types[ $item_type ] ) ? $item_types[ $item_type ] : __( $item_type, 'invoicing' );
240
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
241 241
 
242
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
242
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
243 243
 }
244 244
 
245
-function wpinv_get_random_item( $post_ids = true ) {
246
-    wpinv_get_random_items( 1, $post_ids );
245
+function wpinv_get_random_item($post_ids = true) {
246
+    wpinv_get_random_items(1, $post_ids);
247 247
 }
248 248
 
249
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
250
-    if ( $post_ids ) {
249
+function wpinv_get_random_items($num = 3, $post_ids = true) {
250
+    if ($post_ids) {
251 251
         $args = array(
252 252
 			'post_type'  => 'wpi_item',
253 253
 			'orderby'    => 'rand',
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 		);
263 263
     }
264 264
 
265
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
265
+    $args = apply_filters('wpinv_get_random_items', $args);
266 266
 
267
-    return get_posts( $args );
267
+    return get_posts($args);
268 268
 }
269 269
 
270 270
 /**
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
  * @param WPInv_Item|int $item
274 274
  * @param bool $html
275 275
  */
276
-function wpinv_get_item_suffix( $item, $html = true ) {
276
+function wpinv_get_item_suffix($item, $html = true) {
277 277
 
278
-    $item   = new WPInv_Item( $item );
279
-    $suffix = $item->is_recurring() ? ' ' . __( '(r)', 'invoicing' ) : '';
280
-    $suffix = $html ? $suffix : wp_strip_all_tags( $suffix );
278
+    $item   = new WPInv_Item($item);
279
+    $suffix = $item->is_recurring() ? ' ' . __('(r)', 'invoicing') : '';
280
+    $suffix = $html ? $suffix : wp_strip_all_tags($suffix);
281 281
 
282
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
282
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
283 283
 }
284 284
 
285 285
 /**
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
  * @param WPInv_Item|int $item
289 289
  * @param bool $force_delete
290 290
  */
291
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
292
-    $item = new WPInv_Item( $item );
293
-    $item->delete( $force_delete );
291
+function wpinv_remove_item($item = 0, $force_delete = false) {
292
+    $item = new WPInv_Item($item);
293
+    $item->delete($force_delete);
294 294
 }
295 295
 
296 296
 /**
@@ -329,44 +329,44 @@  discard block
 block discarded – undo
329 329
  * @param bool $wp_error whether or not to return a WP_Error on failure.
330 330
  * @return bool|WP_Error|WPInv_Item
331 331
  */
332
-function wpinv_create_item( $args = array(), $wp_error = false ) {
332
+function wpinv_create_item($args = array(), $wp_error = false) {
333 333
 
334 334
     // Prepare the item.
335
-    if ( ! empty( $args['custom_id'] ) && empty( $args['ID'] ) ) {
336
-        $type = empty( $args['type'] ) ? 'custom' : $args['type'];
337
-        $item = wpinv_get_item_by( 'custom_id', $args['custom_id'], $type );
335
+    if (!empty($args['custom_id']) && empty($args['ID'])) {
336
+        $type = empty($args['type']) ? 'custom' : $args['type'];
337
+        $item = wpinv_get_item_by('custom_id', $args['custom_id'], $type);
338 338
 
339
-        if ( ! empty( $item ) ) {
339
+        if (!empty($item)) {
340 340
             $args['ID'] = $item->get_id();
341 341
         }
342 342
     }
343 343
 
344 344
     // Do we have an item?
345
-    if ( ! empty( $args['ID'] ) ) {
346
-        $item = new WPInv_Item( $args['ID'] );
345
+    if (!empty($args['ID'])) {
346
+        $item = new WPInv_Item($args['ID']);
347 347
     } else {
348 348
         $item = new WPInv_Item();
349 349
     }
350 350
 
351 351
     // Do we have an error?
352
-    if ( ! empty( $item->last_error ) ) {
353
-        return $wp_error ? new WP_Error( 'invalid_item', $item->last_error ) : false;
352
+    if (!empty($item->last_error)) {
353
+        return $wp_error ? new WP_Error('invalid_item', $item->last_error) : false;
354 354
     }
355 355
 
356 356
     // Update item props.
357
-    $item->set_props( $args );
357
+    $item->set_props($args);
358 358
 
359 359
     // Save the item.
360 360
     $item->save();
361 361
 
362 362
     // Do we have an error?
363
-    if ( ! empty( $item->last_error ) ) {
364
-        return $wp_error ? new WP_Error( 'not_saved', $item->last_error ) : false;
363
+    if (!empty($item->last_error)) {
364
+        return $wp_error ? new WP_Error('not_saved', $item->last_error) : false;
365 365
     }
366 366
 
367 367
     // Was the item saved?
368
-    if ( ! $item->get_id() ) {
369
-        return $wp_error ? new WP_Error( 'not_saved', __( 'An error occured while saving the item', 'invoicing' ) ) : false;
368
+    if (!$item->get_id()) {
369
+        return $wp_error ? new WP_Error('not_saved', __('An error occured while saving the item', 'invoicing')) : false;
370 370
     }
371 371
 
372 372
     return $item;
@@ -378,14 +378,14 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @see wpinv_create_item()
380 380
  */
381
-function wpinv_update_item( $args = array(), $wp_error = false ) {
382
-    return wpinv_create_item( $args, $wp_error );
381
+function wpinv_update_item($args = array(), $wp_error = false) {
382
+    return wpinv_create_item($args, $wp_error);
383 383
 }
384 384
 
385 385
 /**
386 386
  * Sanitizes a recurring period
387 387
  */
388
-function getpaid_sanitize_recurring_period( $period, $full = false ) {
388
+function getpaid_sanitize_recurring_period($period, $full = false) {
389 389
 
390 390
     $periods = array(
391 391
         'D' => 'day',
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
         'Y' => 'year',
395 395
     );
396 396
 
397
-    if ( ! isset( $periods[ $period ] ) ) {
397
+    if (!isset($periods[$period])) {
398 398
         $period = 'D';
399 399
     }
400 400
 
401
-    return $full ? $periods[ $period ] : $period;
401
+    return $full ? $periods[$period] : $period;
402 402
 
403 403
 }
404 404
 
405
-function wpinv_item_max_buyable_quantity( $item_id ) {
406
-    return apply_filters( 'wpinv_item_max_buyable_quantity', 5, $item_id );
405
+function wpinv_item_max_buyable_quantity($item_id) {
406
+    return apply_filters('wpinv_item_max_buyable_quantity', 5, $item_id);
407 407
 }
408 408
 
409 409
 /**
@@ -411,47 +411,47 @@  discard block
 block discarded – undo
411 411
  *
412 412
  * @param WPInv_Item|GetPaid_Form_Item $item
413 413
  */
414
-function getpaid_item_recurring_price_help_text( $item, $currency = '', $_initial_price = false, $_recurring_price = false ) {
414
+function getpaid_item_recurring_price_help_text($item, $currency = '', $_initial_price = false, $_recurring_price = false) {
415 415
 
416 416
     // Abort if it is not recurring.
417
-    if ( ! $item->is_recurring() ) {
417
+    if (!$item->is_recurring()) {
418 418
         return '';
419 419
     }
420 420
 
421
-    $initial_price   = false === $_initial_price ? wpinv_price( $item->get_initial_price(), $currency ) : $_initial_price;
422
-    $recurring_price = false === $_recurring_price ? wpinv_price( $item->get_recurring_price(), $currency ) : $_recurring_price;
423
-    $period          = getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' );
421
+    $initial_price   = false === $_initial_price ? wpinv_price($item->get_initial_price(), $currency) : $_initial_price;
422
+    $recurring_price = false === $_recurring_price ? wpinv_price($item->get_recurring_price(), $currency) : $_recurring_price;
423
+    $period          = getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '');
424 424
     $initial_class   = 'getpaid-item-initial-price';
425 425
     $recurring_class = 'getpaid-item-recurring-price';
426 426
     $bill_times      = $item->get_recurring_limit();
427 427
     $bill_times_less = $bill_times - 1;
428 428
 
429
-    if ( ! empty( $bill_times ) ) {
429
+    if (!empty($bill_times)) {
430 430
 		$bill_times = $item->get_recurring_interval() * $bill_times;
431
-        $bill_times_less = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times - $item->get_recurring_interval() );
432
-		$bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
431
+        $bill_times_less = getpaid_get_subscription_period_label($item->get_recurring_period(), $bill_times - $item->get_recurring_interval());
432
+		$bill_times = getpaid_get_subscription_period_label($item->get_recurring_period(), $bill_times);
433 433
 	}
434 434
 
435
-    if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
436
-        $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
437
-        $recurring_price = wpinv_price( $item->get_recurring_sub_total(), $currency );
435
+    if ($item instanceof GetPaid_Form_Item && false === $_initial_price) {
436
+        $initial_price   = wpinv_price($item->get_sub_total(), $currency);
437
+        $recurring_price = wpinv_price($item->get_recurring_sub_total(), $currency);
438 438
     }
439 439
 
440
-    if ( wpinv_price( 0, $currency ) == $initial_price && wpinv_price( 0, $currency ) == $recurring_price ) {
441
-        return __( 'Free forever', 'invoicing' );
440
+    if (wpinv_price(0, $currency) == $initial_price && wpinv_price(0, $currency) == $recurring_price) {
441
+        return __('Free forever', 'invoicing');
442 442
     }
443 443
 
444 444
     // For free trial items.
445
-    if ( $item->has_free_trial() ) {
446
-        $trial_period = getpaid_get_subscription_period_label( $item->get_trial_period(), $item->get_trial_interval() );
445
+    if ($item->has_free_trial()) {
446
+        $trial_period = getpaid_get_subscription_period_label($item->get_trial_period(), $item->get_trial_interval());
447 447
 
448
-        if ( wpinv_price( 0, $currency ) == $initial_price ) {
448
+        if (wpinv_price(0, $currency) == $initial_price) {
449 449
 
450
-            if ( empty( $bill_times ) ) {
450
+            if (empty($bill_times)) {
451 451
 
452 452
                 return sprintf(
453 453
                     // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period
454
-                    _x( 'Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing' ),
454
+                    _x('Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing'),
455 455
                     "<span class='getpaid-item-trial-period'>$trial_period</span>",
456 456
                     "<span class='$recurring_class'>$recurring_price</span>",
457 457
                     "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 
462 462
             return sprintf(
463 463
                 // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period, $4: is the bill times
464
-                _x( 'Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing' ),
464
+                _x('Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing'),
465 465
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
466 466
                 "<span class='$recurring_class'>$recurring_price</span>",
467 467
                 "<span class='getpaid-item-recurring-period'>$period</span>",
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
 
471 471
         }
472 472
 
473
-        if ( empty( $bill_times ) ) {
473
+        if (empty($bill_times)) {
474 474
 
475 475
             return sprintf(
476 476
                 // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period
477
-                _x( '%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing' ),
477
+                _x('%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing'),
478 478
                 "<span class='$initial_class'>$initial_price</span>",
479 479
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
480 480
                 "<span class='$recurring_class'>$recurring_price</span>",
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 
486 486
         return sprintf(
487 487
             // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period, $4: is the susbcription bill times
488
-            _x( '%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing' ),
488
+            _x('%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing'),
489 489
             "<span class='$initial_class'>$initial_price</span>",
490 490
             "<span class='getpaid-item-trial-period'>$trial_period</span>",
491 491
             "<span class='$recurring_class'>$recurring_price</span>",
@@ -495,13 +495,13 @@  discard block
 block discarded – undo
495 495
 
496 496
     }
497 497
 
498
-    if ( $initial_price == $recurring_price ) {
498
+    if ($initial_price == $recurring_price) {
499 499
 
500
-        if ( empty( $bill_times ) ) {
500
+        if (empty($bill_times)) {
501 501
 
502 502
             return sprintf(
503 503
                 // translators: $1: is the recurring price, $2: is the susbcription period
504
-                _x( '%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing' ),
504
+                _x('%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing'),
505 505
                 "<span class='$recurring_class'>$recurring_price</span>",
506 506
                 "<span class='getpaid-item-recurring-period'>$period</span>"
507 507
             );
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
         return sprintf(
512 512
             // translators: $1: is the recurring price, $2: is the susbcription period, $3: is the susbcription bill times
513
-            _x( '%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing' ),
513
+            _x('%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing'),
514 514
             "<span class='$recurring_class'>$recurring_price</span>",
515 515
             "<span class='getpaid-item-recurring-period'>$period</span>",
516 516
             "<span class='getpaid-item-recurring-bill-times'>$bill_times</span>"
@@ -518,13 +518,13 @@  discard block
 block discarded – undo
518 518
 
519 519
     }
520 520
 
521
-    if ( $initial_price == wpinv_price( 0, $currency ) ) {
521
+    if ($initial_price == wpinv_price(0, $currency)) {
522 522
 
523
-        if ( empty( $bill_times ) ) {
523
+        if (empty($bill_times)) {
524 524
 
525 525
             return sprintf(
526 526
                 // translators: $1: is the recurring period, $2: is the recurring price
527
-                _x( 'Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing' ),
527
+                _x('Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing'),
528 528
                 "<span class='getpaid-item-recurring-period'>$period</span>",
529 529
                 "<span class='$recurring_class'>$recurring_price</span>"
530 530
             );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
         return sprintf(
535 535
             // translators: $1: is the recurring period, $2: is the recurring price, $3: is the bill times
536
-            _x( 'Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing' ),
536
+            _x('Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing'),
537 537
             "<span class='getpaid-item-recurring-period'>$period</span>",
538 538
             "<span class='$recurring_class'>$recurring_price</span>",
539 539
             "<span class='getpaid-item-recurring-bill-times'>$bill_times_less</span>"
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
 
542 542
     }
543 543
 
544
-    if ( empty( $bill_times ) ) {
544
+    if (empty($bill_times)) {
545 545
 
546 546
         return sprintf(
547 547
             // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period
548
-            _x( 'Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing' ),
548
+            _x('Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing'),
549 549
             "<span class='$initial_class'>$initial_price</span>",
550 550
             "<span class='$recurring_class'>$recurring_price</span>",
551 551
             "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
     return sprintf(
557 557
         // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period, $4: is the susbcription bill times
558
-        _x( 'Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing' ),
558
+        _x('Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing'),
559 559
         "<span class='$initial_class'>$initial_price</span>",
560 560
         "<span class='$recurring_class'>$recurring_price</span>",
561 561
         "<span class='getpaid-item-recurring-period'>$period</span>",
Please login to merge, or discard this patch.
templates/payment-forms/elements/billing_email.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 $value = $query_value;
13 13
 $class = '';
14 14
 
15
-if ( ! empty( $form->invoice ) ) {
16
-    $value   = sanitize_email( $form->invoice->get_email() );
17
-} elseif ( is_user_logged_in() ) {
15
+if (!empty($form->invoice)) {
16
+    $value = sanitize_email($form->invoice->get_email());
17
+} elseif (is_user_logged_in()) {
18 18
     $user  = wp_get_current_user();
19
-    $value = sanitize_email( $user->user_email );
19
+    $value = sanitize_email($user->user_email);
20 20
 }
21 21
 
22
-if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) {
22
+if (!empty($value) && !empty($hide_billing_email)) {
23 23
     $class = 'd-none';
24 24
 }
25 25
 
26
-do_action( 'getpaid_before_payment_form_billing_email', $form );
26
+do_action('getpaid_before_payment_form_billing_email', $form);
27 27
 
28
-echo "<span class='" . esc_attr( $class ) . "'>";
28
+echo "<span class='" . esc_attr($class) . "'>";
29 29
 
30 30
 aui()->input(
31 31
     array(
32 32
         'name'             => 'billing_email',
33
-        'id'               => esc_attr( $element_id ),
34
-        'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
35
-        'required'         => ! empty( $required ),
36
-        'label'            => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>',
33
+        'id'               => esc_attr($element_id),
34
+        'placeholder'      => empty($placeholder) ? '' : esc_attr($placeholder),
35
+        'required'         => !empty($required),
36
+        'label'            => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>',
37 37
         'label_type'       => 'vertical',
38
-        'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
38
+        'help_text'        => empty($description) ? '' : wp_kses_post($description),
39 39
         'type'             => 'email',
40 40
         'value'            => $value,
41 41
         'class'            => 'wpinv_billing_email getpaid-refresh-on-change',
@@ -48,4 +48,4 @@  discard block
 block discarded – undo
48 48
 
49 49
 echo '</span>';
50 50
 
51
-do_action( 'getpaid_after_payment_form_billing_email', $form );
51
+do_action('getpaid_after_payment_form_billing_email', $form);
Please login to merge, or discard this patch.
templates/payment-forms/elements/date.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,59 +12,59 @@
 block discarded – undo
12 12
 $label       = empty( $label ) ? '' : wp_kses_post( $label );
13 13
 $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
14 14
 if ( ! empty( $required ) ) {
15
-	$label .= "<span class='text-danger'> *</span>";
15
+    $label .= "<span class='text-danger'> *</span>";
16 16
 }
17 17
 
18 18
 $disable_dates = array();
19 19
 
20 20
 if ( ! empty( $disabled_dates ) ) {
21
-	$disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
-	$disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
-	$disabled_dates = array_filter( explode( ',', $disabled_dates ) );
21
+    $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
+    $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
+    $disabled_dates = array_filter( explode( ',', $disabled_dates ) );
24 24
 
25
-	foreach ( $disabled_dates as $disabled_date ) {
25
+    foreach ( $disabled_dates as $disabled_date ) {
26 26
 
27
-		$disabled_date = trim( $disabled_date );
27
+        $disabled_date = trim( $disabled_date );
28 28
 
29
-		if ( false === strpos( $disabled_date, '|' ) ) {
30
-			$disable_dates[] = $disabled_date;
31
-			continue;
32
-		}
29
+        if ( false === strpos( $disabled_date, '|' ) ) {
30
+            $disable_dates[] = $disabled_date;
31
+            continue;
32
+        }
33 33
 
34
-		$disabled_date   = explode( '|', $disabled_date );
35
-		$disable_dates[] = array(
36
-			'from' => trim( $disabled_date[0] ),
37
-			'to'   => trim( $disabled_date[1] ),
38
-		);
34
+        $disabled_date   = explode( '|', $disabled_date );
35
+        $disable_dates[] = array(
36
+            'from' => trim( $disabled_date[0] ),
37
+            'to'   => trim( $disabled_date[1] ),
38
+        );
39 39
 
40
-	}
40
+    }
41 41
 }
42 42
 
43 43
 $options = array(
44
-	'data-default-date'     => empty( $default_date ) ? false : $default_date,
45
-	'data-min-date'         => empty( $min_date ) ? false : $min_date,
46
-	'data-max-date'         => empty( $max_date ) ? false : $max_date,
47
-	'data-mode'             => empty( $mode ) ? 'single' : $mode,
48
-	'data-alt-format'       => get_option( 'date_format', 'F j, Y' ),
49
-	'data-date-format'      => 'Y-m-d',
50
-	'data-alt-input'        => 'true',
51
-	'data-disable_alt'      => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
52
-	'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
44
+    'data-default-date'     => empty( $default_date ) ? false : $default_date,
45
+    'data-min-date'         => empty( $min_date ) ? false : $min_date,
46
+    'data-max-date'         => empty( $max_date ) ? false : $max_date,
47
+    'data-mode'             => empty( $mode ) ? 'single' : $mode,
48
+    'data-alt-format'       => get_option( 'date_format', 'F j, Y' ),
49
+    'data-date-format'      => 'Y-m-d',
50
+    'data-alt-input'        => 'true',
51
+    'data-disable_alt'      => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
52
+    'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
53 53
 );
54 54
 
55 55
 aui()->input(
56
-	array(
57
-		'name'             => esc_attr( $id ),
58
-		'id'               => esc_attr( $element_id ),
59
-		'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
60
-		'required'         => ! empty( $required ),
61
-		'label'            => $label,
62
-		'label_type'       => 'vertical',
63
-		'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
64
-		'type'             => 'datepicker',
65
-		'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
66
-		'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
67
-		'value'            => $query_value,
68
-	),
69
-	true
56
+    array(
57
+        'name'             => esc_attr( $id ),
58
+        'id'               => esc_attr( $element_id ),
59
+        'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
60
+        'required'         => ! empty( $required ),
61
+        'label'            => $label,
62
+        'label_type'       => 'vertical',
63
+        'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
64
+        'type'             => 'datepicker',
65
+        'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
66
+        'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
67
+        'value'            => $query_value,
68
+    ),
69
+    true
70 70
 );
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,63 +7,63 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label       = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
14
-if ( ! empty( $required ) ) {
12
+$label       = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14
+if (!empty($required)) {
15 15
 	$label .= "<span class='text-danger'> *</span>";
16 16
 }
17 17
 
18 18
 $disable_dates = array();
19 19
 
20
-if ( ! empty( $disabled_dates ) ) {
21
-	$disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
-	$disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
-	$disabled_dates = array_filter( explode( ',', $disabled_dates ) );
20
+if (!empty($disabled_dates)) {
21
+	$disabled_dates = preg_replace('/\s+/', '', $disabled_dates);
22
+	$disabled_dates = str_ireplace('today', current_time('Y-m-d'), $disabled_dates);
23
+	$disabled_dates = array_filter(explode(',', $disabled_dates));
24 24
 
25
-	foreach ( $disabled_dates as $disabled_date ) {
25
+	foreach ($disabled_dates as $disabled_date) {
26 26
 
27
-		$disabled_date = trim( $disabled_date );
27
+		$disabled_date = trim($disabled_date);
28 28
 
29
-		if ( false === strpos( $disabled_date, '|' ) ) {
29
+		if (false === strpos($disabled_date, '|')) {
30 30
 			$disable_dates[] = $disabled_date;
31 31
 			continue;
32 32
 		}
33 33
 
34
-		$disabled_date   = explode( '|', $disabled_date );
34
+		$disabled_date   = explode('|', $disabled_date);
35 35
 		$disable_dates[] = array(
36
-			'from' => trim( $disabled_date[0] ),
37
-			'to'   => trim( $disabled_date[1] ),
36
+			'from' => trim($disabled_date[0]),
37
+			'to'   => trim($disabled_date[1]),
38 38
 		);
39 39
 
40 40
 	}
41 41
 }
42 42
 
43 43
 $options = array(
44
-	'data-default-date'     => empty( $default_date ) ? false : $default_date,
45
-	'data-min-date'         => empty( $min_date ) ? false : $min_date,
46
-	'data-max-date'         => empty( $max_date ) ? false : $max_date,
47
-	'data-mode'             => empty( $mode ) ? 'single' : $mode,
48
-	'data-alt-format'       => get_option( 'date_format', 'F j, Y' ),
44
+	'data-default-date'     => empty($default_date) ? false : $default_date,
45
+	'data-min-date'         => empty($min_date) ? false : $min_date,
46
+	'data-max-date'         => empty($max_date) ? false : $max_date,
47
+	'data-mode'             => empty($mode) ? 'single' : $mode,
48
+	'data-alt-format'       => get_option('date_format', 'F j, Y'),
49 49
 	'data-date-format'      => 'Y-m-d',
50 50
 	'data-alt-input'        => 'true',
51
-	'data-disable_alt'      => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
52
-	'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
51
+	'data-disable_alt'      => empty($disabled_dates) ? false : wp_json_encode($disable_dates),
52
+	'data-disable_days_alt' => empty($disable_days) ? false : wp_json_encode(wp_parse_id_list($disable_days)),
53 53
 );
54 54
 
55 55
 aui()->input(
56 56
 	array(
57
-		'name'             => esc_attr( $id ),
58
-		'id'               => esc_attr( $element_id ),
59
-		'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
60
-		'required'         => ! empty( $required ),
57
+		'name'             => esc_attr($id),
58
+		'id'               => esc_attr($element_id),
59
+		'placeholder'      => empty($placeholder) ? '' : esc_attr($placeholder),
60
+		'required'         => !empty($required),
61 61
 		'label'            => $label,
62 62
 		'label_type'       => 'vertical',
63
-		'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
63
+		'help_text'        => empty($description) ? '' : wp_kses_post($description),
64 64
 		'type'             => 'datepicker',
65 65
 		'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
66
-		'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
66
+		'extra_attributes' => array_filter(apply_filters('getpaid_date_field_attributes', $options)),
67 67
 		'value'            => $query_value,
68 68
 	),
69 69
 	true
Please login to merge, or discard this patch.
includes/admin/class-getpaid-installer.php 2 patches
Indentation   +384 added lines, -384 removed lines patch added patch discarded remove patch
@@ -20,237 +20,237 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class GetPaid_Installer {
22 22
 
23
-	/**
24
-	 * Upgrades the install.
25
-	 *
26
-	 * @param string $upgrade_from The current invoicing version.
27
-	 */
28
-	public function upgrade_db( $upgrade_from ) {
29
-
30
-		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
32
-
33
-		// Setup the invoice Custom Post Type.
34
-		GetPaid_Post_Types::register_post_types();
35
-
36
-		// Clear the permalinks
37
-		flush_rewrite_rules();
38
-
39
-		// Maybe create new/missing pages.
40
-		$this->create_pages();
41
-
42
-		// Maybe re(add) admin capabilities.
43
-		$this->add_capabilities();
44
-
45
-		// Maybe create the default payment form.
46
-		wpinv_get_default_payment_form();
47
-
48
-		// Create any missing database tables.
49
-		$method = "upgrade_from_$upgrade_from";
50
-
51
-		$installed = get_option( 'gepaid_installed_on' );
52
-
53
-		if ( empty( $installed ) ) {
54
-			update_option( 'gepaid_installed_on', time() );
55
-		}
56
-
57
-		if ( method_exists( $this, $method ) ) {
58
-			$this->$method();
59
-		}
60
-
61
-	}
62
-
63
-	/**
64
-	 * Do a fresh install.
65
-	 *
66
-	 */
67
-	public function upgrade_from_0() {
68
-		$this->create_subscriptions_table();
69
-		$this->create_invoices_table();
70
-		$this->create_invoice_items_table();
71
-
72
-		// Save default tax rates.
73
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
74
-	}
75
-
76
-	/**
77
-	 * Upgrade to 0.0.5
78
-	 *
79
-	 */
80
-	public function upgrade_from_004() {
81
-		global $wpdb;
82
-
83
-		// Invoices.
84
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
-		if ( ! empty( $results ) ) {
86
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
87
-
88
-			// Clean post cache
89
-			foreach ( $results as $row ) {
90
-				clean_post_cache( $row->ID );
91
-			}
92
-		}
93
-
94
-		// Item meta key changes
95
-		$query = 'SELECT DISTINCT post_id FROM ' . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
96
-		$results = $wpdb->get_results( $query );
97
-
98
-		if ( ! empty( $results ) ) {
99
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
100
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
101
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
102
-
103
-			foreach ( $results as $row ) {
104
-				clean_post_cache( $row->post_id );
105
-			}
106
-		}
107
-
108
-		$this->upgrade_from_102();
109
-	}
110
-
111
-	/**
112
-	 * Upgrade to 1.0.3
113
-	 *
114
-	 */
115
-	public function upgrade_from_102() {
116
-		$this->create_subscriptions_table();
117
-		$this->upgrade_from_118();
118
-	}
119
-
120
-	/**
121
-	 * Upgrade to version 2.0.0.
122
-	 *
123
-	 */
124
-	public function upgrade_from_118() {
125
-		$this->create_invoices_table();
126
-		$this->create_invoice_items_table();
127
-		$this->migrate_old_invoices();
128
-	}
129
-
130
-	/**
131
-	 * Upgrade to version 2.0.8.
132
-	 *
133
-	 */
134
-	public function upgrade_from_207() {
135
-		global $wpdb;
136
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
137
-		$this->upgrade_from_2615();
138
-	}
139
-
140
-	/**
141
-	 * Upgrade to version 2.6.16.
142
-	 *
143
-	 */
144
-	public function upgrade_from_2615() {
145
-		global $wpdb;
146
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN item_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY custom_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY price DECIMAL(16,4) NOT NULL DEFAULT '0';" );
147
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoices MODIFY COLUMN subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY tax DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY fees_total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0';" );
148
-	}
149
-
150
-	/**
151
-	 * Give administrators the capability to manage GetPaid.
152
-	 *
153
-	 */
154
-	public function add_capabilities() {
155
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
156
-	}
157
-
158
-	/**
159
-	 * Retreives GetPaid pages.
160
-	 *
161
-	 */
162
-	public static function get_pages() {
163
-
164
-		return apply_filters(
165
-			'wpinv_create_pages',
166
-			array(
167
-
168
-				// Checkout page.
169
-				'checkout_page'             => array(
170
-					'name'    => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
171
-					'title'   => _x( 'Checkout', 'Page title', 'invoicing' ),
172
-					'content' => '
23
+    /**
24
+     * Upgrades the install.
25
+     *
26
+     * @param string $upgrade_from The current invoicing version.
27
+     */
28
+    public function upgrade_db( $upgrade_from ) {
29
+
30
+        // Save the current invoicing version.
31
+        update_option( 'wpinv_version', WPINV_VERSION );
32
+
33
+        // Setup the invoice Custom Post Type.
34
+        GetPaid_Post_Types::register_post_types();
35
+
36
+        // Clear the permalinks
37
+        flush_rewrite_rules();
38
+
39
+        // Maybe create new/missing pages.
40
+        $this->create_pages();
41
+
42
+        // Maybe re(add) admin capabilities.
43
+        $this->add_capabilities();
44
+
45
+        // Maybe create the default payment form.
46
+        wpinv_get_default_payment_form();
47
+
48
+        // Create any missing database tables.
49
+        $method = "upgrade_from_$upgrade_from";
50
+
51
+        $installed = get_option( 'gepaid_installed_on' );
52
+
53
+        if ( empty( $installed ) ) {
54
+            update_option( 'gepaid_installed_on', time() );
55
+        }
56
+
57
+        if ( method_exists( $this, $method ) ) {
58
+            $this->$method();
59
+        }
60
+
61
+    }
62
+
63
+    /**
64
+     * Do a fresh install.
65
+     *
66
+     */
67
+    public function upgrade_from_0() {
68
+        $this->create_subscriptions_table();
69
+        $this->create_invoices_table();
70
+        $this->create_invoice_items_table();
71
+
72
+        // Save default tax rates.
73
+        update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
74
+    }
75
+
76
+    /**
77
+     * Upgrade to 0.0.5
78
+     *
79
+     */
80
+    public function upgrade_from_004() {
81
+        global $wpdb;
82
+
83
+        // Invoices.
84
+        $results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
+        if ( ! empty( $results ) ) {
86
+            $wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
87
+
88
+            // Clean post cache
89
+            foreach ( $results as $row ) {
90
+                clean_post_cache( $row->ID );
91
+            }
92
+        }
93
+
94
+        // Item meta key changes
95
+        $query = 'SELECT DISTINCT post_id FROM ' . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
96
+        $results = $wpdb->get_results( $query );
97
+
98
+        if ( ! empty( $results ) ) {
99
+            $wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
100
+            $wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
101
+            $wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
102
+
103
+            foreach ( $results as $row ) {
104
+                clean_post_cache( $row->post_id );
105
+            }
106
+        }
107
+
108
+        $this->upgrade_from_102();
109
+    }
110
+
111
+    /**
112
+     * Upgrade to 1.0.3
113
+     *
114
+     */
115
+    public function upgrade_from_102() {
116
+        $this->create_subscriptions_table();
117
+        $this->upgrade_from_118();
118
+    }
119
+
120
+    /**
121
+     * Upgrade to version 2.0.0.
122
+     *
123
+     */
124
+    public function upgrade_from_118() {
125
+        $this->create_invoices_table();
126
+        $this->create_invoice_items_table();
127
+        $this->migrate_old_invoices();
128
+    }
129
+
130
+    /**
131
+     * Upgrade to version 2.0.8.
132
+     *
133
+     */
134
+    public function upgrade_from_207() {
135
+        global $wpdb;
136
+        $wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
137
+        $this->upgrade_from_2615();
138
+    }
139
+
140
+    /**
141
+     * Upgrade to version 2.6.16.
142
+     *
143
+     */
144
+    public function upgrade_from_2615() {
145
+        global $wpdb;
146
+        $wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN item_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY custom_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY price DECIMAL(16,4) NOT NULL DEFAULT '0';" );
147
+        $wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoices MODIFY COLUMN subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY tax DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY fees_total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0';" );
148
+    }
149
+
150
+    /**
151
+     * Give administrators the capability to manage GetPaid.
152
+     *
153
+     */
154
+    public function add_capabilities() {
155
+        $GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
156
+    }
157
+
158
+    /**
159
+     * Retreives GetPaid pages.
160
+     *
161
+     */
162
+    public static function get_pages() {
163
+
164
+        return apply_filters(
165
+            'wpinv_create_pages',
166
+            array(
167
+
168
+                // Checkout page.
169
+                'checkout_page'             => array(
170
+                    'name'    => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
171
+                    'title'   => _x( 'Checkout', 'Page title', 'invoicing' ),
172
+                    'content' => '
173 173
 						<!-- wp:shortcode -->
174 174
 						[wpinv_checkout]
175 175
 						<!-- /wp:shortcode -->
176 176
 					',
177
-					'parent'  => '',
178
-				),
179
-
180
-				// Invoice history page.
181
-				'invoice_history_page'      => array(
182
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
183
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
184
-					'content' => '
177
+                    'parent'  => '',
178
+                ),
179
+
180
+                // Invoice history page.
181
+                'invoice_history_page'      => array(
182
+                    'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
183
+                    'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
184
+                    'content' => '
185 185
 					<!-- wp:shortcode -->
186 186
 					[wpinv_history]
187 187
 					<!-- /wp:shortcode -->
188 188
 				',
189
-					'parent'  => '',
190
-				),
191
-
192
-				// Success page content.
193
-				'success_page'              => array(
194
-					'name'    => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
195
-					'title'   => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
196
-					'content' => '
189
+                    'parent'  => '',
190
+                ),
191
+
192
+                // Success page content.
193
+                'success_page'              => array(
194
+                    'name'    => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
195
+                    'title'   => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
196
+                    'content' => '
197 197
 					<!-- wp:shortcode -->
198 198
 					[wpinv_receipt]
199 199
 					<!-- /wp:shortcode -->
200 200
 				',
201
-					'parent'  => 'gp-checkout',
202
-				),
203
-
204
-				// Failure page content.
205
-				'failure_page'              => array(
206
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
207
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
208
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
209
-					'parent'  => 'gp-checkout',
210
-				),
211
-
212
-				// Subscriptions history page.
213
-				'invoice_subscription_page' => array(
214
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
215
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
216
-					'content' => '
201
+                    'parent'  => 'gp-checkout',
202
+                ),
203
+
204
+                // Failure page content.
205
+                'failure_page'              => array(
206
+                    'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
207
+                    'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
208
+                    'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
209
+                    'parent'  => 'gp-checkout',
210
+                ),
211
+
212
+                // Subscriptions history page.
213
+                'invoice_subscription_page' => array(
214
+                    'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
215
+                    'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
216
+                    'content' => '
217 217
 					<!-- wp:shortcode -->
218 218
 					[wpinv_subscriptions]
219 219
 					<!-- /wp:shortcode -->
220 220
 				',
221
-					'parent'  => '',
222
-				),
221
+                    'parent'  => '',
222
+                ),
223 223
 
224
-			)
225
-		);
224
+            )
225
+        );
226 226
 
227
-	}
227
+    }
228 228
 
229
-	/**
230
-	 * Re-create GetPaid pages.
231
-	 *
232
-	 */
233
-	public function create_pages() {
229
+    /**
230
+     * Re-create GetPaid pages.
231
+     *
232
+     */
233
+    public function create_pages() {
234 234
 
235
-		foreach ( self::get_pages() as $key => $page ) {
236
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
237
-		}
235
+        foreach ( self::get_pages() as $key => $page ) {
236
+            wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
237
+        }
238 238
 
239
-	}
239
+    }
240 240
 
241
-	/**
242
-	 * Create subscriptions table.
243
-	 *
244
-	 */
245
-	public function create_subscriptions_table() {
241
+    /**
242
+     * Create subscriptions table.
243
+     *
244
+     */
245
+    public function create_subscriptions_table() {
246 246
 
247
-		global $wpdb;
247
+        global $wpdb;
248 248
 
249
-		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
249
+        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
250 250
 
251
-		// Create tables.
252
-		$charset_collate = $wpdb->get_charset_collate();
253
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
251
+        // Create tables.
252
+        $charset_collate = $wpdb->get_charset_collate();
253
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
254 254
 			id bigint(20) unsigned NOT NULL auto_increment,
255 255
 			customer_id bigint(20) NOT NULL,
256 256
 			frequency int(11) NOT NULL DEFAULT '1',
@@ -273,22 +273,22 @@  discard block
 block discarded – undo
273 273
 			KEY customer_and_status (customer_id, status)
274 274
 		  ) $charset_collate;";
275 275
 
276
-		dbDelta( $sql );
276
+        dbDelta( $sql );
277 277
 
278
-	}
278
+    }
279 279
 
280
-	/**
281
-	 * Create invoices table.
282
-	 *
283
-	 */
284
-	public function create_invoices_table() {
285
-		global $wpdb;
280
+    /**
281
+     * Create invoices table.
282
+     *
283
+     */
284
+    public function create_invoices_table() {
285
+        global $wpdb;
286 286
 
287
-		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
287
+        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
288 288
 
289
-		// Create tables.
290
-		$charset_collate = $wpdb->get_charset_collate();
291
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
289
+        // Create tables.
290
+        $charset_collate = $wpdb->get_charset_collate();
291
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
292 292
 			post_id BIGINT(20) NOT NULL,
293 293
             `number` VARCHAR(100),
294 294
             `key` VARCHAR(100),
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 			KEY `key` (`key`)
325 325
 		  ) $charset_collate;";
326 326
 
327
-		dbDelta( $sql );
327
+        dbDelta( $sql );
328 328
 
329
-	}
329
+    }
330 330
 
331
-	/**
332
-	 * Create invoice items table.
333
-	 *
334
-	 */
335
-	public function create_invoice_items_table() {
336
-		global $wpdb;
331
+    /**
332
+     * Create invoice items table.
333
+     *
334
+     */
335
+    public function create_invoice_items_table() {
336
+        global $wpdb;
337 337
 
338
-		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
338
+        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
339 339
 
340
-		// Create tables.
341
-		$charset_collate = $wpdb->get_charset_collate();
342
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
340
+        // Create tables.
341
+        $charset_collate = $wpdb->get_charset_collate();
342
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
343 343
 			ID BIGINT(20) NOT NULL AUTO_INCREMENT,
344 344
             post_id BIGINT(20) NOT NULL,
345 345
             item_id BIGINT(20) NOT NULL,
@@ -361,159 +361,159 @@  discard block
 block discarded – undo
361 361
 			KEY post_id (post_id)
362 362
 		  ) $charset_collate;";
363 363
 
364
-		dbDelta( $sql );
365
-
366
-	}
367
-
368
-	/**
369
-	 * Migrates old invoices to new invoices.
370
-	 *
371
-	 */
372
-	public function migrate_old_invoices() {
373
-		global $wpdb;
374
-
375
-		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
376
-		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
377
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
378
-		$invoices            = array_unique(
379
-			get_posts(
380
-				array(
381
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
382
-					'posts_per_page' => -1,
383
-					'fields'         => 'ids',
384
-					'post_status'    => array_keys( get_post_stati() ),
385
-					'exclude'        => (array) $migrated,
386
-				)
387
-			)
388
-		);
389
-
390
-		// Abort if we do not have any invoices.
391
-		if ( empty( $invoices ) ) {
392
-			return;
393
-		}
394
-
395
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php';
396
-
397
-		$invoice_rows = array();
398
-		foreach ( $invoices as $invoice ) {
399
-
400
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
401
-
402
-			if ( empty( $invoice->ID ) ) {
403
-				return;
404
-			}
405
-
406
-			$fields = array(
407
-				'post_id'            => $invoice->ID,
408
-				'number'             => $invoice->get_number(),
409
-				'key'                => $invoice->get_key(),
410
-				'type'               => str_replace( 'wpi_', '', $invoice->post_type ),
411
-				'mode'               => $invoice->mode,
412
-				'user_ip'            => $invoice->get_ip(),
413
-				'first_name'         => $invoice->get_first_name(),
414
-				'last_name'          => $invoice->get_last_name(),
415
-				'address'            => $invoice->get_address(),
416
-				'city'               => $invoice->city,
417
-				'state'              => $invoice->state,
418
-				'country'            => $invoice->country,
419
-				'zip'                => $invoice->zip,
420
-				'adddress_confirmed' => (int) $invoice->adddress_confirmed,
421
-				'gateway'            => $invoice->get_gateway(),
422
-				'transaction_id'     => $invoice->get_transaction_id(),
423
-				'currency'           => $invoice->get_currency(),
424
-				'subtotal'           => $invoice->get_subtotal(),
425
-				'tax'                => $invoice->get_tax(),
426
-				'fees_total'         => $invoice->get_fees_total(),
427
-				'total'              => $invoice->get_total(),
428
-				'discount'           => $invoice->get_discount(),
429
-				'discount_code'      => $invoice->get_discount_code(),
430
-				'disable_taxes'      => $invoice->disable_taxes,
431
-				'due_date'           => $invoice->get_due_date(),
432
-				'completed_date'     => $invoice->get_completed_date(),
433
-				'company'            => $invoice->company,
434
-				'vat_number'         => $invoice->vat_number,
435
-				'vat_rate'           => $invoice->vat_rate,
436
-				'custom_meta'        => $invoice->payment_meta,
437
-			);
438
-
439
-			foreach ( $fields as $key => $val ) {
440
-				if ( is_null( $val ) ) {
441
-					$val = '';
442
-				}
443
-				$val = maybe_serialize( $val );
444
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
445
-			}
446
-
447
-			$fields = implode( ', ', $fields );
448
-			$invoice_rows[] = "($fields)";
449
-
450
-			$item_rows    = array();
451
-			$item_columns = array();
452
-			foreach ( $invoice->get_cart_details() as $details ) {
453
-				$fields = array(
454
-					'post_id'          => $invoice->ID,
455
-					'item_id'          => $details['id'],
456
-					'item_name'        => $details['name'],
457
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
458
-					'vat_rate'         => $details['vat_rate'],
459
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
460
-					'tax'              => $details['tax'],
461
-					'item_price'       => $details['item_price'],
462
-					'custom_price'     => $details['custom_price'],
463
-					'quantity'         => $details['quantity'],
464
-					'discount'         => $details['discount'],
465
-					'subtotal'         => $details['subtotal'],
466
-					'price'            => $details['price'],
467
-					'meta'             => $details['meta'],
468
-					'fees'             => $details['fees'],
469
-				);
470
-
471
-				$item_columns = array_keys( $fields );
472
-
473
-				foreach ( $fields as $key => $val ) {
474
-					if ( is_null( $val ) ) {
475
-						$val = '';
476
-					}
477
-					$val = maybe_serialize( $val );
478
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
479
-				}
480
-
481
-				$fields = implode( ', ', $fields );
482
-				$item_rows[] = "($fields)";
483
-			}
484
-
485
-			$item_rows    = implode( ', ', $item_rows );
486
-			$item_columns = implode( ', ', $item_columns );
487
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
488
-		}
489
-
490
-		if ( empty( $invoice_rows ) ) {
491
-			return;
492
-		}
493
-
494
-		$invoice_rows = implode( ', ', $invoice_rows );
495
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
496
-
497
-	}
498
-
499
-	/**
500
-	 * Migrates old invoices to new invoices.
501
-	 *
502
-	 */
503
-	public static function rename_gateways_label() {
504
-		global $wpdb;
505
-
506
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
507
-
508
-			$wpdb->update(
509
-				$wpdb->prefix . 'getpaid_invoices',
510
-				array( 'gateway' => $gateway ),
511
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
512
-				'%s',
513
-				'%s'
514
-			);
515
-
516
-		}
517
-	}
364
+        dbDelta( $sql );
365
+
366
+    }
367
+
368
+    /**
369
+     * Migrates old invoices to new invoices.
370
+     *
371
+     */
372
+    public function migrate_old_invoices() {
373
+        global $wpdb;
374
+
375
+        $invoices_table      = $wpdb->prefix . 'getpaid_invoices';
376
+        $invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
377
+        $migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
378
+        $invoices            = array_unique(
379
+            get_posts(
380
+                array(
381
+                    'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
382
+                    'posts_per_page' => -1,
383
+                    'fields'         => 'ids',
384
+                    'post_status'    => array_keys( get_post_stati() ),
385
+                    'exclude'        => (array) $migrated,
386
+                )
387
+            )
388
+        );
389
+
390
+        // Abort if we do not have any invoices.
391
+        if ( empty( $invoices ) ) {
392
+            return;
393
+        }
394
+
395
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php';
396
+
397
+        $invoice_rows = array();
398
+        foreach ( $invoices as $invoice ) {
399
+
400
+            $invoice = new WPInv_Legacy_Invoice( $invoice );
401
+
402
+            if ( empty( $invoice->ID ) ) {
403
+                return;
404
+            }
405
+
406
+            $fields = array(
407
+                'post_id'            => $invoice->ID,
408
+                'number'             => $invoice->get_number(),
409
+                'key'                => $invoice->get_key(),
410
+                'type'               => str_replace( 'wpi_', '', $invoice->post_type ),
411
+                'mode'               => $invoice->mode,
412
+                'user_ip'            => $invoice->get_ip(),
413
+                'first_name'         => $invoice->get_first_name(),
414
+                'last_name'          => $invoice->get_last_name(),
415
+                'address'            => $invoice->get_address(),
416
+                'city'               => $invoice->city,
417
+                'state'              => $invoice->state,
418
+                'country'            => $invoice->country,
419
+                'zip'                => $invoice->zip,
420
+                'adddress_confirmed' => (int) $invoice->adddress_confirmed,
421
+                'gateway'            => $invoice->get_gateway(),
422
+                'transaction_id'     => $invoice->get_transaction_id(),
423
+                'currency'           => $invoice->get_currency(),
424
+                'subtotal'           => $invoice->get_subtotal(),
425
+                'tax'                => $invoice->get_tax(),
426
+                'fees_total'         => $invoice->get_fees_total(),
427
+                'total'              => $invoice->get_total(),
428
+                'discount'           => $invoice->get_discount(),
429
+                'discount_code'      => $invoice->get_discount_code(),
430
+                'disable_taxes'      => $invoice->disable_taxes,
431
+                'due_date'           => $invoice->get_due_date(),
432
+                'completed_date'     => $invoice->get_completed_date(),
433
+                'company'            => $invoice->company,
434
+                'vat_number'         => $invoice->vat_number,
435
+                'vat_rate'           => $invoice->vat_rate,
436
+                'custom_meta'        => $invoice->payment_meta,
437
+            );
438
+
439
+            foreach ( $fields as $key => $val ) {
440
+                if ( is_null( $val ) ) {
441
+                    $val = '';
442
+                }
443
+                $val = maybe_serialize( $val );
444
+                $fields[ $key ] = $wpdb->prepare( '%s', $val );
445
+            }
446
+
447
+            $fields = implode( ', ', $fields );
448
+            $invoice_rows[] = "($fields)";
449
+
450
+            $item_rows    = array();
451
+            $item_columns = array();
452
+            foreach ( $invoice->get_cart_details() as $details ) {
453
+                $fields = array(
454
+                    'post_id'          => $invoice->ID,
455
+                    'item_id'          => $details['id'],
456
+                    'item_name'        => $details['name'],
457
+                    'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
458
+                    'vat_rate'         => $details['vat_rate'],
459
+                    'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
460
+                    'tax'              => $details['tax'],
461
+                    'item_price'       => $details['item_price'],
462
+                    'custom_price'     => $details['custom_price'],
463
+                    'quantity'         => $details['quantity'],
464
+                    'discount'         => $details['discount'],
465
+                    'subtotal'         => $details['subtotal'],
466
+                    'price'            => $details['price'],
467
+                    'meta'             => $details['meta'],
468
+                    'fees'             => $details['fees'],
469
+                );
470
+
471
+                $item_columns = array_keys( $fields );
472
+
473
+                foreach ( $fields as $key => $val ) {
474
+                    if ( is_null( $val ) ) {
475
+                        $val = '';
476
+                    }
477
+                    $val = maybe_serialize( $val );
478
+                    $fields[ $key ] = $wpdb->prepare( '%s', $val );
479
+                }
480
+
481
+                $fields = implode( ', ', $fields );
482
+                $item_rows[] = "($fields)";
483
+            }
484
+
485
+            $item_rows    = implode( ', ', $item_rows );
486
+            $item_columns = implode( ', ', $item_columns );
487
+            $wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
488
+        }
489
+
490
+        if ( empty( $invoice_rows ) ) {
491
+            return;
492
+        }
493
+
494
+        $invoice_rows = implode( ', ', $invoice_rows );
495
+        $wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
496
+
497
+    }
498
+
499
+    /**
500
+     * Migrates old invoices to new invoices.
501
+     *
502
+     */
503
+    public static function rename_gateways_label() {
504
+        global $wpdb;
505
+
506
+        foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
507
+
508
+            $wpdb->update(
509
+                $wpdb->prefix . 'getpaid_invoices',
510
+                array( 'gateway' => $gateway ),
511
+                array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
512
+                '%s',
513
+                '%s'
514
+            );
515
+
516
+        }
517
+    }
518 518
 
519 519
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since   2.0.2
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 /**
14 14
  * The main installer/updater class.
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param string $upgrade_from The current invoicing version.
27 27
 	 */
28
-	public function upgrade_db( $upgrade_from ) {
28
+	public function upgrade_db($upgrade_from) {
29 29
 
30 30
 		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
31
+		update_option('wpinv_version', WPINV_VERSION);
32 32
 
33 33
 		// Setup the invoice Custom Post Type.
34 34
 		GetPaid_Post_Types::register_post_types();
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		// Create any missing database tables.
49 49
 		$method = "upgrade_from_$upgrade_from";
50 50
 
51
-		$installed = get_option( 'gepaid_installed_on' );
51
+		$installed = get_option('gepaid_installed_on');
52 52
 
53
-		if ( empty( $installed ) ) {
54
-			update_option( 'gepaid_installed_on', time() );
53
+		if (empty($installed)) {
54
+			update_option('gepaid_installed_on', time());
55 55
 		}
56 56
 
57
-		if ( method_exists( $this, $method ) ) {
57
+		if (method_exists($this, $method)) {
58 58
 			$this->$method();
59 59
 		}
60 60
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$this->create_invoice_items_table();
71 71
 
72 72
 		// Save default tax rates.
73
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
73
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
74 74
 	}
75 75
 
76 76
 	/**
@@ -81,27 +81,27 @@  discard block
 block discarded – undo
81 81
 		global $wpdb;
82 82
 
83 83
 		// Invoices.
84
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
85
-		if ( ! empty( $results ) ) {
86
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
84
+		$results = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
85
+		if (!empty($results)) {
86
+			$wpdb->query("UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
87 87
 
88 88
 			// Clean post cache
89
-			foreach ( $results as $row ) {
90
-				clean_post_cache( $row->ID );
89
+			foreach ($results as $row) {
90
+				clean_post_cache($row->ID);
91 91
 			}
92 92
 		}
93 93
 
94 94
 		// Item meta key changes
95 95
 		$query = 'SELECT DISTINCT post_id FROM ' . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
96
-		$results = $wpdb->get_results( $query );
96
+		$results = $wpdb->get_results($query);
97 97
 
98
-		if ( ! empty( $results ) ) {
99
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
100
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
101
-			$wpdb->query( 'UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
98
+		if (!empty($results)) {
99
+			$wpdb->query('UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )");
100
+			$wpdb->query('UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'");
101
+			$wpdb->query('UPDATE ' . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'");
102 102
 
103
-			foreach ( $results as $row ) {
104
-				clean_post_cache( $row->post_id );
103
+			foreach ($results as $row) {
104
+				clean_post_cache($row->post_id);
105 105
 			}
106 106
 		}
107 107
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function upgrade_from_207() {
135 135
 		global $wpdb;
136
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
136
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);");
137 137
 		$this->upgrade_from_2615();
138 138
 	}
139 139
 
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function upgrade_from_2615() {
145 145
 		global $wpdb;
146
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN item_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY custom_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY price DECIMAL(16,4) NOT NULL DEFAULT '0';" );
147
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoices MODIFY COLUMN subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY tax DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY fees_total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0';" );
146
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN item_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY custom_price DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY price DECIMAL(16,4) NOT NULL DEFAULT '0';");
147
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}getpaid_invoices MODIFY COLUMN subtotal DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY tax DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY fees_total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY total DECIMAL(16,4) NOT NULL DEFAULT '0', MODIFY discount DECIMAL(16,4) NOT NULL DEFAULT '0';");
148 148
 	}
149 149
 
150 150
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 */
154 154
 	public function add_capabilities() {
155
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
155
+		$GLOBALS['wp_roles']->add_cap('administrator', 'manage_invoicing');
156 156
 	}
157 157
 
158 158
 	/**
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 
168 168
 				// Checkout page.
169 169
 				'checkout_page'             => array(
170
-					'name'    => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
171
-					'title'   => _x( 'Checkout', 'Page title', 'invoicing' ),
170
+					'name'    => _x('gp-checkout', 'Page slug', 'invoicing'),
171
+					'title'   => _x('Checkout', 'Page title', 'invoicing'),
172 172
 					'content' => '
173 173
 						<!-- wp:shortcode -->
174 174
 						[wpinv_checkout]
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 
180 180
 				// Invoice history page.
181 181
 				'invoice_history_page'      => array(
182
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
183
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
182
+					'name'    => _x('gp-invoices', 'Page slug', 'invoicing'),
183
+					'title'   => _x('My Invoices', 'Page title', 'invoicing'),
184 184
 					'content' => '
185 185
 					<!-- wp:shortcode -->
186 186
 					[wpinv_history]
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 
192 192
 				// Success page content.
193 193
 				'success_page'              => array(
194
-					'name'    => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
195
-					'title'   => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
194
+					'name'    => _x('gp-receipt', 'Page slug', 'invoicing'),
195
+					'title'   => _x('Payment Confirmation', 'Page title', 'invoicing'),
196 196
 					'content' => '
197 197
 					<!-- wp:shortcode -->
198 198
 					[wpinv_receipt]
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 
204 204
 				// Failure page content.
205 205
 				'failure_page'              => array(
206
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
207
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
208
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
206
+					'name'    => _x('gp-transaction-failed', 'Page slug', 'invoicing'),
207
+					'title'   => _x('Transaction Failed', 'Page title', 'invoicing'),
208
+					'content' => __('Your transaction failed, please try again or contact site support.', 'invoicing'),
209 209
 					'parent'  => 'gp-checkout',
210 210
 				),
211 211
 
212 212
 				// Subscriptions history page.
213 213
 				'invoice_subscription_page' => array(
214
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
215
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
214
+					'name'    => _x('gp-subscriptions', 'Page slug', 'invoicing'),
215
+					'title'   => _x('My Subscriptions', 'Page title', 'invoicing'),
216 216
 					'content' => '
217 217
 					<!-- wp:shortcode -->
218 218
 					[wpinv_subscriptions]
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function create_pages() {
234 234
 
235
-		foreach ( self::get_pages() as $key => $page ) {
236
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
235
+		foreach (self::get_pages() as $key => $page) {
236
+			wpinv_create_page(esc_sql($page['name']), $key, $page['title'], $page['content'], $page['parent']);
237 237
 		}
238 238
 
239 239
 	}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			KEY customer_and_status (customer_id, status)
274 274
 		  ) $charset_collate;";
275 275
 
276
-		dbDelta( $sql );
276
+		dbDelta($sql);
277 277
 
278 278
 	}
279 279
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			KEY `key` (`key`)
325 325
 		  ) $charset_collate;";
326 326
 
327
-		dbDelta( $sql );
327
+		dbDelta($sql);
328 328
 
329 329
 	}
330 330
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			KEY post_id (post_id)
362 362
 		  ) $charset_collate;";
363 363
 
364
-		dbDelta( $sql );
364
+		dbDelta($sql);
365 365
 
366 366
 	}
367 367
 
@@ -374,32 +374,32 @@  discard block
 block discarded – undo
374 374
 
375 375
 		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
376 376
 		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
377
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
377
+		$migrated            = $wpdb->get_col("SELECT post_id FROM $invoices_table");
378 378
 		$invoices            = array_unique(
379 379
 			get_posts(
380 380
 				array(
381
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
381
+					'post_type'      => array('wpi_invoice', 'wpi_quote'),
382 382
 					'posts_per_page' => -1,
383 383
 					'fields'         => 'ids',
384
-					'post_status'    => array_keys( get_post_stati() ),
384
+					'post_status'    => array_keys(get_post_stati()),
385 385
 					'exclude'        => (array) $migrated,
386 386
 				)
387 387
 			)
388 388
 		);
389 389
 
390 390
 		// Abort if we do not have any invoices.
391
-		if ( empty( $invoices ) ) {
391
+		if (empty($invoices)) {
392 392
 			return;
393 393
 		}
394 394
 
395 395
 		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php';
396 396
 
397 397
 		$invoice_rows = array();
398
-		foreach ( $invoices as $invoice ) {
398
+		foreach ($invoices as $invoice) {
399 399
 
400
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
400
+			$invoice = new WPInv_Legacy_Invoice($invoice);
401 401
 
402
-			if ( empty( $invoice->ID ) ) {
402
+			if (empty($invoice->ID)) {
403 403
 				return;
404 404
 			}
405 405
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 				'post_id'            => $invoice->ID,
408 408
 				'number'             => $invoice->get_number(),
409 409
 				'key'                => $invoice->get_key(),
410
-				'type'               => str_replace( 'wpi_', '', $invoice->post_type ),
410
+				'type'               => str_replace('wpi_', '', $invoice->post_type),
411 411
 				'mode'               => $invoice->mode,
412 412
 				'user_ip'            => $invoice->get_ip(),
413 413
 				'first_name'         => $invoice->get_first_name(),
@@ -436,27 +436,27 @@  discard block
 block discarded – undo
436 436
 				'custom_meta'        => $invoice->payment_meta,
437 437
 			);
438 438
 
439
-			foreach ( $fields as $key => $val ) {
440
-				if ( is_null( $val ) ) {
439
+			foreach ($fields as $key => $val) {
440
+				if (is_null($val)) {
441 441
 					$val = '';
442 442
 				}
443
-				$val = maybe_serialize( $val );
444
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
443
+				$val = maybe_serialize($val);
444
+				$fields[$key] = $wpdb->prepare('%s', $val);
445 445
 			}
446 446
 
447
-			$fields = implode( ', ', $fields );
447
+			$fields = implode(', ', $fields);
448 448
 			$invoice_rows[] = "($fields)";
449 449
 
450 450
 			$item_rows    = array();
451 451
 			$item_columns = array();
452
-			foreach ( $invoice->get_cart_details() as $details ) {
452
+			foreach ($invoice->get_cart_details() as $details) {
453 453
 				$fields = array(
454 454
 					'post_id'          => $invoice->ID,
455 455
 					'item_id'          => $details['id'],
456 456
 					'item_name'        => $details['name'],
457
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
457
+					'item_description' => empty($details['meta']['description']) ? '' : $details['meta']['description'],
458 458
 					'vat_rate'         => $details['vat_rate'],
459
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
459
+					'vat_class'        => empty($details['vat_class']) ? '_standard' : $details['vat_class'],
460 460
 					'tax'              => $details['tax'],
461 461
 					'item_price'       => $details['item_price'],
462 462
 					'custom_price'     => $details['custom_price'],
@@ -468,31 +468,31 @@  discard block
 block discarded – undo
468 468
 					'fees'             => $details['fees'],
469 469
 				);
470 470
 
471
-				$item_columns = array_keys( $fields );
471
+				$item_columns = array_keys($fields);
472 472
 
473
-				foreach ( $fields as $key => $val ) {
474
-					if ( is_null( $val ) ) {
473
+				foreach ($fields as $key => $val) {
474
+					if (is_null($val)) {
475 475
 						$val = '';
476 476
 					}
477
-					$val = maybe_serialize( $val );
478
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
477
+					$val = maybe_serialize($val);
478
+					$fields[$key] = $wpdb->prepare('%s', $val);
479 479
 				}
480 480
 
481
-				$fields = implode( ', ', $fields );
481
+				$fields = implode(', ', $fields);
482 482
 				$item_rows[] = "($fields)";
483 483
 			}
484 484
 
485
-			$item_rows    = implode( ', ', $item_rows );
486
-			$item_columns = implode( ', ', $item_columns );
487
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
485
+			$item_rows    = implode(', ', $item_rows);
486
+			$item_columns = implode(', ', $item_columns);
487
+			$wpdb->query("INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows");
488 488
 		}
489 489
 
490
-		if ( empty( $invoice_rows ) ) {
490
+		if (empty($invoice_rows)) {
491 491
 			return;
492 492
 		}
493 493
 
494
-		$invoice_rows = implode( ', ', $invoice_rows );
495
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
494
+		$invoice_rows = implode(', ', $invoice_rows);
495
+		$wpdb->query("INSERT INTO $invoices_table VALUES $invoice_rows");
496 496
 
497 497
 	}
498 498
 
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 	public static function rename_gateways_label() {
504 504
 		global $wpdb;
505 505
 
506
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
506
+		foreach (array_keys(wpinv_get_payment_gateways()) as $gateway) {
507 507
 
508 508
 			$wpdb->update(
509 509
 				$wpdb->prefix . 'getpaid_invoices',
510
-				array( 'gateway' => $gateway ),
511
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
510
+				array('gateway' => $gateway),
511
+				array('gateway' => wpinv_get_gateway_admin_label($gateway)),
512 512
 				'%s',
513 513
 				'%s'
514 514
 			);
Please login to merge, or discard this patch.
includes/reports/class-getpaid-reports-export.php 2 patches
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -12,47 +12,47 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Reports_Export {
14 14
 
15
-	/**
16
-	 * Displays the reports tab.
17
-	 *
18
-	 */
19
-	public function display() {
20
-
21
-		echo "<div class='row mt-4' style='max-width: 920px;' >";
22
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
-			$this->display_post_type_export( $post_type );
24
-		}
25
-		$this->display_subscription_export();
26
-		echo '</div>';
27
-
28
-	}
29
-
30
-	/**
31
-	 * Retrieves the download url.
32
-	 *
33
-	 */
34
-	public function get_download_url( $post_type ) {
35
-
36
-		return wp_nonce_url(
37
-			add_query_arg(
38
-				array(
39
-					'getpaid-admin-action' => 'export_invoices',
40
-					'post_type'            => urlencode( $post_type ),
41
-				)
42
-			),
43
-			'getpaid-nonce',
44
-			'getpaid-nonce'
45
-		);
46
-
47
-	}
48
-
49
-	/**
50
-	 * Displays a single post type export card.
51
-	 *
52
-	 */
53
-	public function display_post_type_export( $post_type ) {
54
-
55
-		?>
15
+    /**
16
+     * Displays the reports tab.
17
+     *
18
+     */
19
+    public function display() {
20
+
21
+        echo "<div class='row mt-4' style='max-width: 920px;' >";
22
+        foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
+            $this->display_post_type_export( $post_type );
24
+        }
25
+        $this->display_subscription_export();
26
+        echo '</div>';
27
+
28
+    }
29
+
30
+    /**
31
+     * Retrieves the download url.
32
+     *
33
+     */
34
+    public function get_download_url( $post_type ) {
35
+
36
+        return wp_nonce_url(
37
+            add_query_arg(
38
+                array(
39
+                    'getpaid-admin-action' => 'export_invoices',
40
+                    'post_type'            => urlencode( $post_type ),
41
+                )
42
+            ),
43
+            'getpaid-nonce',
44
+            'getpaid-nonce'
45
+        );
46
+
47
+    }
48
+
49
+    /**
50
+     * Displays a single post type export card.
51
+     *
52
+     */
53
+    public function display_post_type_export( $post_type ) {
54
+
55
+        ?>
56 56
 
57 57
 		<div class="col-12 col-md-6">
58 58
 			<div class="card m-0 p-0" style="max-width:100%">
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 				<div class="card-header">
61 61
 					<strong>
62 62
 						<?php
63
-							printf(
64
-								esc_html__( 'Export %s', 'invoicing' ),
65
-								esc_html( getpaid_get_post_type_label( $post_type ) )
66
-							);
67
-						?>
63
+                            printf(
64
+                                esc_html__( 'Export %s', 'invoicing' ),
65
+                                esc_html( getpaid_get_post_type_label( $post_type ) )
66
+                            );
67
+                        ?>
68 68
 					</strong>
69 69
 				</div>
70 70
 
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 					<form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>">
74 74
 
75 75
 						<?php
76
-							$this->generate_from_date( $post_type );
77
-							$this->generate_to_date( $post_type );
78
-							$this->generate_post_status_select( $post_type );
79
-							$this->generate_file_type_select( $post_type );
80
-							submit_button( __( 'Download', 'invoicing' ) );
81
-						?>
76
+                            $this->generate_from_date( $post_type );
77
+                            $this->generate_to_date( $post_type );
78
+                            $this->generate_post_status_select( $post_type );
79
+                            $this->generate_file_type_select( $post_type );
80
+                            submit_button( __( 'Download', 'invoicing' ) );
81
+                        ?>
82 82
 
83 83
 					</form>
84 84
 
@@ -89,135 +89,135 @@  discard block
 block discarded – undo
89 89
 
90 90
 		<?php
91 91
 
92
-	}
93
-
94
-	/**
95
-	 * Generates the from date input field.
96
-	 *
97
-	 */
98
-	public function generate_from_date( $post_type ) {
99
-
100
-		aui()->input(
101
-			array(
102
-				'type'             => 'datepicker',
103
-				'id'               => esc_attr( "$post_type-from_date" ),
104
-				'name'             => 'from_date',
105
-				'label'            => __( 'From Date', 'invoicing' ),
106
-				'label_type'       => 'vertical',
107
-				'placeholder'      => 'YYYY-MM-DD',
108
-				'extra_attributes' => array(
109
-					'data-enable-time' => 'false',
110
-					'data-allow-input' => 'true',
111
-				),
112
-			),
113
-			true
114
-		);
115
-
116
-	}
117
-
118
-	/**
119
-	 * Generates the to date input field.
120
-	 *
121
-	 */
122
-	public function generate_to_date( $post_type ) {
123
-
124
-		aui()->input(
125
-			array(
126
-				'type'             => 'datepicker',
127
-				'id'               => esc_attr( "$post_type-to_date" ),
128
-				'name'             => 'to_date',
129
-				'label'            => __( 'To Date', 'invoicing' ),
130
-				'label_type'       => 'vertical',
131
-				'placeholder'      => 'YYYY-MM-DD',
132
-				'extra_attributes' => array(
133
-					'data-enable-time' => 'false',
134
-					'data-allow-input' => 'true',
135
-				),
136
-			),
137
-			true
138
-		);
139
-	}
140
-
141
-	/**
142
-	 * Generates the to post status select field.
143
-	 *
144
-	 */
145
-	public function generate_post_status_select( $post_type ) {
146
-
147
-		if ( 'subscriptions' === $post_type ) {
148
-			$options = getpaid_get_subscription_statuses();
149
-		} else {
150
-			$options = wpinv_get_invoice_statuses( true, false, $post_type );
151
-		}
152
-
153
-		aui()->select(
154
-			array(
155
-				'name'        => 'status',
156
-				'id'          => esc_attr( "$post_type-status" ),
157
-				'placeholder' => __( 'All Statuses', 'invoicing' ),
158
-				'label'       => __( 'Status', 'invoicing' ),
159
-				'label_type'  => 'vertical',
160
-				'label_class' => 'd-block',
161
-				'options'     => $options,
162
-			),
163
-			true
164
-		);
165
-
166
-	}
167
-
168
-	/**
169
-	 * Generates the to file type select field.
170
-	 *
171
-	 */
172
-	public function generate_file_type_select( $post_type ) {
173
-
174
-		aui()->select(
175
-			array(
176
-				'name'        => 'file_type',
177
-				'id'          => esc_attr( "$post_type-file_type" ),
178
-				'placeholder' => __( 'Select File Type', 'invoicing' ),
179
-				'label'       => __( 'Export File', 'invoicing' ),
180
-				'label_type'  => 'vertical',
181
-				'label_class' => 'd-block',
182
-				'value'       => 'csv',
183
-				'options'     => array(
184
-					'csv'  => __( 'CSV', 'invoicing' ),
185
-					'xml'  => __( 'XML', 'invoicing' ),
186
-					'json' => __( 'JSON', 'invoicing' ),
187
-				),
188
-			),
189
-			true
190
-		);
191
-
192
-	}
193
-
194
-	/**
195
-	 * Displays a field's markup.
196
-	 *
197
-	 */
198
-	public function display_markup( $markup ) {
199
-
200
-		echo wp_kses(
201
-			str_replace(
202
-				array(
203
-					'form-control',
204
-					'custom-select',
205
-				),
206
-				'regular-text',
207
-				$markup
208
-			),
209
-			getpaid_allowed_html()
210
-		);
211
-
212
-	}
213
-
214
-	/**
215
-	 * Displays a subscription export card.
216
-	 *
217
-	 */
218
-	public function display_subscription_export() {
219
-
220
-		?>
92
+    }
93
+
94
+    /**
95
+     * Generates the from date input field.
96
+     *
97
+     */
98
+    public function generate_from_date( $post_type ) {
99
+
100
+        aui()->input(
101
+            array(
102
+                'type'             => 'datepicker',
103
+                'id'               => esc_attr( "$post_type-from_date" ),
104
+                'name'             => 'from_date',
105
+                'label'            => __( 'From Date', 'invoicing' ),
106
+                'label_type'       => 'vertical',
107
+                'placeholder'      => 'YYYY-MM-DD',
108
+                'extra_attributes' => array(
109
+                    'data-enable-time' => 'false',
110
+                    'data-allow-input' => 'true',
111
+                ),
112
+            ),
113
+            true
114
+        );
115
+
116
+    }
117
+
118
+    /**
119
+     * Generates the to date input field.
120
+     *
121
+     */
122
+    public function generate_to_date( $post_type ) {
123
+
124
+        aui()->input(
125
+            array(
126
+                'type'             => 'datepicker',
127
+                'id'               => esc_attr( "$post_type-to_date" ),
128
+                'name'             => 'to_date',
129
+                'label'            => __( 'To Date', 'invoicing' ),
130
+                'label_type'       => 'vertical',
131
+                'placeholder'      => 'YYYY-MM-DD',
132
+                'extra_attributes' => array(
133
+                    'data-enable-time' => 'false',
134
+                    'data-allow-input' => 'true',
135
+                ),
136
+            ),
137
+            true
138
+        );
139
+    }
140
+
141
+    /**
142
+     * Generates the to post status select field.
143
+     *
144
+     */
145
+    public function generate_post_status_select( $post_type ) {
146
+
147
+        if ( 'subscriptions' === $post_type ) {
148
+            $options = getpaid_get_subscription_statuses();
149
+        } else {
150
+            $options = wpinv_get_invoice_statuses( true, false, $post_type );
151
+        }
152
+
153
+        aui()->select(
154
+            array(
155
+                'name'        => 'status',
156
+                'id'          => esc_attr( "$post_type-status" ),
157
+                'placeholder' => __( 'All Statuses', 'invoicing' ),
158
+                'label'       => __( 'Status', 'invoicing' ),
159
+                'label_type'  => 'vertical',
160
+                'label_class' => 'd-block',
161
+                'options'     => $options,
162
+            ),
163
+            true
164
+        );
165
+
166
+    }
167
+
168
+    /**
169
+     * Generates the to file type select field.
170
+     *
171
+     */
172
+    public function generate_file_type_select( $post_type ) {
173
+
174
+        aui()->select(
175
+            array(
176
+                'name'        => 'file_type',
177
+                'id'          => esc_attr( "$post_type-file_type" ),
178
+                'placeholder' => __( 'Select File Type', 'invoicing' ),
179
+                'label'       => __( 'Export File', 'invoicing' ),
180
+                'label_type'  => 'vertical',
181
+                'label_class' => 'd-block',
182
+                'value'       => 'csv',
183
+                'options'     => array(
184
+                    'csv'  => __( 'CSV', 'invoicing' ),
185
+                    'xml'  => __( 'XML', 'invoicing' ),
186
+                    'json' => __( 'JSON', 'invoicing' ),
187
+                ),
188
+            ),
189
+            true
190
+        );
191
+
192
+    }
193
+
194
+    /**
195
+     * Displays a field's markup.
196
+     *
197
+     */
198
+    public function display_markup( $markup ) {
199
+
200
+        echo wp_kses(
201
+            str_replace(
202
+                array(
203
+                    'form-control',
204
+                    'custom-select',
205
+                ),
206
+                'regular-text',
207
+                $markup
208
+            ),
209
+            getpaid_allowed_html()
210
+        );
211
+
212
+    }
213
+
214
+    /**
215
+     * Displays a subscription export card.
216
+     *
217
+     */
218
+    public function display_subscription_export() {
219
+
220
+        ?>
221 221
 
222 222
 		<div class="col-12 col-md-6">
223 223
 			<div class="card m-0 p-0" style="max-width:100%">
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 					<form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>">
234 234
 
235 235
 						<?php
236
-							$this->generate_from_date( 'subscriptions' );
237
-							$this->generate_to_date( 'subscriptions' );
238
-							$this->generate_post_status_select( 'subscriptions' );
239
-							$this->generate_file_type_select( 'subscriptions' );
240
-							submit_button( __( 'Download', 'invoicing' ) );
241
-						?>
236
+                            $this->generate_from_date( 'subscriptions' );
237
+                            $this->generate_to_date( 'subscriptions' );
238
+                            $this->generate_post_status_select( 'subscriptions' );
239
+                            $this->generate_file_type_select( 'subscriptions' );
240
+                            submit_button( __( 'Download', 'invoicing' ) );
241
+                        ?>
242 242
 
243 243
 					</form>
244 244
 
@@ -249,6 +249,6 @@  discard block
 block discarded – undo
249 249
 
250 250
 		<?php
251 251
 
252
-	}
252
+    }
253 253
 
254 254
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * GetPaid_Reports_Export Class.
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	public function display() {
20 20
 
21 21
 		echo "<div class='row mt-4' style='max-width: 920px;' >";
22
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
-			$this->display_post_type_export( $post_type );
22
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
23
+			$this->display_post_type_export($post_type);
24 24
 		}
25 25
 		$this->display_subscription_export();
26 26
 		echo '</div>';
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	 * Retrieves the download url.
32 32
 	 *
33 33
 	 */
34
-	public function get_download_url( $post_type ) {
34
+	public function get_download_url($post_type) {
35 35
 
36 36
 		return wp_nonce_url(
37 37
 			add_query_arg(
38 38
 				array(
39 39
 					'getpaid-admin-action' => 'export_invoices',
40
-					'post_type'            => urlencode( $post_type ),
40
+					'post_type'            => urlencode($post_type),
41 41
 				)
42 42
 			),
43 43
 			'getpaid-nonce',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * Displays a single post type export card.
51 51
 	 *
52 52
 	 */
53
-	public function display_post_type_export( $post_type ) {
53
+	public function display_post_type_export($post_type) {
54 54
 
55 55
 		?>
56 56
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 					<strong>
62 62
 						<?php
63 63
 							printf(
64
-								esc_html__( 'Export %s', 'invoicing' ),
65
-								esc_html( getpaid_get_post_type_label( $post_type ) )
64
+								esc_html__('Export %s', 'invoicing'),
65
+								esc_html(getpaid_get_post_type_label($post_type))
66 66
 							);
67 67
 						?>
68 68
 					</strong>
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 
71 71
 				<div class="card-body">
72 72
 
73
-					<form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>">
73
+					<form method="post" action="<?php echo esc_url($this->get_download_url($post_type)); ?>">
74 74
 
75 75
 						<?php
76
-							$this->generate_from_date( $post_type );
77
-							$this->generate_to_date( $post_type );
78
-							$this->generate_post_status_select( $post_type );
79
-							$this->generate_file_type_select( $post_type );
80
-							submit_button( __( 'Download', 'invoicing' ) );
76
+							$this->generate_from_date($post_type);
77
+							$this->generate_to_date($post_type);
78
+							$this->generate_post_status_select($post_type);
79
+							$this->generate_file_type_select($post_type);
80
+							submit_button(__('Download', 'invoicing'));
81 81
 						?>
82 82
 
83 83
 					</form>
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 	 * Generates the from date input field.
96 96
 	 *
97 97
 	 */
98
-	public function generate_from_date( $post_type ) {
98
+	public function generate_from_date($post_type) {
99 99
 
100 100
 		aui()->input(
101 101
 			array(
102 102
 				'type'             => 'datepicker',
103
-				'id'               => esc_attr( "$post_type-from_date" ),
103
+				'id'               => esc_attr("$post_type-from_date"),
104 104
 				'name'             => 'from_date',
105
-				'label'            => __( 'From Date', 'invoicing' ),
105
+				'label'            => __('From Date', 'invoicing'),
106 106
 				'label_type'       => 'vertical',
107 107
 				'placeholder'      => 'YYYY-MM-DD',
108 108
 				'extra_attributes' => array(
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 * Generates the to date input field.
120 120
 	 *
121 121
 	 */
122
-	public function generate_to_date( $post_type ) {
122
+	public function generate_to_date($post_type) {
123 123
 
124 124
 		aui()->input(
125 125
 			array(
126 126
 				'type'             => 'datepicker',
127
-				'id'               => esc_attr( "$post_type-to_date" ),
127
+				'id'               => esc_attr("$post_type-to_date"),
128 128
 				'name'             => 'to_date',
129
-				'label'            => __( 'To Date', 'invoicing' ),
129
+				'label'            => __('To Date', 'invoicing'),
130 130
 				'label_type'       => 'vertical',
131 131
 				'placeholder'      => 'YYYY-MM-DD',
132 132
 				'extra_attributes' => array(
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 	 * Generates the to post status select field.
143 143
 	 *
144 144
 	 */
145
-	public function generate_post_status_select( $post_type ) {
145
+	public function generate_post_status_select($post_type) {
146 146
 
147
-		if ( 'subscriptions' === $post_type ) {
147
+		if ('subscriptions' === $post_type) {
148 148
 			$options = getpaid_get_subscription_statuses();
149 149
 		} else {
150
-			$options = wpinv_get_invoice_statuses( true, false, $post_type );
150
+			$options = wpinv_get_invoice_statuses(true, false, $post_type);
151 151
 		}
152 152
 
153 153
 		aui()->select(
154 154
 			array(
155 155
 				'name'        => 'status',
156
-				'id'          => esc_attr( "$post_type-status" ),
157
-				'placeholder' => __( 'All Statuses', 'invoicing' ),
158
-				'label'       => __( 'Status', 'invoicing' ),
156
+				'id'          => esc_attr("$post_type-status"),
157
+				'placeholder' => __('All Statuses', 'invoicing'),
158
+				'label'       => __('Status', 'invoicing'),
159 159
 				'label_type'  => 'vertical',
160 160
 				'label_class' => 'd-block',
161 161
 				'options'     => $options,
@@ -169,21 +169,21 @@  discard block
 block discarded – undo
169 169
 	 * Generates the to file type select field.
170 170
 	 *
171 171
 	 */
172
-	public function generate_file_type_select( $post_type ) {
172
+	public function generate_file_type_select($post_type) {
173 173
 
174 174
 		aui()->select(
175 175
 			array(
176 176
 				'name'        => 'file_type',
177
-				'id'          => esc_attr( "$post_type-file_type" ),
178
-				'placeholder' => __( 'Select File Type', 'invoicing' ),
179
-				'label'       => __( 'Export File', 'invoicing' ),
177
+				'id'          => esc_attr("$post_type-file_type"),
178
+				'placeholder' => __('Select File Type', 'invoicing'),
179
+				'label'       => __('Export File', 'invoicing'),
180 180
 				'label_type'  => 'vertical',
181 181
 				'label_class' => 'd-block',
182 182
 				'value'       => 'csv',
183 183
 				'options'     => array(
184
-					'csv'  => __( 'CSV', 'invoicing' ),
185
-					'xml'  => __( 'XML', 'invoicing' ),
186
-					'json' => __( 'JSON', 'invoicing' ),
184
+					'csv'  => __('CSV', 'invoicing'),
185
+					'xml'  => __('XML', 'invoicing'),
186
+					'json' => __('JSON', 'invoicing'),
187 187
 				),
188 188
 			),
189 189
 			true
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * Displays a field's markup.
196 196
 	 *
197 197
 	 */
198
-	public function display_markup( $markup ) {
198
+	public function display_markup($markup) {
199 199
 
200 200
 		echo wp_kses(
201 201
 			str_replace(
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
 
225 225
 				<div class="card-header">
226 226
 					<strong>
227
-						<?php esc_html_e( 'Export Subscriptions', 'invoicing' ); ?>
227
+						<?php esc_html_e('Export Subscriptions', 'invoicing'); ?>
228 228
 					</strong>
229 229
 				</div>
230 230
 
231 231
 				<div class="card-body">
232 232
 
233
-					<form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>">
233
+					<form method="post" action="<?php echo esc_url($this->get_download_url('subscriptions')); ?>">
234 234
 
235 235
 						<?php
236
-							$this->generate_from_date( 'subscriptions' );
237
-							$this->generate_to_date( 'subscriptions' );
238
-							$this->generate_post_status_select( 'subscriptions' );
239
-							$this->generate_file_type_select( 'subscriptions' );
240
-							submit_button( __( 'Download', 'invoicing' ) );
236
+							$this->generate_from_date('subscriptions');
237
+							$this->generate_to_date('subscriptions');
238
+							$this->generate_post_status_select('subscriptions');
239
+							$this->generate_file_type_select('subscriptions');
240
+							submit_button(__('Download', 'invoicing'));
241 241
 						?>
242 242
 
243 243
 					</form>
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 3 patches
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
 			if( is_admin() && !$this->is_aui_screen()){
422 422
 				// don't add wp-admin scripts if not requested to
423
-			}else{
423
+			} else{
424 424
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
425 425
 
426 426
 				$rtl = is_rtl() ? '-rtl' : '';
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 
1563 1563
 			if( is_admin() && !$this->is_aui_screen()){
1564 1564
 				// don't add wp-admin scripts if not requested to
1565
-			}else {
1565
+			} else {
1566 1566
 
1567 1567
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1568 1568
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 						$colors[$color['slug']] = esc_attr($color['color']);
1950 1950
 					}
1951 1951
 				}
1952
-			}else{
1952
+			} else{
1953 1953
 				$settings = get_option('aui_options');
1954 1954
 				$colors = array(
1955 1955
 					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
@@ -2036,9 +2036,9 @@  discard block
 block discarded – undo
2036 2036
 
2037 2037
 			if($compatibility===true || $compatibility===1){
2038 2038
 				$compatibility = '.bsui';
2039
-			}elseif(!$compatibility){
2039
+			} elseif(!$compatibility){
2040 2040
 				$compatibility = '';
2041
-			}else{
2041
+			} else{
2042 2042
 				$compatibility = esc_attr($compatibility);
2043 2043
 			}
2044 2044
 
@@ -2885,7 +2885,9 @@  discard block
 block discarded – undo
2885 2885
 		 * @return mixed
2886 2886
 		 */
2887 2887
 		public static function minify_js($input) {
2888
-			if(trim($input) === "") return $input;
2888
+			if(trim($input) === "") {
2889
+			    return $input;
2890
+			}
2889 2891
 			return preg_replace(
2890 2892
 				array(
2891 2893
 					// Remove comment(s)
@@ -2917,7 +2919,9 @@  discard block
 block discarded – undo
2917 2919
 		 * @return mixed
2918 2920
 		 */
2919 2921
 		public static function minify_css($input) {
2920
-			if(trim($input) === "") return $input;
2922
+			if(trim($input) === "") {
2923
+			    return $input;
2924
+			}
2921 2925
 			return preg_replace(
2922 2926
 				array(
2923 2927
 					// Remove comment(s)
Please login to merge, or discard this patch.
Indentation   +1689 added lines, -1689 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,435 +21,435 @@  discard block
 block discarded – undo
21 21
  */
22 22
 if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
23 23
 
24
-	/**
25
-	 * A Class to be able to change settings for Font Awesome.
26
-	 *
27
-	 * Class AyeCode_UI_Settings
28
-	 * @ver 1.0.0
29
-	 * @todo decide how to implement textdomain
30
-	 */
31
-	class AyeCode_UI_Settings {
32
-
33
-		/**
34
-		 * Class version version.
35
-		 *
36
-		 * @var string
37
-		 */
38
-		public $version = '0.1.85';
39
-
40
-		/**
41
-		 * Class textdomain.
42
-		 *
43
-		 * @var string
44
-		 */
45
-		public $textdomain = 'aui';
46
-
47
-		/**
48
-		 * Latest version of Bootstrap at time of publish published.
49
-		 *
50
-		 * @var string
51
-		 */
52
-		public $latest = "4.5.3";
53
-
54
-		/**
55
-		 * Current version of select2 being used.
56
-		 *
57
-		 * @var string
58
-		 */
59
-		public $select2_version = "4.0.11";
60
-
61
-		/**
62
-		 * The title.
63
-		 *
64
-		 * @var string
65
-		 */
66
-		public $name = 'AyeCode UI';
67
-
68
-		/**
69
-		 * The relative url to the assets.
70
-		 *
71
-		 * @var string
72
-		 */
73
-		public $url = '';
74
-
75
-		/**
76
-		 * Holds the settings values.
77
-		 *
78
-		 * @var array
79
-		 */
80
-		private $settings;
81
-
82
-		/**
83
-		 * AyeCode_UI_Settings instance.
84
-		 *
85
-		 * @access private
86
-		 * @since  1.0.0
87
-		 * @var    AyeCode_UI_Settings There can be only one!
88
-		 */
89
-		private static $instance = null;
90
-
91
-
92
-		/**
93
-		 * Main AyeCode_UI_Settings Instance.
94
-		 *
95
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
-		 *
97
-		 * @since 1.0.0
98
-		 * @static
99
-		 * @return AyeCode_UI_Settings - Main instance.
100
-		 */
101
-		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
-
104
-				self::$instance = new AyeCode_UI_Settings;
105
-
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
-
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
-
112
-					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
-
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
-					}
118
-				}
119
-
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
121
-
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class AyeCode_UI_Settings
28
+     * @ver 1.0.0
29
+     * @todo decide how to implement textdomain
30
+     */
31
+    class AyeCode_UI_Settings {
32
+
33
+        /**
34
+         * Class version version.
35
+         *
36
+         * @var string
37
+         */
38
+        public $version = '0.1.85';
39
+
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
46
+
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "4.5.3";
53
+
54
+        /**
55
+         * Current version of select2 being used.
56
+         *
57
+         * @var string
58
+         */
59
+        public $select2_version = "4.0.11";
60
+
61
+        /**
62
+         * The title.
63
+         *
64
+         * @var string
65
+         */
66
+        public $name = 'AyeCode UI';
67
+
68
+        /**
69
+         * The relative url to the assets.
70
+         *
71
+         * @var string
72
+         */
73
+        public $url = '';
74
+
75
+        /**
76
+         * Holds the settings values.
77
+         *
78
+         * @var array
79
+         */
80
+        private $settings;
81
+
82
+        /**
83
+         * AyeCode_UI_Settings instance.
84
+         *
85
+         * @access private
86
+         * @since  1.0.0
87
+         * @var    AyeCode_UI_Settings There can be only one!
88
+         */
89
+        private static $instance = null;
90
+
91
+
92
+        /**
93
+         * Main AyeCode_UI_Settings Instance.
94
+         *
95
+         * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
+         *
97
+         * @since 1.0.0
98
+         * @static
99
+         * @return AyeCode_UI_Settings - Main instance.
100
+         */
101
+        public static function instance() {
102
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
+
104
+                self::$instance = new AyeCode_UI_Settings;
105
+
106
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
+
108
+                if ( is_admin() ) {
109
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
+
112
+                    // Maybe show example page
113
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
+
115
+                    if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
+                        add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
+                    }
118
+                }
124 119
 
125
-			return self::$instance;
126
-		}
120
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
127 121
 
128
-		/**
129
-		 * Add custom colors to the color selector.
130
-		 *
131
-		 * @param $theme_colors
132
-		 * @param $include_outlines
133
-		 * @param $include_branding
134
-		 *
135
-		 * @return mixed
136
-		 */
137
-		public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
122
+                do_action( 'ayecode_ui_settings_loaded' );
123
+            }
138 124
 
125
+            return self::$instance;
126
+        }
139 127
 
140
-			$setting = wp_get_global_settings();
128
+        /**
129
+         * Add custom colors to the color selector.
130
+         *
131
+         * @param $theme_colors
132
+         * @param $include_outlines
133
+         * @param $include_branding
134
+         *
135
+         * @return mixed
136
+         */
137
+        public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
141 138
 
142
-			if(!empty($setting['color']['palette']['custom'])){
143
-				foreach($setting['color']['palette']['custom'] as $color){
144
-					$theme_colors[$color['slug']] = esc_attr($color['name']);
145
-				}
146
-			}
147
-
148
-			return $theme_colors;
149
-		}
150
-
151
-		/**
152
-		 * Setup some constants.
153
-		 */
154
-		public function constants(){
155
-			define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
-			define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
-			define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
-			define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
-			define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
-			define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
-			define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
-			define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
-			define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
-			define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
-			define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
-			define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
-			define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
-			define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
-			define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
-			define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
-
172
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
-				define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
-			}
175
-			if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
-				define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
-			}
178
-			if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
-				define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
-			}
181
-			if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
-				define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
-			}
184
-			if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
-				define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
-			}
187
-			if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
-				define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
-			}
190
-			if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
-				define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
-			}
193
-			if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
-				define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
-			}
196
-			if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
-				define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
-			}
199
-			if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
-				define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
-			}
202
-			if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
-				define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
-			}
205
-			if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
-				define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
-			}
208
-			if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
-				define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
-			}
211
-			if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
-				define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
-			}
214
-			if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
-				define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
-			}
217
-			if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
-				define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
-			}
220
-
221
-		}
222
-
223
-		public static function get_colors( $original = false){
224
-
225
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
-				return array();
227
-			}
228
-			if ( $original ) {
229
-				return array(
230
-					'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
-					'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
-					'info'      => AUI_INFO_COLOR_ORIGINAL,
233
-					'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
-					'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
-					'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
-					'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
-					'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
-					'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
-					'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
-					'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
-					'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
-					'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
-					'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
-					'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
-					'black'     => AUI_BLACK_COLOR_ORIGINAL,
246
-				);
247
-			}
248
-
249
-			return array(
250
-				'primary'   => AUI_PRIMARY_COLOR,
251
-				'secondary' => AUI_SECONDARY_COLOR,
252
-				'info'      => AUI_INFO_COLOR,
253
-				'warning'   => AUI_WARNING_COLOR,
254
-				'danger'    => AUI_DANGER_COLOR,
255
-				'success'   => AUI_SUCCESS_COLOR,
256
-				'light'     => AUI_LIGHT_COLOR,
257
-				'dark'      => AUI_DARK_COLOR,
258
-				'white'     => AUI_WHITE_COLOR,
259
-				'purple'    => AUI_PURPLE_COLOR,
260
-				'salmon'    => AUI_SALMON_COLOR,
261
-				'cyan'      => AUI_CYAN_COLOR,
262
-				'gray'      => AUI_GRAY_COLOR,
263
-				'indigo'    => AUI_INDIGO_COLOR,
264
-				'orange'    => AUI_ORANGE_COLOR,
265
-				'black'     => AUI_BLACK_COLOR,
266
-			);
267
-		}
268
-
269
-		/**
270
-		 * Initiate the settings and add the required action hooks.
271
-		 */
272
-		public function init() {
273
-
274
-			// Maybe fix settings
275
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
-				$db_settings = get_option( 'ayecode-ui-settings' );
277
-				if ( ! empty( $db_settings ) ) {
278
-					$db_settings['css_backend'] = 'compatibility';
279
-					$db_settings['js_backend'] = 'core-popper';
280
-					update_option( 'ayecode-ui-settings', $db_settings );
281
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
-				}
283
-			}
284 139
 
285
-			$this->constants();
286
-			$this->settings = $this->get_settings();
287
-			$this->url = $this->get_url();
140
+            $setting = wp_get_global_settings();
288 141
 
289
-			/**
290
-			 * Maybe load CSS
291
-			 *
292
-			 * We load super early in case there is a theme version that might change the colors
293
-			 */
294
-			if ( $this->settings['css'] ) {
295
-				$priority = $this->is_bs3_compat() ? 100 : 1;
296
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
-			}
298
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
-			}
301
-
302
-			// maybe load JS
303
-			if ( $this->settings['js'] ) {
304
-				$priority = $this->is_bs3_compat() ? 100 : 1;
305
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
-			}
307
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
-			}
310
-
311
-			// Maybe set the HTML font size
312
-			if ( $this->settings['html_font_size'] ) {
313
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
-			}
315
-
316
-			// Maybe show backend style error
317
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
-			}
320
-
321
-		}
322
-
323
-		/**
324
-		 * Show admin notice if backend scripts not loaded.
325
-		 */
326
-		public function show_admin_style_notice(){
327
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
-		}
332
-
333
-		/**
334
-		 * Check if we should load the admin scripts or not.
335
-		 *
336
-		 * @return bool
337
-		 */
338
-		public function load_admin_scripts(){
339
-			$result = true;
340
-
341
-			// check if specifically disabled
342
-			if(!empty($this->settings['disable_admin'])){
343
-				$url_parts = explode("\n",$this->settings['disable_admin']);
344
-				foreach($url_parts as $part){
345
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
-						return false; // return early, no point checking further
347
-					}
348
-				}
349
-			}
350
-
351
-			return $result;
352
-		}
353
-
354
-		/**
355
-		 * Add a html font size to the footer.
356
-		 */
357
-		public function html_font_size(){
358
-			$this->settings = $this->get_settings();
359
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
-		}
361
-
362
-		/**
363
-		 * Check if the current admin screen should load scripts.
364
-		 *
365
-		 * @return bool
366
-		 */
367
-		public function is_aui_screen(){
142
+            if(!empty($setting['color']['palette']['custom'])){
143
+                foreach($setting['color']['palette']['custom'] as $color){
144
+                    $theme_colors[$color['slug']] = esc_attr($color['name']);
145
+                }
146
+            }
147
+
148
+            return $theme_colors;
149
+        }
150
+
151
+        /**
152
+         * Setup some constants.
153
+         */
154
+        public function constants(){
155
+            define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
+            define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
+            define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
+            define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
+            define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
+            define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
+            define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
+            define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
+            define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
+            define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
+            define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
+            define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
+            define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
+            define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
+            define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
+            define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
+
172
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
+                define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
+            }
175
+            if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
+                define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
+            }
178
+            if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
+                define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
+            }
181
+            if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
+                define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
+            }
184
+            if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
+                define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
+            }
187
+            if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
+                define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
+            }
190
+            if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
+                define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
+            }
193
+            if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
+                define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
+            }
196
+            if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
+                define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
+            }
199
+            if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
+                define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
+            }
202
+            if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
+                define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
+            }
205
+            if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
+                define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
+            }
208
+            if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
+                define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
+            }
211
+            if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
+                define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
+            }
214
+            if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
+                define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
+            }
217
+            if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
+                define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
+            }
220
+
221
+        }
222
+
223
+        public static function get_colors( $original = false){
224
+
225
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
+                return array();
227
+            }
228
+            if ( $original ) {
229
+                return array(
230
+                    'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
+                    'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
+                    'info'      => AUI_INFO_COLOR_ORIGINAL,
233
+                    'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
+                    'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
+                    'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
+                    'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
+                    'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
+                    'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
+                    'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
+                    'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
+                    'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
+                    'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
+                    'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
+                    'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
+                    'black'     => AUI_BLACK_COLOR_ORIGINAL,
246
+                );
247
+            }
248
+
249
+            return array(
250
+                'primary'   => AUI_PRIMARY_COLOR,
251
+                'secondary' => AUI_SECONDARY_COLOR,
252
+                'info'      => AUI_INFO_COLOR,
253
+                'warning'   => AUI_WARNING_COLOR,
254
+                'danger'    => AUI_DANGER_COLOR,
255
+                'success'   => AUI_SUCCESS_COLOR,
256
+                'light'     => AUI_LIGHT_COLOR,
257
+                'dark'      => AUI_DARK_COLOR,
258
+                'white'     => AUI_WHITE_COLOR,
259
+                'purple'    => AUI_PURPLE_COLOR,
260
+                'salmon'    => AUI_SALMON_COLOR,
261
+                'cyan'      => AUI_CYAN_COLOR,
262
+                'gray'      => AUI_GRAY_COLOR,
263
+                'indigo'    => AUI_INDIGO_COLOR,
264
+                'orange'    => AUI_ORANGE_COLOR,
265
+                'black'     => AUI_BLACK_COLOR,
266
+            );
267
+        }
268
+
269
+        /**
270
+         * Initiate the settings and add the required action hooks.
271
+         */
272
+        public function init() {
273
+
274
+            // Maybe fix settings
275
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
+                $db_settings = get_option( 'ayecode-ui-settings' );
277
+                if ( ! empty( $db_settings ) ) {
278
+                    $db_settings['css_backend'] = 'compatibility';
279
+                    $db_settings['js_backend'] = 'core-popper';
280
+                    update_option( 'ayecode-ui-settings', $db_settings );
281
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
+                }
283
+            }
284
+
285
+            $this->constants();
286
+            $this->settings = $this->get_settings();
287
+            $this->url = $this->get_url();
288
+
289
+            /**
290
+             * Maybe load CSS
291
+             *
292
+             * We load super early in case there is a theme version that might change the colors
293
+             */
294
+            if ( $this->settings['css'] ) {
295
+                $priority = $this->is_bs3_compat() ? 100 : 1;
296
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
+            }
298
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
+            }
301
+
302
+            // maybe load JS
303
+            if ( $this->settings['js'] ) {
304
+                $priority = $this->is_bs3_compat() ? 100 : 1;
305
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
+            }
307
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
+            }
310
+
311
+            // Maybe set the HTML font size
312
+            if ( $this->settings['html_font_size'] ) {
313
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
+            }
315
+
316
+            // Maybe show backend style error
317
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
+            }
320
+
321
+        }
322
+
323
+        /**
324
+         * Show admin notice if backend scripts not loaded.
325
+         */
326
+        public function show_admin_style_notice(){
327
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
+        }
332
+
333
+        /**
334
+         * Check if we should load the admin scripts or not.
335
+         *
336
+         * @return bool
337
+         */
338
+        public function load_admin_scripts(){
339
+            $result = true;
340
+
341
+            // check if specifically disabled
342
+            if(!empty($this->settings['disable_admin'])){
343
+                $url_parts = explode("\n",$this->settings['disable_admin']);
344
+                foreach($url_parts as $part){
345
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
+                        return false; // return early, no point checking further
347
+                    }
348
+                }
349
+            }
350
+
351
+            return $result;
352
+        }
353
+
354
+        /**
355
+         * Add a html font size to the footer.
356
+         */
357
+        public function html_font_size(){
358
+            $this->settings = $this->get_settings();
359
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
+        }
361
+
362
+        /**
363
+         * Check if the current admin screen should load scripts.
364
+         *
365
+         * @return bool
366
+         */
367
+        public function is_aui_screen(){
368 368
 //			echo '###';exit;
369
-			$load = false;
370
-			// check if we should load or not
371
-			if ( is_admin() ) {
372
-				// Only enable on set pages
373
-				$aui_screens = array(
374
-					'page',
375
-					'post',
376
-					'settings_page_ayecode-ui-settings',
377
-					'appearance_page_gutenberg-widgets',
378
-					'widgets',
379
-					'ayecode-ui-settings',
380
-					'site-editor'
381
-				);
382
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
-
384
-				$screen = get_current_screen();
369
+            $load = false;
370
+            // check if we should load or not
371
+            if ( is_admin() ) {
372
+                // Only enable on set pages
373
+                $aui_screens = array(
374
+                    'page',
375
+                    'post',
376
+                    'settings_page_ayecode-ui-settings',
377
+                    'appearance_page_gutenberg-widgets',
378
+                    'widgets',
379
+                    'ayecode-ui-settings',
380
+                    'site-editor'
381
+                );
382
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
+
384
+                $screen = get_current_screen();
385 385
 
386 386
 //				echo '###'.$screen->id;
387 387
 
388
-				// check if we are on a AUI screen
389
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
-					$load = true;
391
-				}
388
+                // check if we are on a AUI screen
389
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
+                    $load = true;
391
+                }
392 392
 
393
-				//load for widget previews in WP 5.8
394
-				if( !empty($_REQUEST['legacy-widget-preview'])){
395
-					$load = true;
396
-				}
397
-			}
393
+                //load for widget previews in WP 5.8
394
+                if( !empty($_REQUEST['legacy-widget-preview'])){
395
+                    $load = true;
396
+                }
397
+            }
398 398
 
399
-			return apply_filters( 'aui_load_on_admin' , $load );
400
-		}
399
+            return apply_filters( 'aui_load_on_admin' , $load );
400
+        }
401 401
 
402
-		/**
403
-		 * Check if the current theme is a block theme.
404
-		 *
405
-		 * @return bool
406
-		 */
407
-		public static function is_block_theme() {
408
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
-				return true;
410
-			}
402
+        /**
403
+         * Check if the current theme is a block theme.
404
+         *
405
+         * @return bool
406
+         */
407
+        public static function is_block_theme() {
408
+            if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
+                return true;
410
+            }
411 411
 
412
-			return false;
413
-		}
412
+            return false;
413
+        }
414 414
 
415
-		/**
416
-		 * Adds the styles.
417
-		 */
418
-		public function enqueue_style() {
415
+        /**
416
+         * Adds the styles.
417
+         */
418
+        public function enqueue_style() {
419 419
 
420 420
 
421
-			if( is_admin() && !$this->is_aui_screen()){
422
-				// don't add wp-admin scripts if not requested to
423
-			}else{
424
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
421
+            if( is_admin() && !$this->is_aui_screen()){
422
+                // don't add wp-admin scripts if not requested to
423
+            }else{
424
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
425 425
 
426
-				$rtl = is_rtl() ? '-rtl' : '';
426
+                $rtl = is_rtl() ? '-rtl' : '';
427 427
 
428
-				if($this->settings[$css_setting]){
429
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
428
+                if($this->settings[$css_setting]){
429
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
431 431
 
432 432
 
433 433
 
434
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
435
-					wp_enqueue_style( 'ayecode-ui' );
434
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
435
+                    wp_enqueue_style( 'ayecode-ui' );
436 436
 
437
-					$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
437
+                    $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
438 438
 
439 439
 //					if ( is_admin() && !empty($_REQUEST['postType']) ) {
440
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
441
-						$url = $this->url.'assets/css/ayecode-ui-fse.css';
442
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
443
-						wp_enqueue_style( 'ayecode-ui-fse' );
444
-					}
440
+                    if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
441
+                        $url = $this->url.'assets/css/ayecode-ui-fse.css';
442
+                        wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
443
+                        wp_enqueue_style( 'ayecode-ui-fse' );
444
+                    }
445 445
 
446 446
 
447
-					// flatpickr
448
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
447
+                    // flatpickr
448
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
449 449
 
450
-					// fix some wp-admin issues
451
-					if(is_admin()){
452
-						$custom_css = "
450
+                    // fix some wp-admin issues
451
+                    if(is_admin()){
452
+                        $custom_css = "
453 453
                 body{
454 454
                     background-color: #f1f1f1;
455 455
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -495,35 +495,35 @@  discard block
 block discarded – undo
495 495
 				}
496 496
                 ";
497 497
 
498
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
499
-						$custom_css .= "
498
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
499
+                        $custom_css .= "
500 500
 						.edit-post-sidebar input[type=color].components-text-control__input{
501 501
 						    padding: 0;
502 502
 						}
503 503
 					";
504
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
505
-					}
504
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
505
+                    }
506 506
 
507
-					// custom changes
508
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
507
+                    // custom changes
508
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
509 509
 
510
-				}
511
-			}
510
+                }
511
+            }
512 512
 
513 513
 
514
-		}
514
+        }
515 515
 
516
-		/**
517
-		 * Get inline script used if bootstrap enqueued
518
-		 *
519
-		 * If this remains small then its best to use this than to add another JS file.
520
-		 */
521
-		public function inline_script() {
522
-			// Flatpickr calendar locale
523
-			$flatpickr_locale = self::flatpickr_locale();
516
+        /**
517
+         * Get inline script used if bootstrap enqueued
518
+         *
519
+         * If this remains small then its best to use this than to add another JS file.
520
+         */
521
+        public function inline_script() {
522
+            // Flatpickr calendar locale
523
+            $flatpickr_locale = self::flatpickr_locale();
524 524
 
525
-			ob_start();
526
-			?>
525
+            ob_start();
526
+            ?>
527 527
             <script>
528 528
                 /**
529 529
                  * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1460,8 +1460,8 @@  discard block
 block discarded – undo
1460 1460
                 aui_set_data_scroll();
1461 1461
 
1462 1462
 				<?php
1463
-				// FSE tweaks.
1464
-				if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?>
1463
+                // FSE tweaks.
1464
+                if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?>
1465 1465
                 function aui_fse_set_data_scroll() {
1466 1466
                     console.log('init scroll');
1467 1467
                     let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
@@ -1494,29 +1494,29 @@  discard block
 block discarded – undo
1494 1494
 
1495 1495
             </script>
1496 1496
 			<?php
1497
-			$output = ob_get_clean();
1497
+            $output = ob_get_clean();
1498 1498
 
1499 1499
 
1500 1500
 
1501
-			/*
1501
+            /*
1502 1502
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1503 1503
 			 */
1504
-			return str_replace( array(
1505
-				'<script>',
1506
-				'</script>'
1507
-			), '', self::minify_js($output) );
1508
-		}
1509
-
1510
-
1511
-		/**
1512
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1513
-		 *
1514
-		 * @TODO we may need this when other conflicts arrise.
1515
-		 * @return mixed
1516
-		 */
1517
-		public static function bs3_compat_js() {
1518
-			ob_start();
1519
-			?>
1504
+            return str_replace( array(
1505
+                '<script>',
1506
+                '</script>'
1507
+            ), '', self::minify_js($output) );
1508
+        }
1509
+
1510
+
1511
+        /**
1512
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1513
+         *
1514
+         * @TODO we may need this when other conflicts arrise.
1515
+         * @return mixed
1516
+         */
1517
+        public static function bs3_compat_js() {
1518
+            ob_start();
1519
+            ?>
1520 1520
             <script>
1521 1521
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1522 1522
                 /* With Avada builder */
@@ -1524,20 +1524,20 @@  discard block
 block discarded – undo
1524 1524
 				<?php } ?>
1525 1525
             </script>
1526 1526
 			<?php
1527
-			return str_replace( array(
1528
-				'<script>',
1529
-				'</script>'
1530
-			), '', ob_get_clean());
1531
-		}
1532
-
1533
-		/**
1534
-		 * Get inline script used if bootstrap file browser enqueued.
1535
-		 *
1536
-		 * If this remains small then its best to use this than to add another JS file.
1537
-		 */
1538
-		public function inline_script_file_browser(){
1539
-			ob_start();
1540
-			?>
1527
+            return str_replace( array(
1528
+                '<script>',
1529
+                '</script>'
1530
+            ), '', ob_get_clean());
1531
+        }
1532
+
1533
+        /**
1534
+         * Get inline script used if bootstrap file browser enqueued.
1535
+         *
1536
+         * If this remains small then its best to use this than to add another JS file.
1537
+         */
1538
+        public function inline_script_file_browser(){
1539
+            ob_start();
1540
+            ?>
1541 1541
             <script>
1542 1542
                 // run on doc ready
1543 1543
                 jQuery(document).ready(function () {
@@ -1545,227 +1545,227 @@  discard block
 block discarded – undo
1545 1545
                 });
1546 1546
             </script>
1547 1547
 			<?php
1548
-			$output = ob_get_clean();
1548
+            $output = ob_get_clean();
1549 1549
 
1550
-			/*
1550
+            /*
1551 1551
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1552 1552
 			 */
1553
-			return str_replace( array(
1554
-				'<script>',
1555
-				'</script>'
1556
-			), '', $output );
1557
-		}
1558
-
1559
-		/**
1560
-		 * Adds the Font Awesome JS.
1561
-		 */
1562
-		public function enqueue_scripts() {
1563
-
1564
-			if( is_admin() && !$this->is_aui_screen()){
1565
-				// don't add wp-admin scripts if not requested to
1566
-			}else {
1567
-
1568
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1569
-
1570
-				// select2
1571
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1572
-
1573
-				// flatpickr
1574
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1575
-
1576
-				// flatpickr
1577
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1578
-
1579
-				// Bootstrap file browser
1580
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1581
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1582
-
1583
-				$load_inline = false;
1584
-
1585
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1586
-					// Bootstrap bundle
1587
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1588
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1589
-						'select2',
1590
-						'jquery'
1591
-					), $this->version, $this->is_bs3_compat() );
1592
-					// if in admin then add to footer for compatibility.
1593
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1594
-					$script = $this->inline_script();
1595
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1596
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1597
-					$url = $this->url . 'assets/js/popper.min.js';
1598
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1599
-					wp_enqueue_script( 'bootstrap-js-popper' );
1600
-					$load_inline = true;
1601
-				} else {
1602
-					$load_inline = true;
1603
-				}
1604
-
1605
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1606
-				if ( $load_inline ) {
1607
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1608
-					wp_enqueue_script( 'bootstrap-dummy' );
1609
-					$script = $this->inline_script();
1610
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1611
-				}
1612
-			}
1613
-
1614
-		}
1615
-
1616
-		/**
1617
-		 * Enqueue flatpickr if called.
1618
-		 */
1619
-		public function enqueue_flatpickr(){
1620
-			wp_enqueue_style( 'flatpickr' );
1621
-			wp_enqueue_script( 'flatpickr' );
1622
-		}
1623
-
1624
-		/**
1625
-		 * Enqueue iconpicker if called.
1626
-		 */
1627
-		public function enqueue_iconpicker(){
1628
-			wp_enqueue_style( 'iconpicker' );
1629
-			wp_enqueue_script( 'iconpicker' );
1630
-		}
1631
-
1632
-		/**
1633
-		 * Get the url path to the current folder.
1634
-		 *
1635
-		 * @return string
1636
-		 */
1637
-		public function get_url() {
1638
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1639
-			$content_url = untrailingslashit( WP_CONTENT_URL );
1640
-
1641
-			// Replace http:// to https://.
1642
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1643
-				$content_url = str_replace( 'http://', 'https://', $content_url );
1644
-			}
1645
-
1646
-			// Check if we are inside a plugin
1647
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1648
-			$url = str_replace( $content_dir, $content_url, $file_dir );
1649
-
1650
-			return trailingslashit( $url );
1651
-		}
1652
-
1653
-		/**
1654
-		 * Get the url path to the current folder.
1655
-		 *
1656
-		 * @return string
1657
-		 */
1658
-		public function get_url_old() {
1659
-
1660
-			$url = '';
1661
-			// check if we are inside a plugin
1662
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1663
-
1664
-			// add check in-case user has changed wp-content dir name.
1665
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1666
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1667
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1668
-
1669
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1670
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1671
-			}
1672
-
1673
-			return $url;
1674
-		}
1675
-
1676
-		/**
1677
-		 * Register the database settings with WordPress.
1678
-		 */
1679
-		public function register_settings() {
1680
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1681
-		}
1682
-
1683
-		/**
1684
-		 * Add the WordPress settings menu item.
1685
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1686
-		 */
1687
-		public function menu_item() {
1688
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1689
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1690
-				$this,
1691
-				'settings_page'
1692
-			) );
1693
-		}
1694
-
1695
-		/**
1696
-		 * Get a list of themes and their default JS settings.
1697
-		 *
1698
-		 * @return array
1699
-		 */
1700
-		public function theme_js_settings(){
1701
-			return array(
1702
-				'ayetheme' => 'popper',
1703
-				'listimia' => 'required',
1704
-				'listimia_backend' => 'core-popper',
1705
-				//'avada'    => 'required', // removed as we now add compatibility
1706
-			);
1707
-		}
1708
-
1709
-		/**
1710
-		 * Get the current Font Awesome output settings.
1711
-		 *
1712
-		 * @return array The array of settings.
1713
-		 */
1714
-		public function get_settings() {
1715
-
1716
-			$db_settings = get_option( 'ayecode-ui-settings' );
1717
-			$js_default = 'core-popper';
1718
-			$js_default_backend = $js_default;
1719
-
1720
-			// maybe set defaults (if no settings set)
1721
-			if(empty($db_settings)){
1722
-				$active_theme = strtolower( get_template() ); // active parent theme.
1723
-				$theme_js_settings = self::theme_js_settings();
1724
-				if(isset($theme_js_settings[$active_theme])){
1725
-					$js_default = $theme_js_settings[$active_theme];
1726
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1727
-				}
1728
-			}
1553
+            return str_replace( array(
1554
+                '<script>',
1555
+                '</script>'
1556
+            ), '', $output );
1557
+        }
1558
+
1559
+        /**
1560
+         * Adds the Font Awesome JS.
1561
+         */
1562
+        public function enqueue_scripts() {
1563
+
1564
+            if( is_admin() && !$this->is_aui_screen()){
1565
+                // don't add wp-admin scripts if not requested to
1566
+            }else {
1567
+
1568
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1569
+
1570
+                // select2
1571
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1572
+
1573
+                // flatpickr
1574
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1575
+
1576
+                // flatpickr
1577
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1578
+
1579
+                // Bootstrap file browser
1580
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1581
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1582
+
1583
+                $load_inline = false;
1584
+
1585
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1586
+                    // Bootstrap bundle
1587
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1588
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
1589
+                        'select2',
1590
+                        'jquery'
1591
+                    ), $this->version, $this->is_bs3_compat() );
1592
+                    // if in admin then add to footer for compatibility.
1593
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1594
+                    $script = $this->inline_script();
1595
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
1596
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1597
+                    $url = $this->url . 'assets/js/popper.min.js';
1598
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1599
+                    wp_enqueue_script( 'bootstrap-js-popper' );
1600
+                    $load_inline = true;
1601
+                } else {
1602
+                    $load_inline = true;
1603
+                }
1729 1604
 
1730
-			/**
1731
-			 * Filter the default settings.
1732
-			 */
1733
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
1734
-				'css'            => 'compatibility', // core, compatibility
1735
-				'js'             => $js_default, // js to load, core-popper, popper
1736
-				'html_font_size' => '16', // js to load, core-popper, popper
1737
-				'css_backend'    => 'compatibility', // core, compatibility
1738
-				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
1739
-				'disable_admin'  => '', // URL snippets to disable loading on admin
1740
-			), $db_settings );
1741
-
1742
-			$settings = wp_parse_args( $db_settings, $defaults );
1743
-
1744
-			/**
1745
-			 * Filter the Bootstrap settings.
1746
-			 *
1747
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1748
-			 */
1749
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1750
-		}
1751
-
1752
-
1753
-		/**
1754
-		 * The settings page html output.
1755
-		 */
1756
-		public function settings_page() {
1757
-			if ( ! current_user_can( 'manage_options' ) ) {
1758
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1759
-			}
1760
-			?>
1605
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1606
+                if ( $load_inline ) {
1607
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1608
+                    wp_enqueue_script( 'bootstrap-dummy' );
1609
+                    $script = $this->inline_script();
1610
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
1611
+                }
1612
+            }
1613
+
1614
+        }
1615
+
1616
+        /**
1617
+         * Enqueue flatpickr if called.
1618
+         */
1619
+        public function enqueue_flatpickr(){
1620
+            wp_enqueue_style( 'flatpickr' );
1621
+            wp_enqueue_script( 'flatpickr' );
1622
+        }
1623
+
1624
+        /**
1625
+         * Enqueue iconpicker if called.
1626
+         */
1627
+        public function enqueue_iconpicker(){
1628
+            wp_enqueue_style( 'iconpicker' );
1629
+            wp_enqueue_script( 'iconpicker' );
1630
+        }
1631
+
1632
+        /**
1633
+         * Get the url path to the current folder.
1634
+         *
1635
+         * @return string
1636
+         */
1637
+        public function get_url() {
1638
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1639
+            $content_url = untrailingslashit( WP_CONTENT_URL );
1640
+
1641
+            // Replace http:// to https://.
1642
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1643
+                $content_url = str_replace( 'http://', 'https://', $content_url );
1644
+            }
1645
+
1646
+            // Check if we are inside a plugin
1647
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1648
+            $url = str_replace( $content_dir, $content_url, $file_dir );
1649
+
1650
+            return trailingslashit( $url );
1651
+        }
1652
+
1653
+        /**
1654
+         * Get the url path to the current folder.
1655
+         *
1656
+         * @return string
1657
+         */
1658
+        public function get_url_old() {
1659
+
1660
+            $url = '';
1661
+            // check if we are inside a plugin
1662
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1663
+
1664
+            // add check in-case user has changed wp-content dir name.
1665
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
1666
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1667
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
1668
+
1669
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1670
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1671
+            }
1672
+
1673
+            return $url;
1674
+        }
1675
+
1676
+        /**
1677
+         * Register the database settings with WordPress.
1678
+         */
1679
+        public function register_settings() {
1680
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1681
+        }
1682
+
1683
+        /**
1684
+         * Add the WordPress settings menu item.
1685
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1686
+         */
1687
+        public function menu_item() {
1688
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1689
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1690
+                $this,
1691
+                'settings_page'
1692
+            ) );
1693
+        }
1694
+
1695
+        /**
1696
+         * Get a list of themes and their default JS settings.
1697
+         *
1698
+         * @return array
1699
+         */
1700
+        public function theme_js_settings(){
1701
+            return array(
1702
+                'ayetheme' => 'popper',
1703
+                'listimia' => 'required',
1704
+                'listimia_backend' => 'core-popper',
1705
+                //'avada'    => 'required', // removed as we now add compatibility
1706
+            );
1707
+        }
1708
+
1709
+        /**
1710
+         * Get the current Font Awesome output settings.
1711
+         *
1712
+         * @return array The array of settings.
1713
+         */
1714
+        public function get_settings() {
1715
+
1716
+            $db_settings = get_option( 'ayecode-ui-settings' );
1717
+            $js_default = 'core-popper';
1718
+            $js_default_backend = $js_default;
1719
+
1720
+            // maybe set defaults (if no settings set)
1721
+            if(empty($db_settings)){
1722
+                $active_theme = strtolower( get_template() ); // active parent theme.
1723
+                $theme_js_settings = self::theme_js_settings();
1724
+                if(isset($theme_js_settings[$active_theme])){
1725
+                    $js_default = $theme_js_settings[$active_theme];
1726
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1727
+                }
1728
+            }
1729
+
1730
+            /**
1731
+             * Filter the default settings.
1732
+             */
1733
+            $defaults = apply_filters( 'ayecode-ui-default-settings', array(
1734
+                'css'            => 'compatibility', // core, compatibility
1735
+                'js'             => $js_default, // js to load, core-popper, popper
1736
+                'html_font_size' => '16', // js to load, core-popper, popper
1737
+                'css_backend'    => 'compatibility', // core, compatibility
1738
+                'js_backend'     => $js_default_backend, // js to load, core-popper, popper
1739
+                'disable_admin'  => '', // URL snippets to disable loading on admin
1740
+            ), $db_settings );
1741
+
1742
+            $settings = wp_parse_args( $db_settings, $defaults );
1743
+
1744
+            /**
1745
+             * Filter the Bootstrap settings.
1746
+             *
1747
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1748
+             */
1749
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1750
+        }
1751
+
1752
+
1753
+        /**
1754
+         * The settings page html output.
1755
+         */
1756
+        public function settings_page() {
1757
+            if ( ! current_user_can( 'manage_options' ) ) {
1758
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1759
+            }
1760
+            ?>
1761 1761
             <div class="wrap">
1762 1762
                 <h1><?php echo $this->name; ?></h1>
1763 1763
                 <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.",'aui') );?></p>
1764 1764
                 <form method="post" action="options.php">
1765 1765
 					<?php
1766
-					settings_fields( 'ayecode-ui-settings' );
1767
-					do_settings_sections( 'ayecode-ui-settings' );
1768
-					?>
1766
+                    settings_fields( 'ayecode-ui-settings' );
1767
+                    do_settings_sections( 'ayecode-ui-settings' );
1768
+                    ?>
1769 1769
 
1770 1770
                     <h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1771 1771
                     <table class="form-table wpbs-table-settings">
@@ -1845,60 +1845,60 @@  discard block
 block discarded – undo
1845 1845
                     </table>
1846 1846
 
1847 1847
 					<?php
1848
-					submit_button();
1849
-					?>
1848
+                    submit_button();
1849
+                    ?>
1850 1850
                 </form>
1851 1851
 
1852 1852
                 <div id="wpbs-version"><?php echo $this->version; ?></div>
1853 1853
             </div>
1854 1854
 
1855 1855
 			<?php
1856
-		}
1857
-
1858
-		public function customizer_settings($wp_customize){
1859
-			$wp_customize->add_section('aui_settings', array(
1860
-				'title'    => __('AyeCode UI','aui'),
1861
-				'priority' => 120,
1862
-			));
1863
-
1864
-			//  =============================
1865
-			//  = Color Picker              =
1866
-			//  =============================
1867
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1868
-				'default'           => AUI_PRIMARY_COLOR,
1869
-				'sanitize_callback' => 'sanitize_hex_color',
1870
-				'capability'        => 'edit_theme_options',
1871
-				'type'              => 'option',
1872
-				'transport'         => 'refresh',
1873
-			));
1874
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
-				'label'    => __('Primary Color','aui'),
1876
-				'section'  => 'aui_settings',
1877
-				'settings' => 'aui_options[color_primary]',
1878
-			)));
1879
-
1880
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1881
-				'default'           => '#6c757d',
1882
-				'sanitize_callback' => 'sanitize_hex_color',
1883
-				'capability'        => 'edit_theme_options',
1884
-				'type'              => 'option',
1885
-				'transport'         => 'refresh',
1886
-			));
1887
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
-				'label'    => __('Secondary Color','aui'),
1889
-				'section'  => 'aui_settings',
1890
-				'settings' => 'aui_options[color_secondary]',
1891
-			)));
1892
-		}
1893
-
1894
-		/**
1895
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1896
-		 *
1897
-		 * @return mixed
1898
-		 */
1899
-		public static function bs3_compat_css() {
1900
-			ob_start();
1901
-			?>
1856
+        }
1857
+
1858
+        public function customizer_settings($wp_customize){
1859
+            $wp_customize->add_section('aui_settings', array(
1860
+                'title'    => __('AyeCode UI','aui'),
1861
+                'priority' => 120,
1862
+            ));
1863
+
1864
+            //  =============================
1865
+            //  = Color Picker              =
1866
+            //  =============================
1867
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1868
+                'default'           => AUI_PRIMARY_COLOR,
1869
+                'sanitize_callback' => 'sanitize_hex_color',
1870
+                'capability'        => 'edit_theme_options',
1871
+                'type'              => 'option',
1872
+                'transport'         => 'refresh',
1873
+            ));
1874
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
+                'label'    => __('Primary Color','aui'),
1876
+                'section'  => 'aui_settings',
1877
+                'settings' => 'aui_options[color_primary]',
1878
+            )));
1879
+
1880
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1881
+                'default'           => '#6c757d',
1882
+                'sanitize_callback' => 'sanitize_hex_color',
1883
+                'capability'        => 'edit_theme_options',
1884
+                'type'              => 'option',
1885
+                'transport'         => 'refresh',
1886
+            ));
1887
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
+                'label'    => __('Secondary Color','aui'),
1889
+                'section'  => 'aui_settings',
1890
+                'settings' => 'aui_options[color_secondary]',
1891
+            )));
1892
+        }
1893
+
1894
+        /**
1895
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1896
+         *
1897
+         * @return mixed
1898
+         */
1899
+        public static function bs3_compat_css() {
1900
+            ob_start();
1901
+            ?>
1902 1902
             <style>
1903 1903
                 /* Bootstrap 3 compatibility */
1904 1904
                 body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1927,825 +1927,825 @@  discard block
 block discarded – undo
1927 1927
                 <?php } ?>
1928 1928
             </style>
1929 1929
 			<?php
1930
-			return str_replace( array(
1931
-				'<style>',
1932
-				'</style>'
1933
-			), '', self::minify_css( ob_get_clean() ) );
1934
-		}
1935
-
1936
-
1937
-		public static function custom_css($compatibility = true) {
1938
-			$colors = array();
1939
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1940
-
1941
-				$setting = wp_get_global_settings();
1942
-				if(!empty($setting['color']['palette']['theme'])){
1943
-					foreach($setting['color']['palette']['theme'] as $color){
1944
-						$colors[$color['slug']] = esc_attr($color['color']);
1945
-					}
1946
-				}
1930
+            return str_replace( array(
1931
+                '<style>',
1932
+                '</style>'
1933
+            ), '', self::minify_css( ob_get_clean() ) );
1934
+        }
1947 1935
 
1948
-				if(!empty($setting['color']['palette']['custom'])){
1949
-					foreach($setting['color']['palette']['custom'] as $color){
1950
-						$colors[$color['slug']] = esc_attr($color['color']);
1951
-					}
1952
-				}
1953
-			}else{
1954
-				$settings = get_option('aui_options');
1955
-				$colors = array(
1956
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1958
-				);
1959
-			}
1960 1936
 
1961
-			ob_start();
1937
+        public static function custom_css($compatibility = true) {
1938
+            $colors = array();
1939
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1940
+
1941
+                $setting = wp_get_global_settings();
1942
+                if(!empty($setting['color']['palette']['theme'])){
1943
+                    foreach($setting['color']['palette']['theme'] as $color){
1944
+                        $colors[$color['slug']] = esc_attr($color['color']);
1945
+                    }
1946
+                }
1947
+
1948
+                if(!empty($setting['color']['palette']['custom'])){
1949
+                    foreach($setting['color']['palette']['custom'] as $color){
1950
+                        $colors[$color['slug']] = esc_attr($color['color']);
1951
+                    }
1952
+                }
1953
+            }else{
1954
+                $settings = get_option('aui_options');
1955
+                $colors = array(
1956
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1958
+                );
1959
+            }
1962 1960
 
1963
-			?>
1961
+            ob_start();
1962
+
1963
+            ?>
1964 1964
             <style>
1965 1965
                 <?php
1966 1966
 
1967
-					// BS v3 compat
1968
-					if( self::is_bs3_compat() ){
1969
-						echo self::bs3_compat_css();
1970
-					}
1967
+                    // BS v3 compat
1968
+                    if( self::is_bs3_compat() ){
1969
+                        echo self::bs3_compat_css();
1970
+                    }
1971 1971
 
1972
-					if(!empty($colors)){
1973
-						$d_colors = self::get_colors(true);
1974
-						//print_r($d_colors );exit;
1972
+                    if(!empty($colors)){
1973
+                        $d_colors = self::get_colors(true);
1974
+                        //print_r($d_colors );exit;
1975 1975
 //                        print_r($colors );exit;
1976
-						$is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1977
-						foreach($colors as $key => $color ){
1978
-							if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1979
-								$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1980
-								$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1981
-								echo self::css_overwrite($key,$var,$compat);
1982
-							}
1983
-						}
1984
-					   // exit;
1985
-					}
1976
+                        $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1977
+                        foreach($colors as $key => $color ){
1978
+                            if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1979
+                                $var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1980
+                                $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1981
+                                echo self::css_overwrite($key,$var,$compat);
1982
+                            }
1983
+                        }
1984
+                        // exit;
1985
+                    }
1986 1986
 
1987
-					// Set admin bar z-index lower when modal is open.
1988
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1987
+                    // Set admin bar z-index lower when modal is open.
1988
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1989 1989
 
1990
-					if(is_admin()){
1991
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1992
-					}
1993
-				?>
1990
+                    if(is_admin()){
1991
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1992
+                    }
1993
+                ?>
1994 1994
             </style>
1995 1995
 			<?php
1996 1996
 
1997 1997
 
1998
-			/*
1998
+            /*
1999 1999
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2000 2000
 			 */
2001
-			return str_replace( array(
2002
-				'<style>',
2003
-				'</style>'
2004
-			), '', self::minify_css( ob_get_clean() ) );
2005
-		}
2006
-
2007
-
2008
-
2009
-		/**
2010
-		 * Check if we should add booststrap 3 compatibility changes.
2011
-		 *
2012
-		 * @return bool
2013
-		 */
2014
-		public static function is_bs3_compat(){
2015
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2016
-		}
2017
-
2018
-		/**
2019
-		 * Build the CSS to overwrite a bootstrap color variable.
2020
-		 *
2021
-		 * @param $type
2022
-		 * @param $color_code
2023
-		 * @param $compatibility
2024
-		 *
2025
-		 * @return string
2026
-		 */
2027
-		public static function css_overwrite($type,$color_code,$compatibility){
2028
-
2029
-			$is_var = false;
2030
-			if(!$color_code){return '';}
2031
-			if(!sanitize_hex_color($color_code)){
2032
-				$color_code = esc_attr($color_code);
2033
-				$is_var = true;
2001
+            return str_replace( array(
2002
+                '<style>',
2003
+                '</style>'
2004
+            ), '', self::minify_css( ob_get_clean() ) );
2005
+        }
2006
+
2007
+
2008
+
2009
+        /**
2010
+         * Check if we should add booststrap 3 compatibility changes.
2011
+         *
2012
+         * @return bool
2013
+         */
2014
+        public static function is_bs3_compat(){
2015
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2016
+        }
2017
+
2018
+        /**
2019
+         * Build the CSS to overwrite a bootstrap color variable.
2020
+         *
2021
+         * @param $type
2022
+         * @param $color_code
2023
+         * @param $compatibility
2024
+         *
2025
+         * @return string
2026
+         */
2027
+        public static function css_overwrite($type,$color_code,$compatibility){
2028
+
2029
+            $is_var = false;
2030
+            if(!$color_code){return '';}
2031
+            if(!sanitize_hex_color($color_code)){
2032
+                $color_code = esc_attr($color_code);
2033
+                $is_var = true;
2034 2034
 //                echo '###1'.$color_code;//exit;
2035
-			}
2036
-			if(!$color_code){return '';}
2035
+            }
2036
+            if(!$color_code){return '';}
2037 2037
 
2038
-			if($compatibility===true || $compatibility===1){
2039
-				$compatibility = '.bsui';
2040
-			}elseif(!$compatibility){
2041
-				$compatibility = '';
2042
-			}else{
2043
-				$compatibility = esc_attr($compatibility);
2044
-			}
2038
+            if($compatibility===true || $compatibility===1){
2039
+                $compatibility = '.bsui';
2040
+            }elseif(!$compatibility){
2041
+                $compatibility = '';
2042
+            }else{
2043
+                $compatibility = esc_attr($compatibility);
2044
+            }
2045 2045
 
2046 2046
 //            echo '####'.$color_code;exit;
2047 2047
 
2048
-			$type = sanitize_html_class($type);
2049
-
2050
-			/**
2051
-			 * c = color, b = background color, o = border-color, f = fill
2052
-			 */
2053
-			$selectors = array(
2054
-				".btn-{$type}"                                              => array( 'b', 'o' ),
2055
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2056
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2057
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2058
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2059
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2060
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2061
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2062
-				".badge-{$type}"                                            => array( 'b' ),
2063
-				".alert-{$type}"                                            => array( 'b', 'o' ),
2064
-				".bg-{$type}"                                               => array( 'b', 'f' ),
2065
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
2066
-			);
2067
-
2068
-			if ( $type == 'primary' ) {
2069
-				$selectors = $selectors + array(
2070
-						'a'                                                                                                    => array( 'c' ),
2071
-						'.btn-link'                                                                                            => array( 'c' ),
2072
-						'.dropdown-item.active'                                                                                => array( 'b' ),
2073
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
2074
-							'b',
2075
-							'o'
2076
-						),
2077
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2078
-							'b',
2079
-							'o'
2080
-						),
2081
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2082
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2083
-						'.page-link'                                                                                           => array( 'c' ),
2084
-						'.page-item.active .page-link'                                                                         => array(
2085
-							'b',
2086
-							'o'
2087
-						),
2088
-						'.progress-bar'                                                                                        => array( 'b' ),
2089
-						'.list-group-item.active'                                                                              => array(
2090
-							'b',
2091
-							'o'
2092
-						),
2093
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2048
+            $type = sanitize_html_class($type);
2049
+
2050
+            /**
2051
+             * c = color, b = background color, o = border-color, f = fill
2052
+             */
2053
+            $selectors = array(
2054
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
2055
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2056
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2057
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2058
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2059
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2060
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2061
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2062
+                ".badge-{$type}"                                            => array( 'b' ),
2063
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
2064
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
2065
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
2066
+            );
2067
+
2068
+            if ( $type == 'primary' ) {
2069
+                $selectors = $selectors + array(
2070
+                        'a'                                                                                                    => array( 'c' ),
2071
+                        '.btn-link'                                                                                            => array( 'c' ),
2072
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
2073
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
2074
+                            'b',
2075
+                            'o'
2076
+                        ),
2077
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2078
+                            'b',
2079
+                            'o'
2080
+                        ),
2081
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2082
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2083
+                        '.page-link'                                                                                           => array( 'c' ),
2084
+                        '.page-item.active .page-link'                                                                         => array(
2085
+                            'b',
2086
+                            'o'
2087
+                        ),
2088
+                        '.progress-bar'                                                                                        => array( 'b' ),
2089
+                        '.list-group-item.active'                                                                              => array(
2090
+                            'b',
2091
+                            'o'
2092
+                        ),
2093
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2094 2094
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2095 2095
 //				    '.custom-range::-moz-range-thumb' => array('b'),
2096 2096
 //				    '.custom-range::-ms-thumb' => array('b'),
2097
-					);
2098
-			}
2099
-
2100
-			$important_selectors = array(
2101
-				".bg-{$type}" => array('b','f'),
2102
-				".border-{$type}" => array('o'),
2103
-				".text-{$type}" => array('c'),
2104
-			);
2105
-
2106
-			$color = array();
2107
-			$color_i = array();
2108
-			$background = array();
2109
-			$background_i = array();
2110
-			$border = array();
2111
-			$border_i = array();
2112
-			$fill = array();
2113
-			$fill_i = array();
2114
-
2115
-			$output = '';
2116
-
2117
-			// build rules into each type
2118
-			foreach($selectors as $selector => $types){
2119
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2120
-				$types = array_combine($types,$types);
2121
-				if(isset($types['c'])){$color[] = $selector;}
2122
-				if(isset($types['b'])){$background[] = $selector;}
2123
-				if(isset($types['o'])){$border[] = $selector;}
2124
-				if(isset($types['f'])){$fill[] = $selector;}
2125
-			}
2126
-
2127
-			// build rules into each type
2128
-			foreach($important_selectors as $selector => $types){
2129
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2130
-				$types = array_combine($types,$types);
2131
-				if(isset($types['c'])){$color_i[] = $selector;}
2132
-				if(isset($types['b'])){$background_i[] = $selector;}
2133
-				if(isset($types['o'])){$border_i[] = $selector;}
2134
-				if(isset($types['f'])){$fill_i[] = $selector;}
2135
-			}
2136
-
2137
-			// add any color rules
2138
-			if(!empty($color)){
2139
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2140
-			}
2141
-			if(!empty($color_i)){
2142
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2143
-			}
2144
-
2145
-			// add any background color rules
2146
-			if(!empty($background)){
2147
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2148
-			}
2149
-			if(!empty($background_i)){
2150
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2151
-			}
2152
-
2153
-			// add any border color rules
2154
-			if(!empty($border)){
2155
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2156
-			}
2157
-			if(!empty($border_i)){
2158
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2159
-			}
2160
-
2161
-			// add any fill color rules
2162
-			if(!empty($fill)){
2163
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2164
-			}
2165
-			if(!empty($fill_i)){
2166
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2167
-			}
2168
-
2169
-
2170
-			$prefix = $compatibility ? $compatibility . " " : "";
2171
-
2172
-			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
2173
-			// darken
2174
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2175
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2176
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2177
-
2178
-			// lighten
2179
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2180
-
2181
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2182
-			$op_25 = $color_code."40"; // 25% opacity
2183
-
2184
-
2185
-			// button states
2186
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2187
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2097
+                    );
2098
+            }
2099
+
2100
+            $important_selectors = array(
2101
+                ".bg-{$type}" => array('b','f'),
2102
+                ".border-{$type}" => array('o'),
2103
+                ".text-{$type}" => array('c'),
2104
+            );
2105
+
2106
+            $color = array();
2107
+            $color_i = array();
2108
+            $background = array();
2109
+            $background_i = array();
2110
+            $border = array();
2111
+            $border_i = array();
2112
+            $fill = array();
2113
+            $fill_i = array();
2114
+
2115
+            $output = '';
2116
+
2117
+            // build rules into each type
2118
+            foreach($selectors as $selector => $types){
2119
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2120
+                $types = array_combine($types,$types);
2121
+                if(isset($types['c'])){$color[] = $selector;}
2122
+                if(isset($types['b'])){$background[] = $selector;}
2123
+                if(isset($types['o'])){$border[] = $selector;}
2124
+                if(isset($types['f'])){$fill[] = $selector;}
2125
+            }
2126
+
2127
+            // build rules into each type
2128
+            foreach($important_selectors as $selector => $types){
2129
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2130
+                $types = array_combine($types,$types);
2131
+                if(isset($types['c'])){$color_i[] = $selector;}
2132
+                if(isset($types['b'])){$background_i[] = $selector;}
2133
+                if(isset($types['o'])){$border_i[] = $selector;}
2134
+                if(isset($types['f'])){$fill_i[] = $selector;}
2135
+            }
2136
+
2137
+            // add any color rules
2138
+            if(!empty($color)){
2139
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2140
+            }
2141
+            if(!empty($color_i)){
2142
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2143
+            }
2144
+
2145
+            // add any background color rules
2146
+            if(!empty($background)){
2147
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2148
+            }
2149
+            if(!empty($background_i)){
2150
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2151
+            }
2152
+
2153
+            // add any border color rules
2154
+            if(!empty($border)){
2155
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2156
+            }
2157
+            if(!empty($border_i)){
2158
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2159
+            }
2160
+
2161
+            // add any fill color rules
2162
+            if(!empty($fill)){
2163
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2164
+            }
2165
+            if(!empty($fill_i)){
2166
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2167
+            }
2168
+
2169
+
2170
+            $prefix = $compatibility ? $compatibility . " " : "";
2171
+
2172
+            $transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
2173
+            // darken
2174
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2175
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2176
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2177
+
2178
+            // lighten
2179
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2180
+
2181
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2182
+            $op_25 = $color_code."40"; // 25% opacity
2183
+
2184
+
2185
+            // button states
2186
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2187
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2188 2188
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
2189
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2190
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2191
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2192
-
2193
-			if ( $type == 'primary' ) {
2194
-				// dropdown's
2195
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2196
-
2197
-				// input states
2198
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2199
-
2200
-				// page link
2201
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2202
-			}
2203
-
2204
-			return $output;
2205
-		}
2206
-
2207
-		/**
2208
-		 *
2209
-		 * @deprecated 0.1.76 Use css_overwrite()
2210
-		 *
2211
-		 * @param $color_code
2212
-		 * @param $compatibility
2213
-		 * @param $use_variable
2214
-		 *
2215
-		 * @return string
2216
-		 */
2217
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
2218
-
2219
-			if(!$use_variable){
2220
-				$color_code = sanitize_hex_color($color_code);
2221
-				if(!$color_code){return '';}
2222
-			}
2223
-
2224
-			/**
2225
-			 * c = color, b = background color, o = border-color, f = fill
2226
-			 */
2227
-			$selectors = array(
2228
-				'a' => array('c'),
2229
-				'.btn-primary' => array('b','o'),
2230
-				'.btn-primary.disabled' => array('b','o'),
2231
-				'.btn-primary:disabled' => array('b','o'),
2232
-				'.btn-outline-primary' => array('c','o'),
2233
-				'.btn-outline-primary:hover' => array('b','o'),
2234
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2235
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2236
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2237
-				'.btn-link' => array('c'),
2238
-				'.dropdown-item.active' => array('b'),
2239
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2240
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2189
+            $output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2190
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2191
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2192
+
2193
+            if ( $type == 'primary' ) {
2194
+                // dropdown's
2195
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2196
+
2197
+                // input states
2198
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2199
+
2200
+                // page link
2201
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2202
+            }
2203
+
2204
+            return $output;
2205
+        }
2206
+
2207
+        /**
2208
+         *
2209
+         * @deprecated 0.1.76 Use css_overwrite()
2210
+         *
2211
+         * @param $color_code
2212
+         * @param $compatibility
2213
+         * @param $use_variable
2214
+         *
2215
+         * @return string
2216
+         */
2217
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
2218
+
2219
+            if(!$use_variable){
2220
+                $color_code = sanitize_hex_color($color_code);
2221
+                if(!$color_code){return '';}
2222
+            }
2223
+
2224
+            /**
2225
+             * c = color, b = background color, o = border-color, f = fill
2226
+             */
2227
+            $selectors = array(
2228
+                'a' => array('c'),
2229
+                '.btn-primary' => array('b','o'),
2230
+                '.btn-primary.disabled' => array('b','o'),
2231
+                '.btn-primary:disabled' => array('b','o'),
2232
+                '.btn-outline-primary' => array('c','o'),
2233
+                '.btn-outline-primary:hover' => array('b','o'),
2234
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2235
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2236
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2237
+                '.btn-link' => array('c'),
2238
+                '.dropdown-item.active' => array('b'),
2239
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2240
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2241 2241
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2242 2242
 //				'.custom-range::-moz-range-thumb' => array('b'),
2243 2243
 //				'.custom-range::-ms-thumb' => array('b'),
2244
-				'.nav-pills .nav-link.active' => array('b'),
2245
-				'.nav-pills .show>.nav-link' => array('b'),
2246
-				'.page-link' => array('c'),
2247
-				'.page-item.active .page-link' => array('b','o'),
2248
-				'.badge-primary' => array('b'),
2249
-				'.alert-primary' => array('b','o'),
2250
-				'.progress-bar' => array('b'),
2251
-				'.list-group-item.active' => array('b','o'),
2252
-				'.bg-primary' => array('b','f'),
2253
-				'.btn-link.btn-primary' => array('c'),
2254
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2255
-			);
2256
-
2257
-			$important_selectors = array(
2258
-				'.bg-primary' => array('b','f'),
2259
-				'.border-primary' => array('o'),
2260
-				'.text-primary' => array('c'),
2261
-			);
2262
-
2263
-			$color = array();
2264
-			$color_i = array();
2265
-			$background = array();
2266
-			$background_i = array();
2267
-			$border = array();
2268
-			$border_i = array();
2269
-			$fill = array();
2270
-			$fill_i = array();
2271
-
2272
-			$output = '';
2273
-
2274
-			// build rules into each type
2275
-			foreach($selectors as $selector => $types){
2276
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2277
-				$types = array_combine($types,$types);
2278
-				if(isset($types['c'])){$color[] = $selector;}
2279
-				if(isset($types['b'])){$background[] = $selector;}
2280
-				if(isset($types['o'])){$border[] = $selector;}
2281
-				if(isset($types['f'])){$fill[] = $selector;}
2282
-			}
2283
-
2284
-			// build rules into each type
2285
-			foreach($important_selectors as $selector => $types){
2286
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2287
-				$types = array_combine($types,$types);
2288
-				if(isset($types['c'])){$color_i[] = $selector;}
2289
-				if(isset($types['b'])){$background_i[] = $selector;}
2290
-				if(isset($types['o'])){$border_i[] = $selector;}
2291
-				if(isset($types['f'])){$fill_i[] = $selector;}
2292
-			}
2293
-
2294
-			// add any color rules
2295
-			if(!empty($color)){
2296
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2297
-			}
2298
-			if(!empty($color_i)){
2299
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2300
-			}
2301
-
2302
-			// add any background color rules
2303
-			if(!empty($background)){
2304
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2305
-			}
2306
-			if(!empty($background_i)){
2307
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2308
-			}
2309
-
2310
-			// add any border color rules
2311
-			if(!empty($border)){
2312
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2313
-			}
2314
-			if(!empty($border_i)){
2315
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2316
-			}
2317
-
2318
-			// add any fill color rules
2319
-			if(!empty($fill)){
2320
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2321
-			}
2322
-			if(!empty($fill_i)){
2323
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2324
-			}
2325
-
2326
-
2327
-			$prefix = $compatibility ? ".bsui " : "";
2328
-
2329
-			// darken
2330
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2331
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2332
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2333
-
2334
-			// lighten
2335
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2336
-
2337
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2338
-			$op_25 = $color_code."40"; // 25% opacity
2339
-
2340
-
2341
-			// button states
2342
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2343
-			$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;} ";
2344
-			$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.";} ";
2345
-			$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;} ";
2346
-
2347
-
2348
-			// dropdown's
2349
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2350
-
2351
-
2352
-			// input states
2353
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2354
-
2355
-			// page link
2356
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2357
-
2358
-			return $output;
2359
-		}
2360
-
2361
-		/**
2362
-		 *
2363
-		 * @deprecated 0.1.76 Use css_overwrite()
2364
-		 *
2365
-		 * @param $color_code
2366
-		 * @param $compatibility
2367
-		 *
2368
-		 * @return string
2369
-		 */
2370
-		public static function css_secondary($color_code,$compatibility){;
2371
-			$color_code = sanitize_hex_color($color_code);
2372
-			if(!$color_code){return '';}
2373
-			/**
2374
-			 * c = color, b = background color, o = border-color, f = fill
2375
-			 */
2376
-			$selectors = array(
2377
-				'.btn-secondary' => array('b','o'),
2378
-				'.btn-secondary.disabled' => array('b','o'),
2379
-				'.btn-secondary:disabled' => array('b','o'),
2380
-				'.btn-outline-secondary' => array('c','o'),
2381
-				'.btn-outline-secondary:hover' => array('b','o'),
2382
-				'.btn-outline-secondary.disabled' => array('c'),
2383
-				'.btn-outline-secondary:disabled' => array('c'),
2384
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2385
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2386
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2387
-				'.badge-secondary' => array('b'),
2388
-				'.alert-secondary' => array('b','o'),
2389
-				'.btn-link.btn-secondary' => array('c'),
2390
-			);
2391
-
2392
-			$important_selectors = array(
2393
-				'.bg-secondary' => array('b','f'),
2394
-				'.border-secondary' => array('o'),
2395
-				'.text-secondary' => array('c'),
2396
-			);
2397
-
2398
-			$color = array();
2399
-			$color_i = array();
2400
-			$background = array();
2401
-			$background_i = array();
2402
-			$border = array();
2403
-			$border_i = array();
2404
-			$fill = array();
2405
-			$fill_i = array();
2406
-
2407
-			$output = '';
2408
-
2409
-			// build rules into each type
2410
-			foreach($selectors as $selector => $types){
2411
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2412
-				$types = array_combine($types,$types);
2413
-				if(isset($types['c'])){$color[] = $selector;}
2414
-				if(isset($types['b'])){$background[] = $selector;}
2415
-				if(isset($types['o'])){$border[] = $selector;}
2416
-				if(isset($types['f'])){$fill[] = $selector;}
2417
-			}
2418
-
2419
-			// build rules into each type
2420
-			foreach($important_selectors as $selector => $types){
2421
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2422
-				$types = array_combine($types,$types);
2423
-				if(isset($types['c'])){$color_i[] = $selector;}
2424
-				if(isset($types['b'])){$background_i[] = $selector;}
2425
-				if(isset($types['o'])){$border_i[] = $selector;}
2426
-				if(isset($types['f'])){$fill_i[] = $selector;}
2427
-			}
2428
-
2429
-			// add any color rules
2430
-			if(!empty($color)){
2431
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2432
-			}
2433
-			if(!empty($color_i)){
2434
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2435
-			}
2436
-
2437
-			// add any background color rules
2438
-			if(!empty($background)){
2439
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2440
-			}
2441
-			if(!empty($background_i)){
2442
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2443
-			}
2444
-
2445
-			// add any border color rules
2446
-			if(!empty($border)){
2447
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2448
-			}
2449
-			if(!empty($border_i)){
2450
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2451
-			}
2452
-
2453
-			// add any fill color rules
2454
-			if(!empty($fill)){
2455
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2456
-			}
2457
-			if(!empty($fill_i)){
2458
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2459
-			}
2460
-
2461
-
2462
-			$prefix = $compatibility ? ".bsui " : "";
2463
-
2464
-			// darken
2465
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2466
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2467
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2468
-
2469
-			// lighten
2470
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2471
-
2472
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2473
-			$op_25 = $color_code."40"; // 25% opacity
2474
-
2475
-
2476
-			// button states
2477
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2478
-			$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;} ";
2479
-			$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.";} ";
2480
-			$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;} ";
2481
-
2482
-
2483
-			return $output;
2484
-		}
2485
-
2486
-		/**
2487
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
2488
-		 *
2489
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2490
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2491
-		 *
2492
-		 * @return  string
2493
-		 */
2494
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2495
-			$hexCode = ltrim($hexCode, '#');
2496
-
2497
-			if (strlen($hexCode) == 3) {
2498
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2499
-			}
2500
-
2501
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
2502
-
2503
-			foreach ($hexCode as & $color) {
2504
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2505
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
2506
-
2507
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2508
-			}
2509
-
2510
-			return '#' . implode($hexCode);
2511
-		}
2512
-
2513
-		/**
2514
-		 * Check if we should display examples.
2515
-		 */
2516
-		public function maybe_show_examples(){
2517
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2518
-				echo "<head>";
2519
-				wp_head();
2520
-				echo "</head>";
2521
-				echo "<body>";
2522
-				echo $this->get_examples();
2523
-				echo "</body>";
2524
-				exit;
2525
-			}
2526
-		}
2527
-
2528
-		/**
2529
-		 * Get developer examples.
2530
-		 *
2531
-		 * @return string
2532
-		 */
2533
-		public function get_examples(){
2534
-			$output = '';
2535
-
2536
-
2537
-			// open form
2538
-			$output .= "<form class='p-5 m-5 border rounded'>";
2539
-
2540
-			// input example
2541
-			$output .= aui()->input(array(
2542
-				'type'  =>  'text',
2543
-				'id'    =>  'text-example',
2544
-				'name'    =>  'text-example',
2545
-				'placeholder'   => 'text placeholder',
2546
-				'title'   => 'Text input example',
2547
-				'value' =>  '',
2548
-				'required'  => false,
2549
-				'help_text' => 'help text',
2550
-				'label' => 'Text input example label'
2551
-			));
2552
-
2553
-			// input example
2554
-			$output .= aui()->input(array(
2555
-				'type'  =>  'url',
2556
-				'id'    =>  'text-example2',
2557
-				'name'    =>  'text-example',
2558
-				'placeholder'   => 'url placeholder',
2559
-				'title'   => 'Text input example',
2560
-				'value' =>  '',
2561
-				'required'  => false,
2562
-				'help_text' => 'help text',
2563
-				'label' => 'Text input example label'
2564
-			));
2565
-
2566
-			// checkbox example
2567
-			$output .= aui()->input(array(
2568
-				'type'  =>  'checkbox',
2569
-				'id'    =>  'checkbox-example',
2570
-				'name'    =>  'checkbox-example',
2571
-				'placeholder'   => 'checkbox-example',
2572
-				'title'   => 'Checkbox example',
2573
-				'value' =>  '1',
2574
-				'checked'   => true,
2575
-				'required'  => false,
2576
-				'help_text' => 'help text',
2577
-				'label' => 'Checkbox checked'
2578
-			));
2579
-
2580
-			// checkbox example
2581
-			$output .= aui()->input(array(
2582
-				'type'  =>  'checkbox',
2583
-				'id'    =>  'checkbox-example2',
2584
-				'name'    =>  'checkbox-example2',
2585
-				'placeholder'   => 'checkbox-example',
2586
-				'title'   => 'Checkbox example',
2587
-				'value' =>  '1',
2588
-				'checked'   => false,
2589
-				'required'  => false,
2590
-				'help_text' => 'help text',
2591
-				'label' => 'Checkbox un-checked'
2592
-			));
2593
-
2594
-			// switch example
2595
-			$output .= aui()->input(array(
2596
-				'type'  =>  'checkbox',
2597
-				'id'    =>  'switch-example',
2598
-				'name'    =>  'switch-example',
2599
-				'placeholder'   => 'checkbox-example',
2600
-				'title'   => 'Switch example',
2601
-				'value' =>  '1',
2602
-				'checked'   => true,
2603
-				'switch'    => true,
2604
-				'required'  => false,
2605
-				'help_text' => 'help text',
2606
-				'label' => 'Switch on'
2607
-			));
2608
-
2609
-			// switch example
2610
-			$output .= aui()->input(array(
2611
-				'type'  =>  'checkbox',
2612
-				'id'    =>  'switch-example2',
2613
-				'name'    =>  'switch-example2',
2614
-				'placeholder'   => 'checkbox-example',
2615
-				'title'   => 'Switch example',
2616
-				'value' =>  '1',
2617
-				'checked'   => false,
2618
-				'switch'    => true,
2619
-				'required'  => false,
2620
-				'help_text' => 'help text',
2621
-				'label' => 'Switch off'
2622
-			));
2623
-
2624
-			// close form
2625
-			$output .= "</form>";
2626
-
2627
-			return $output;
2628
-		}
2629
-
2630
-		/**
2631
-		 * Calendar params.
2632
-		 *
2633
-		 * @since 0.1.44
2634
-		 *
2635
-		 * @return array Calendar params.
2636
-		 */
2637
-		public static function calendar_params() {
2638
-			$params = array(
2639
-				'month_long_1' => __( 'January', 'aui' ),
2640
-				'month_long_2' => __( 'February', 'aui' ),
2641
-				'month_long_3' => __( 'March', 'aui' ),
2642
-				'month_long_4' => __( 'April', 'aui' ),
2643
-				'month_long_5' => __( 'May', 'aui' ),
2644
-				'month_long_6' => __( 'June', 'aui' ),
2645
-				'month_long_7' => __( 'July', 'aui' ),
2646
-				'month_long_8' => __( 'August', 'aui' ),
2647
-				'month_long_9' => __( 'September', 'aui' ),
2648
-				'month_long_10' => __( 'October', 'aui' ),
2649
-				'month_long_11' => __( 'November', 'aui' ),
2650
-				'month_long_12' => __( 'December', 'aui' ),
2651
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2652
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2653
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2654
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2655
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2656
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2657
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2658
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2659
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2660
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2661
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2662
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2663
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2664
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2665
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2666
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2667
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2668
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2669
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2670
-				'day_s2_1' => __( 'Su', 'aui' ),
2671
-				'day_s2_2' => __( 'Mo', 'aui' ),
2672
-				'day_s2_3' => __( 'Tu', 'aui' ),
2673
-				'day_s2_4' => __( 'We', 'aui' ),
2674
-				'day_s2_5' => __( 'Th', 'aui' ),
2675
-				'day_s2_6' => __( 'Fr', 'aui' ),
2676
-				'day_s2_7' => __( 'Sa', 'aui' ),
2677
-				'day_s3_1' => __( 'Sun', 'aui' ),
2678
-				'day_s3_2' => __( 'Mon', 'aui' ),
2679
-				'day_s3_3' => __( 'Tue', 'aui' ),
2680
-				'day_s3_4' => __( 'Wed', 'aui' ),
2681
-				'day_s3_5' => __( 'Thu', 'aui' ),
2682
-				'day_s3_6' => __( 'Fri', 'aui' ),
2683
-				'day_s3_7' => __( 'Sat', 'aui' ),
2684
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2685
-				'day_s5_2' => __( 'Monday', 'aui' ),
2686
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2687
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2688
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2689
-				'day_s5_6' => __( 'Friday', 'aui' ),
2690
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2691
-				'am_lower' => __( 'am', 'aui' ),
2692
-				'pm_lower' => __( 'pm', 'aui' ),
2693
-				'am_upper' => __( 'AM', 'aui' ),
2694
-				'pm_upper' => __( 'PM', 'aui' ),
2695
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2696
-				'time_24hr' => false,
2697
-				'year' => __( 'Year', 'aui' ),
2698
-				'hour' => __( 'Hour', 'aui' ),
2699
-				'minute' => __( 'Minute', 'aui' ),
2700
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2701
-				'rangeSeparator' => __( ' to ', 'aui' ),
2702
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2703
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2704
-			);
2705
-
2706
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2707
-		}
2708
-
2709
-		/**
2710
-		 * Flatpickr calendar localize.
2711
-		 *
2712
-		 * @since 0.1.44
2713
-		 *
2714
-		 * @return string Calendar locale.
2715
-		 */
2716
-		public static function flatpickr_locale() {
2717
-			$params = self::calendar_params();
2718
-
2719
-			if ( is_string( $params ) ) {
2720
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2721
-			} else {
2722
-				foreach ( (array) $params as $key => $value ) {
2723
-					if ( ! is_scalar( $value ) ) {
2724
-						continue;
2725
-					}
2726
-
2727
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2728
-				}
2729
-			}
2244
+                '.nav-pills .nav-link.active' => array('b'),
2245
+                '.nav-pills .show>.nav-link' => array('b'),
2246
+                '.page-link' => array('c'),
2247
+                '.page-item.active .page-link' => array('b','o'),
2248
+                '.badge-primary' => array('b'),
2249
+                '.alert-primary' => array('b','o'),
2250
+                '.progress-bar' => array('b'),
2251
+                '.list-group-item.active' => array('b','o'),
2252
+                '.bg-primary' => array('b','f'),
2253
+                '.btn-link.btn-primary' => array('c'),
2254
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2255
+            );
2256
+
2257
+            $important_selectors = array(
2258
+                '.bg-primary' => array('b','f'),
2259
+                '.border-primary' => array('o'),
2260
+                '.text-primary' => array('c'),
2261
+            );
2262
+
2263
+            $color = array();
2264
+            $color_i = array();
2265
+            $background = array();
2266
+            $background_i = array();
2267
+            $border = array();
2268
+            $border_i = array();
2269
+            $fill = array();
2270
+            $fill_i = array();
2271
+
2272
+            $output = '';
2273
+
2274
+            // build rules into each type
2275
+            foreach($selectors as $selector => $types){
2276
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2277
+                $types = array_combine($types,$types);
2278
+                if(isset($types['c'])){$color[] = $selector;}
2279
+                if(isset($types['b'])){$background[] = $selector;}
2280
+                if(isset($types['o'])){$border[] = $selector;}
2281
+                if(isset($types['f'])){$fill[] = $selector;}
2282
+            }
2283
+
2284
+            // build rules into each type
2285
+            foreach($important_selectors as $selector => $types){
2286
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2287
+                $types = array_combine($types,$types);
2288
+                if(isset($types['c'])){$color_i[] = $selector;}
2289
+                if(isset($types['b'])){$background_i[] = $selector;}
2290
+                if(isset($types['o'])){$border_i[] = $selector;}
2291
+                if(isset($types['f'])){$fill_i[] = $selector;}
2292
+            }
2293
+
2294
+            // add any color rules
2295
+            if(!empty($color)){
2296
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2297
+            }
2298
+            if(!empty($color_i)){
2299
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2300
+            }
2301
+
2302
+            // add any background color rules
2303
+            if(!empty($background)){
2304
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2305
+            }
2306
+            if(!empty($background_i)){
2307
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2308
+            }
2309
+
2310
+            // add any border color rules
2311
+            if(!empty($border)){
2312
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2313
+            }
2314
+            if(!empty($border_i)){
2315
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2316
+            }
2317
+
2318
+            // add any fill color rules
2319
+            if(!empty($fill)){
2320
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2321
+            }
2322
+            if(!empty($fill_i)){
2323
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2324
+            }
2325
+
2326
+
2327
+            $prefix = $compatibility ? ".bsui " : "";
2328
+
2329
+            // darken
2330
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2331
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2332
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2333
+
2334
+            // lighten
2335
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2336
+
2337
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2338
+            $op_25 = $color_code."40"; // 25% opacity
2339
+
2340
+
2341
+            // button states
2342
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2343
+            $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;} ";
2344
+            $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.";} ";
2345
+            $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;} ";
2346
+
2347
+
2348
+            // dropdown's
2349
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2350
+
2351
+
2352
+            // input states
2353
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2354
+
2355
+            // page link
2356
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2357
+
2358
+            return $output;
2359
+        }
2360
+
2361
+        /**
2362
+         *
2363
+         * @deprecated 0.1.76 Use css_overwrite()
2364
+         *
2365
+         * @param $color_code
2366
+         * @param $compatibility
2367
+         *
2368
+         * @return string
2369
+         */
2370
+        public static function css_secondary($color_code,$compatibility){;
2371
+            $color_code = sanitize_hex_color($color_code);
2372
+            if(!$color_code){return '';}
2373
+            /**
2374
+             * c = color, b = background color, o = border-color, f = fill
2375
+             */
2376
+            $selectors = array(
2377
+                '.btn-secondary' => array('b','o'),
2378
+                '.btn-secondary.disabled' => array('b','o'),
2379
+                '.btn-secondary:disabled' => array('b','o'),
2380
+                '.btn-outline-secondary' => array('c','o'),
2381
+                '.btn-outline-secondary:hover' => array('b','o'),
2382
+                '.btn-outline-secondary.disabled' => array('c'),
2383
+                '.btn-outline-secondary:disabled' => array('c'),
2384
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2385
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2386
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2387
+                '.badge-secondary' => array('b'),
2388
+                '.alert-secondary' => array('b','o'),
2389
+                '.btn-link.btn-secondary' => array('c'),
2390
+            );
2391
+
2392
+            $important_selectors = array(
2393
+                '.bg-secondary' => array('b','f'),
2394
+                '.border-secondary' => array('o'),
2395
+                '.text-secondary' => array('c'),
2396
+            );
2397
+
2398
+            $color = array();
2399
+            $color_i = array();
2400
+            $background = array();
2401
+            $background_i = array();
2402
+            $border = array();
2403
+            $border_i = array();
2404
+            $fill = array();
2405
+            $fill_i = array();
2406
+
2407
+            $output = '';
2408
+
2409
+            // build rules into each type
2410
+            foreach($selectors as $selector => $types){
2411
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2412
+                $types = array_combine($types,$types);
2413
+                if(isset($types['c'])){$color[] = $selector;}
2414
+                if(isset($types['b'])){$background[] = $selector;}
2415
+                if(isset($types['o'])){$border[] = $selector;}
2416
+                if(isset($types['f'])){$fill[] = $selector;}
2417
+            }
2418
+
2419
+            // build rules into each type
2420
+            foreach($important_selectors as $selector => $types){
2421
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2422
+                $types = array_combine($types,$types);
2423
+                if(isset($types['c'])){$color_i[] = $selector;}
2424
+                if(isset($types['b'])){$background_i[] = $selector;}
2425
+                if(isset($types['o'])){$border_i[] = $selector;}
2426
+                if(isset($types['f'])){$fill_i[] = $selector;}
2427
+            }
2428
+
2429
+            // add any color rules
2430
+            if(!empty($color)){
2431
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2432
+            }
2433
+            if(!empty($color_i)){
2434
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2435
+            }
2436
+
2437
+            // add any background color rules
2438
+            if(!empty($background)){
2439
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2440
+            }
2441
+            if(!empty($background_i)){
2442
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2443
+            }
2444
+
2445
+            // add any border color rules
2446
+            if(!empty($border)){
2447
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2448
+            }
2449
+            if(!empty($border_i)){
2450
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2451
+            }
2452
+
2453
+            // add any fill color rules
2454
+            if(!empty($fill)){
2455
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2456
+            }
2457
+            if(!empty($fill_i)){
2458
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2459
+            }
2460
+
2461
+
2462
+            $prefix = $compatibility ? ".bsui " : "";
2463
+
2464
+            // darken
2465
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2466
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2467
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2468
+
2469
+            // lighten
2470
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2471
+
2472
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2473
+            $op_25 = $color_code."40"; // 25% opacity
2474
+
2475
+
2476
+            // button states
2477
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2478
+            $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;} ";
2479
+            $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.";} ";
2480
+            $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;} ";
2481
+
2482
+
2483
+            return $output;
2484
+        }
2485
+
2486
+        /**
2487
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
2488
+         *
2489
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2490
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2491
+         *
2492
+         * @return  string
2493
+         */
2494
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2495
+            $hexCode = ltrim($hexCode, '#');
2496
+
2497
+            if (strlen($hexCode) == 3) {
2498
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2499
+            }
2500
+
2501
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
2502
+
2503
+            foreach ($hexCode as & $color) {
2504
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2505
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
2506
+
2507
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2508
+            }
2509
+
2510
+            return '#' . implode($hexCode);
2511
+        }
2512
+
2513
+        /**
2514
+         * Check if we should display examples.
2515
+         */
2516
+        public function maybe_show_examples(){
2517
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2518
+                echo "<head>";
2519
+                wp_head();
2520
+                echo "</head>";
2521
+                echo "<body>";
2522
+                echo $this->get_examples();
2523
+                echo "</body>";
2524
+                exit;
2525
+            }
2526
+        }
2527
+
2528
+        /**
2529
+         * Get developer examples.
2530
+         *
2531
+         * @return string
2532
+         */
2533
+        public function get_examples(){
2534
+            $output = '';
2535
+
2536
+
2537
+            // open form
2538
+            $output .= "<form class='p-5 m-5 border rounded'>";
2539
+
2540
+            // input example
2541
+            $output .= aui()->input(array(
2542
+                'type'  =>  'text',
2543
+                'id'    =>  'text-example',
2544
+                'name'    =>  'text-example',
2545
+                'placeholder'   => 'text placeholder',
2546
+                'title'   => 'Text input example',
2547
+                'value' =>  '',
2548
+                'required'  => false,
2549
+                'help_text' => 'help text',
2550
+                'label' => 'Text input example label'
2551
+            ));
2552
+
2553
+            // input example
2554
+            $output .= aui()->input(array(
2555
+                'type'  =>  'url',
2556
+                'id'    =>  'text-example2',
2557
+                'name'    =>  'text-example',
2558
+                'placeholder'   => 'url placeholder',
2559
+                'title'   => 'Text input example',
2560
+                'value' =>  '',
2561
+                'required'  => false,
2562
+                'help_text' => 'help text',
2563
+                'label' => 'Text input example label'
2564
+            ));
2565
+
2566
+            // checkbox example
2567
+            $output .= aui()->input(array(
2568
+                'type'  =>  'checkbox',
2569
+                'id'    =>  'checkbox-example',
2570
+                'name'    =>  'checkbox-example',
2571
+                'placeholder'   => 'checkbox-example',
2572
+                'title'   => 'Checkbox example',
2573
+                'value' =>  '1',
2574
+                'checked'   => true,
2575
+                'required'  => false,
2576
+                'help_text' => 'help text',
2577
+                'label' => 'Checkbox checked'
2578
+            ));
2579
+
2580
+            // checkbox example
2581
+            $output .= aui()->input(array(
2582
+                'type'  =>  'checkbox',
2583
+                'id'    =>  'checkbox-example2',
2584
+                'name'    =>  'checkbox-example2',
2585
+                'placeholder'   => 'checkbox-example',
2586
+                'title'   => 'Checkbox example',
2587
+                'value' =>  '1',
2588
+                'checked'   => false,
2589
+                'required'  => false,
2590
+                'help_text' => 'help text',
2591
+                'label' => 'Checkbox un-checked'
2592
+            ));
2593
+
2594
+            // switch example
2595
+            $output .= aui()->input(array(
2596
+                'type'  =>  'checkbox',
2597
+                'id'    =>  'switch-example',
2598
+                'name'    =>  'switch-example',
2599
+                'placeholder'   => 'checkbox-example',
2600
+                'title'   => 'Switch example',
2601
+                'value' =>  '1',
2602
+                'checked'   => true,
2603
+                'switch'    => true,
2604
+                'required'  => false,
2605
+                'help_text' => 'help text',
2606
+                'label' => 'Switch on'
2607
+            ));
2608
+
2609
+            // switch example
2610
+            $output .= aui()->input(array(
2611
+                'type'  =>  'checkbox',
2612
+                'id'    =>  'switch-example2',
2613
+                'name'    =>  'switch-example2',
2614
+                'placeholder'   => 'checkbox-example',
2615
+                'title'   => 'Switch example',
2616
+                'value' =>  '1',
2617
+                'checked'   => false,
2618
+                'switch'    => true,
2619
+                'required'  => false,
2620
+                'help_text' => 'help text',
2621
+                'label' => 'Switch off'
2622
+            ));
2623
+
2624
+            // close form
2625
+            $output .= "</form>";
2626
+
2627
+            return $output;
2628
+        }
2629
+
2630
+        /**
2631
+         * Calendar params.
2632
+         *
2633
+         * @since 0.1.44
2634
+         *
2635
+         * @return array Calendar params.
2636
+         */
2637
+        public static function calendar_params() {
2638
+            $params = array(
2639
+                'month_long_1' => __( 'January', 'aui' ),
2640
+                'month_long_2' => __( 'February', 'aui' ),
2641
+                'month_long_3' => __( 'March', 'aui' ),
2642
+                'month_long_4' => __( 'April', 'aui' ),
2643
+                'month_long_5' => __( 'May', 'aui' ),
2644
+                'month_long_6' => __( 'June', 'aui' ),
2645
+                'month_long_7' => __( 'July', 'aui' ),
2646
+                'month_long_8' => __( 'August', 'aui' ),
2647
+                'month_long_9' => __( 'September', 'aui' ),
2648
+                'month_long_10' => __( 'October', 'aui' ),
2649
+                'month_long_11' => __( 'November', 'aui' ),
2650
+                'month_long_12' => __( 'December', 'aui' ),
2651
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2652
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2653
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2654
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2655
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2656
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2657
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2658
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2659
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2660
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2661
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2662
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2663
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2664
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2665
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2666
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2667
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2668
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2669
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2670
+                'day_s2_1' => __( 'Su', 'aui' ),
2671
+                'day_s2_2' => __( 'Mo', 'aui' ),
2672
+                'day_s2_3' => __( 'Tu', 'aui' ),
2673
+                'day_s2_4' => __( 'We', 'aui' ),
2674
+                'day_s2_5' => __( 'Th', 'aui' ),
2675
+                'day_s2_6' => __( 'Fr', 'aui' ),
2676
+                'day_s2_7' => __( 'Sa', 'aui' ),
2677
+                'day_s3_1' => __( 'Sun', 'aui' ),
2678
+                'day_s3_2' => __( 'Mon', 'aui' ),
2679
+                'day_s3_3' => __( 'Tue', 'aui' ),
2680
+                'day_s3_4' => __( 'Wed', 'aui' ),
2681
+                'day_s3_5' => __( 'Thu', 'aui' ),
2682
+                'day_s3_6' => __( 'Fri', 'aui' ),
2683
+                'day_s3_7' => __( 'Sat', 'aui' ),
2684
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2685
+                'day_s5_2' => __( 'Monday', 'aui' ),
2686
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2687
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2688
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2689
+                'day_s5_6' => __( 'Friday', 'aui' ),
2690
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2691
+                'am_lower' => __( 'am', 'aui' ),
2692
+                'pm_lower' => __( 'pm', 'aui' ),
2693
+                'am_upper' => __( 'AM', 'aui' ),
2694
+                'pm_upper' => __( 'PM', 'aui' ),
2695
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2696
+                'time_24hr' => false,
2697
+                'year' => __( 'Year', 'aui' ),
2698
+                'hour' => __( 'Hour', 'aui' ),
2699
+                'minute' => __( 'Minute', 'aui' ),
2700
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2701
+                'rangeSeparator' => __( ' to ', 'aui' ),
2702
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2703
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2704
+            );
2705
+
2706
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2707
+        }
2708
+
2709
+        /**
2710
+         * Flatpickr calendar localize.
2711
+         *
2712
+         * @since 0.1.44
2713
+         *
2714
+         * @return string Calendar locale.
2715
+         */
2716
+        public static function flatpickr_locale() {
2717
+            $params = self::calendar_params();
2718
+
2719
+            if ( is_string( $params ) ) {
2720
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2721
+            } else {
2722
+                foreach ( (array) $params as $key => $value ) {
2723
+                    if ( ! is_scalar( $value ) ) {
2724
+                        continue;
2725
+                    }
2726
+
2727
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2728
+                }
2729
+            }
2730 2730
 
2731
-			$day_s3 = array();
2732
-			$day_s5 = array();
2731
+            $day_s3 = array();
2732
+            $day_s5 = array();
2733 2733
 
2734
-			for ( $i = 1; $i <= 7; $i ++ ) {
2735
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2736
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2737
-			}
2734
+            for ( $i = 1; $i <= 7; $i ++ ) {
2735
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2736
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2737
+            }
2738 2738
 
2739
-			$month_s = array();
2740
-			$month_long = array();
2739
+            $month_s = array();
2740
+            $month_long = array();
2741 2741
 
2742
-			for ( $i = 1; $i <= 12; $i ++ ) {
2743
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2744
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2745
-			}
2742
+            for ( $i = 1; $i <= 12; $i ++ ) {
2743
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2744
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2745
+            }
2746 2746
 
2747
-			ob_start();
2748
-		if ( 0 ) { ?><script><?php } ?>
2747
+            ob_start();
2748
+        if ( 0 ) { ?><script><?php } ?>
2749 2749
                 {
2750 2750
                     weekdays: {
2751 2751
                         shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
@@ -2784,189 +2784,189 @@  discard block
 block discarded – undo
2784 2784
                 }
2785 2785
 				<?php if ( 0 ) { ?></script><?php } ?>
2786 2786
 			<?php
2787
-			$locale = ob_get_clean();
2788
-
2789
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2790
-		}
2791
-
2792
-		/**
2793
-		 * Select2 JS params.
2794
-		 *
2795
-		 * @since 0.1.44
2796
-		 *
2797
-		 * @return array Select2 JS params.
2798
-		 */
2799
-		public static function select2_params() {
2800
-			$params = array(
2801
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2802
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2803
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2804
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2805
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2806
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2807
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2808
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2809
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2810
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2811
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2812
-			);
2813
-
2814
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2815
-		}
2816
-
2817
-		/**
2818
-		 * Select2 JS localize.
2819
-		 *
2820
-		 * @since 0.1.44
2821
-		 *
2822
-		 * @return string Select2 JS locale.
2823
-		 */
2824
-		public static function select2_locale() {
2825
-			$params = self::select2_params();
2826
-
2827
-			foreach ( (array) $params as $key => $value ) {
2828
-				if ( ! is_scalar( $value ) ) {
2829
-					continue;
2830
-				}
2787
+            $locale = ob_get_clean();
2788
+
2789
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2790
+        }
2791
+
2792
+        /**
2793
+         * Select2 JS params.
2794
+         *
2795
+         * @since 0.1.44
2796
+         *
2797
+         * @return array Select2 JS params.
2798
+         */
2799
+        public static function select2_params() {
2800
+            $params = array(
2801
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2802
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2803
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2804
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2805
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2806
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2807
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2808
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2809
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2810
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2811
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2812
+            );
2813
+
2814
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2815
+        }
2816
+
2817
+        /**
2818
+         * Select2 JS localize.
2819
+         *
2820
+         * @since 0.1.44
2821
+         *
2822
+         * @return string Select2 JS locale.
2823
+         */
2824
+        public static function select2_locale() {
2825
+            $params = self::select2_params();
2826
+
2827
+            foreach ( (array) $params as $key => $value ) {
2828
+                if ( ! is_scalar( $value ) ) {
2829
+                    continue;
2830
+                }
2831 2831
 
2832
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2833
-			}
2834
-
2835
-			$locale = json_encode( $params );
2836
-
2837
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2838
-		}
2839
-
2840
-		/**
2841
-		 * Time ago JS localize.
2842
-		 *
2843
-		 * @since 0.1.47
2844
-		 *
2845
-		 * @return string Time ago JS locale.
2846
-		 */
2847
-		public static function timeago_locale() {
2848
-			$params = array(
2849
-				'prefix_ago' => '',
2850
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2851
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2852
-				'suffix_after' => '',
2853
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2854
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2855
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2856
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2857
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2858
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2859
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2860
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2861
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2862
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2863
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2864
-			);
2865
-
2866
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2867
-
2868
-			foreach ( (array) $params as $key => $value ) {
2869
-				if ( ! is_scalar( $value ) ) {
2870
-					continue;
2871
-				}
2832
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2833
+            }
2834
+
2835
+            $locale = json_encode( $params );
2836
+
2837
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2838
+        }
2839
+
2840
+        /**
2841
+         * Time ago JS localize.
2842
+         *
2843
+         * @since 0.1.47
2844
+         *
2845
+         * @return string Time ago JS locale.
2846
+         */
2847
+        public static function timeago_locale() {
2848
+            $params = array(
2849
+                'prefix_ago' => '',
2850
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2851
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2852
+                'suffix_after' => '',
2853
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2854
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2855
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2856
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2857
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2858
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2859
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2860
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2861
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2862
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2863
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2864
+            );
2865
+
2866
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2867
+
2868
+            foreach ( (array) $params as $key => $value ) {
2869
+                if ( ! is_scalar( $value ) ) {
2870
+                    continue;
2871
+                }
2872 2872
 
2873
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2874
-			}
2875
-
2876
-			$locale = json_encode( $params );
2877
-
2878
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2879
-		}
2880
-
2881
-		/**
2882
-		 * JavaScript Minifier
2883
-		 *
2884
-		 * @param $input
2885
-		 *
2886
-		 * @return mixed
2887
-		 */
2888
-		public static function minify_js($input) {
2889
-			if(trim($input) === "") return $input;
2890
-			return preg_replace(
2891
-				array(
2892
-					// Remove comment(s)
2893
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2894
-					// Remove white-space(s) outside the string and regex
2895
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2896
-					// Remove the last semicolon
2897
-					'#;+\}#',
2898
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2899
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2900
-					// --ibid. From `foo['bar']` to `foo.bar`
2901
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2902
-				),
2903
-				array(
2904
-					'$1',
2905
-					'$1$2',
2906
-					'}',
2907
-					'$1$3',
2908
-					'$1.$3'
2909
-				),
2910
-				$input);
2911
-		}
2912
-
2913
-		/**
2914
-		 * Minify CSS
2915
-		 *
2916
-		 * @param $input
2917
-		 *
2918
-		 * @return mixed
2919
-		 */
2920
-		public static function minify_css($input) {
2921
-			if(trim($input) === "") return $input;
2922
-			return preg_replace(
2923
-				array(
2924
-					// Remove comment(s)
2925
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2926
-					// Remove unused white-space(s)
2927
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2928
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2929
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2930
-					// Replace `:0 0 0 0` with `:0`
2931
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2932
-					// Replace `background-position:0` with `background-position:0 0`
2933
-					'#(background-position):0(?=[;\}])#si',
2934
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2935
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2936
-					// Minify string value
2937
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2938
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2939
-					// Minify HEX color code
2940
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2941
-					// Replace `(border|outline):none` with `(border|outline):0`
2942
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2943
-					// Remove empty selector(s)
2944
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2945
-				),
2946
-				array(
2947
-					'$1',
2948
-					'$1$2$3$4$5$6$7',
2949
-					'$1',
2950
-					':0',
2951
-					'$1:0 0',
2952
-					'.$1',
2953
-					'$1$3',
2954
-					'$1$2$4$5',
2955
-					'$1$2$3',
2956
-					'$1:0',
2957
-					'$1$2'
2958
-				),
2959
-				$input);
2960
-		}
2961
-
2962
-		/**
2963
-		 * Get the conditional fields JavaScript.
2964
-		 *
2965
-		 * @return mixed
2966
-		 */
2967
-		public function conditional_fields_js() {
2968
-			ob_start();
2969
-			?>
2873
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2874
+            }
2875
+
2876
+            $locale = json_encode( $params );
2877
+
2878
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2879
+        }
2880
+
2881
+        /**
2882
+         * JavaScript Minifier
2883
+         *
2884
+         * @param $input
2885
+         *
2886
+         * @return mixed
2887
+         */
2888
+        public static function minify_js($input) {
2889
+            if(trim($input) === "") return $input;
2890
+            return preg_replace(
2891
+                array(
2892
+                    // Remove comment(s)
2893
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2894
+                    // Remove white-space(s) outside the string and regex
2895
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2896
+                    // Remove the last semicolon
2897
+                    '#;+\}#',
2898
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2899
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2900
+                    // --ibid. From `foo['bar']` to `foo.bar`
2901
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2902
+                ),
2903
+                array(
2904
+                    '$1',
2905
+                    '$1$2',
2906
+                    '}',
2907
+                    '$1$3',
2908
+                    '$1.$3'
2909
+                ),
2910
+                $input);
2911
+        }
2912
+
2913
+        /**
2914
+         * Minify CSS
2915
+         *
2916
+         * @param $input
2917
+         *
2918
+         * @return mixed
2919
+         */
2920
+        public static function minify_css($input) {
2921
+            if(trim($input) === "") return $input;
2922
+            return preg_replace(
2923
+                array(
2924
+                    // Remove comment(s)
2925
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2926
+                    // Remove unused white-space(s)
2927
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2928
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2929
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2930
+                    // Replace `:0 0 0 0` with `:0`
2931
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2932
+                    // Replace `background-position:0` with `background-position:0 0`
2933
+                    '#(background-position):0(?=[;\}])#si',
2934
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2935
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2936
+                    // Minify string value
2937
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2938
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2939
+                    // Minify HEX color code
2940
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2941
+                    // Replace `(border|outline):none` with `(border|outline):0`
2942
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2943
+                    // Remove empty selector(s)
2944
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2945
+                ),
2946
+                array(
2947
+                    '$1',
2948
+                    '$1$2$3$4$5$6$7',
2949
+                    '$1',
2950
+                    ':0',
2951
+                    '$1:0 0',
2952
+                    '.$1',
2953
+                    '$1$3',
2954
+                    '$1$2$4$5',
2955
+                    '$1$2$3',
2956
+                    '$1:0',
2957
+                    '$1$2'
2958
+                ),
2959
+                $input);
2960
+        }
2961
+
2962
+        /**
2963
+         * Get the conditional fields JavaScript.
2964
+         *
2965
+         * @return mixed
2966
+         */
2967
+        public function conditional_fields_js() {
2968
+            ob_start();
2969
+            ?>
2970 2970
             <script>
2971 2971
                 /**
2972 2972
                  * Conditional Fields
@@ -3469,14 +3469,14 @@  discard block
 block discarded – undo
3469 3469
 				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
3470 3470
             </script>
3471 3471
 			<?php
3472
-			$output = ob_get_clean();
3472
+            $output = ob_get_clean();
3473 3473
 
3474
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3475
-		}
3476
-	}
3474
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3475
+        }
3476
+    }
3477 3477
 
3478
-	/**
3479
-	 * Run the class if found.
3480
-	 */
3481
-	AyeCode_UI_Settings::instance();
3478
+    /**
3479
+     * Run the class if found.
3480
+     */
3481
+    AyeCode_UI_Settings::instance();
3482 3482
 }
3483 3483
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +553 added lines, -553 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 		 * @return AyeCode_UI_Settings - Main instance.
100 100
 		 */
101 101
 		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
103 103
 
104 104
 				self::$instance = new AyeCode_UI_Settings;
105 105
 
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
+				add_action('init', array(self::$instance, 'init')); // set settings
107 107
 
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
108
+				if (is_admin()) {
109
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
110
+					add_action('admin_init', array(self::$instance, 'register_settings'));
111 111
 
112 112
 					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
114 114
 
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
115
+					if (defined('BLOCKSTRAP_VERSION')) {
116
+						add_filter('sd_aui_colors', array(self::$instance, 'sd_aui_colors'), 10, 3);
117 117
 					}
118 118
 				}
119 119
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
120
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
121 121
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
122
+				do_action('ayecode_ui_settings_loaded');
123 123
 			}
124 124
 
125 125
 			return self::$instance;
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 		 *
135 135
 		 * @return mixed
136 136
 		 */
137
-		public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
137
+		public function sd_aui_colors($theme_colors, $include_outlines, $include_branding) {
138 138
 
139 139
 
140 140
 			$setting = wp_get_global_settings();
141 141
 
142
-			if(!empty($setting['color']['palette']['custom'])){
143
-				foreach($setting['color']['palette']['custom'] as $color){
142
+			if (!empty($setting['color']['palette']['custom'])) {
143
+				foreach ($setting['color']['palette']['custom'] as $color) {
144 144
 					$theme_colors[$color['slug']] = esc_attr($color['name']);
145 145
 				}
146 146
 			}
@@ -151,81 +151,81 @@  discard block
 block discarded – undo
151 151
 		/**
152 152
 		 * Setup some constants.
153 153
 		 */
154
-		public function constants(){
155
-			define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
-			define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
-			define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
-			define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
-			define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
-			define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
-			define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
-			define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
-			define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
-			define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
-			define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
-			define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
-			define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
-			define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
-			define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
-			define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
154
+		public function constants() {
155
+			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
156
+			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
157
+			define('AUI_INFO_COLOR_ORIGINAL', '#17a2b8');
158
+			define('AUI_WARNING_COLOR_ORIGINAL', '#ffc107');
159
+			define('AUI_DANGER_COLOR_ORIGINAL', '#dc3545');
160
+			define('AUI_SUCCESS_COLOR_ORIGINAL', '#44c553');
161
+			define('AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa');
162
+			define('AUI_DARK_COLOR_ORIGINAL', '#343a40');
163
+			define('AUI_WHITE_COLOR_ORIGINAL', '#fff');
164
+			define('AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd');
165
+			define('AUI_SALMON_COLOR_ORIGINAL', '#ff977a');
166
+			define('AUI_CYAN_COLOR_ORIGINAL', '#35bdff');
167
+			define('AUI_GRAY_COLOR_ORIGINAL', '#ced4da');
168
+			define('AUI_INDIGO_COLOR_ORIGINAL', '#502c6c');
169
+			define('AUI_ORANGE_COLOR_ORIGINAL', '#orange');
170
+			define('AUI_BLACK_COLOR_ORIGINAL', '#000');
171 171
 
172
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
-				define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
172
+			if (!defined('AUI_PRIMARY_COLOR')) {
173
+				define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
174 174
 			}
175
-			if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
-				define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
175
+			if (!defined('AUI_SECONDARY_COLOR')) {
176
+				define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
177 177
 			}
178
-			if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
-				define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
178
+			if (!defined('AUI_INFO_COLOR')) {
179
+				define('AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL);
180 180
 			}
181
-			if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
-				define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
181
+			if (!defined('AUI_WARNING_COLOR')) {
182
+				define('AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL);
183 183
 			}
184
-			if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
-				define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
184
+			if (!defined('AUI_DANGER_COLOR')) {
185
+				define('AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL);
186 186
 			}
187
-			if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
-				define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
187
+			if (!defined('AUI_SUCCESS_COLOR')) {
188
+				define('AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL);
189 189
 			}
190
-			if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
-				define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
190
+			if (!defined('AUI_LIGHT_COLOR')) {
191
+				define('AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL);
192 192
 			}
193
-			if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
-				define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
193
+			if (!defined('AUI_DARK_COLOR')) {
194
+				define('AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL);
195 195
 			}
196
-			if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
-				define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
196
+			if (!defined('AUI_WHITE_COLOR')) {
197
+				define('AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL);
198 198
 			}
199
-			if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
-				define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
199
+			if (!defined('AUI_PURPLE_COLOR')) {
200
+				define('AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL);
201 201
 			}
202
-			if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
-				define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
202
+			if (!defined('AUI_SALMON_COLOR')) {
203
+				define('AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL);
204 204
 			}
205
-			if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
-				define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
205
+			if (!defined('AUI_CYAN_COLOR')) {
206
+				define('AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL);
207 207
 			}
208
-			if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
-				define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
208
+			if (!defined('AUI_GRAY_COLOR')) {
209
+				define('AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL);
210 210
 			}
211
-			if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
-				define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
211
+			if (!defined('AUI_INDIGO_COLOR')) {
212
+				define('AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL);
213 213
 			}
214
-			if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
-				define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
214
+			if (!defined('AUI_ORANGE_COLOR')) {
215
+				define('AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL);
216 216
 			}
217
-			if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
-				define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
217
+			if (!defined('AUI_BLACK_COLOR')) {
218
+				define('AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL);
219 219
 			}
220 220
 
221 221
 		}
222 222
 
223
-		public static function get_colors( $original = false){
223
+		public static function get_colors($original = false) {
224 224
 
225
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
225
+			if (!defined('AUI_PRIMARY_COLOR')) {
226 226
 				return array();
227 227
 			}
228
-			if ( $original ) {
228
+			if ($original) {
229 229
 				return array(
230 230
 					'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231 231
 					'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		public function init() {
273 273
 
274 274
 			// Maybe fix settings
275
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
-				$db_settings = get_option( 'ayecode-ui-settings' );
277
-				if ( ! empty( $db_settings ) ) {
275
+			if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) {
276
+				$db_settings = get_option('ayecode-ui-settings');
277
+				if (!empty($db_settings)) {
278 278
 					$db_settings['css_backend'] = 'compatibility';
279 279
 					$db_settings['js_backend'] = 'core-popper';
280
-					update_option( 'ayecode-ui-settings', $db_settings );
280
+					update_option('ayecode-ui-settings', $db_settings);
281 281
 					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282 282
 				}
283 283
 			}
@@ -291,31 +291,31 @@  discard block
 block discarded – undo
291 291
 			 *
292 292
 			 * We load super early in case there is a theme version that might change the colors
293 293
 			 */
294
-			if ( $this->settings['css'] ) {
294
+			if ($this->settings['css']) {
295 295
 				$priority = $this->is_bs3_compat() ? 100 : 1;
296
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
296
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority);
297 297
 			}
298
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
298
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
299
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
300 300
 			}
301 301
 
302 302
 			// maybe load JS
303
-			if ( $this->settings['js'] ) {
303
+			if ($this->settings['js']) {
304 304
 				$priority = $this->is_bs3_compat() ? 100 : 1;
305
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
305
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority);
306 306
 			}
307
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
307
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
308
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
309 309
 			}
310 310
 
311 311
 			// Maybe set the HTML font size
312
-			if ( $this->settings['html_font_size'] ) {
313
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
312
+			if ($this->settings['html_font_size']) {
313
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
314 314
 			}
315 315
 
316 316
 			// Maybe show backend style error
317
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
317
+			if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') {
318
+				add_action('admin_notices', array($this, 'show_admin_style_notice'));
319 319
 			}
320 320
 
321 321
 		}
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
 		/**
324 324
 		 * Show admin notice if backend scripts not loaded.
325 325
 		 */
326
-		public function show_admin_style_notice(){
327
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
326
+		public function show_admin_style_notice() {
327
+			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=" . wp_create_nonce('aui-fix-admin'));
328
+			$button = '<a href="' . esc_url($fix_url) . '" class="button-primary">Fix Now</a>';
329
+			$message = __('<b>Style Issue:</b> AyeCode UI is disable or set wrong.') . " " . $button;
330
+			echo '<div class="notice notice-error aui-settings-error-notice"><p>' . $message . '</p></div>';
331 331
 		}
332 332
 
333 333
 		/**
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @return bool
337 337
 		 */
338
-		public function load_admin_scripts(){
338
+		public function load_admin_scripts() {
339 339
 			$result = true;
340 340
 
341 341
 			// check if specifically disabled
342
-			if(!empty($this->settings['disable_admin'])){
343
-				$url_parts = explode("\n",$this->settings['disable_admin']);
344
-				foreach($url_parts as $part){
345
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
342
+			if (!empty($this->settings['disable_admin'])) {
343
+				$url_parts = explode("\n", $this->settings['disable_admin']);
344
+				foreach ($url_parts as $part) {
345
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
346 346
 						return false; // return early, no point checking further
347 347
 					}
348 348
 				}
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 		/**
355 355
 		 * Add a html font size to the footer.
356 356
 		 */
357
-		public function html_font_size(){
357
+		public function html_font_size() {
358 358
 			$this->settings = $this->get_settings();
359
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
359
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
360 360
 		}
361 361
 
362 362
 		/**
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
 		 *
365 365
 		 * @return bool
366 366
 		 */
367
-		public function is_aui_screen(){
367
+		public function is_aui_screen() {
368 368
 //			echo '###';exit;
369 369
 			$load = false;
370 370
 			// check if we should load or not
371
-			if ( is_admin() ) {
371
+			if (is_admin()) {
372 372
 				// Only enable on set pages
373 373
 				$aui_screens = array(
374 374
 					'page',
@@ -379,24 +379,24 @@  discard block
 block discarded – undo
379 379
 					'ayecode-ui-settings',
380 380
 					'site-editor'
381 381
 				);
382
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
382
+				$screen_ids = apply_filters('aui_screen_ids', $aui_screens);
383 383
 
384 384
 				$screen = get_current_screen();
385 385
 
386 386
 //				echo '###'.$screen->id;
387 387
 
388 388
 				// check if we are on a AUI screen
389
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
389
+				if ($screen && in_array($screen->id, $screen_ids)) {
390 390
 					$load = true;
391 391
 				}
392 392
 
393 393
 				//load for widget previews in WP 5.8
394
-				if( !empty($_REQUEST['legacy-widget-preview'])){
394
+				if (!empty($_REQUEST['legacy-widget-preview'])) {
395 395
 					$load = true;
396 396
 				}
397 397
 			}
398 398
 
399
-			return apply_filters( 'aui_load_on_admin' , $load );
399
+			return apply_filters('aui_load_on_admin', $load);
400 400
 		}
401 401
 
402 402
 		/**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 		 * @return bool
406 406
 		 */
407 407
 		public static function is_block_theme() {
408
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
408
+			if (function_exists('wp_is_block_theme' && wp_is_block_theme())) {
409 409
 				return true;
410 410
 			}
411 411
 
@@ -418,37 +418,37 @@  discard block
 block discarded – undo
418 418
 		public function enqueue_style() {
419 419
 
420 420
 
421
-			if( is_admin() && !$this->is_aui_screen()){
421
+			if (is_admin() && !$this->is_aui_screen()) {
422 422
 				// don't add wp-admin scripts if not requested to
423
-			}else{
423
+			} else {
424 424
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
425 425
 
426 426
 				$rtl = is_rtl() ? '-rtl' : '';
427 427
 
428
-				if($this->settings[$css_setting]){
429
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
428
+				if ($this->settings[$css_setting]) {
429
+					$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
430
+					$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css';
431 431
 
432 432
 
433 433
 
434
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
435
-					wp_enqueue_style( 'ayecode-ui' );
434
+					wp_register_style('ayecode-ui', $url, array(), $this->version);
435
+					wp_enqueue_style('ayecode-ui');
436 436
 
437
-					$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
437
+					$current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
438 438
 
439 439
 //					if ( is_admin() && !empty($_REQUEST['postType']) ) {
440
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
441
-						$url = $this->url.'assets/css/ayecode-ui-fse.css';
442
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
443
-						wp_enqueue_style( 'ayecode-ui-fse' );
440
+					if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) {
441
+						$url = $this->url . 'assets/css/ayecode-ui-fse.css';
442
+						wp_register_style('ayecode-ui-fse', $url, array(), $this->version);
443
+						wp_enqueue_style('ayecode-ui-fse');
444 444
 					}
445 445
 
446 446
 
447 447
 					// flatpickr
448
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
448
+					wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->version);
449 449
 
450 450
 					// fix some wp-admin issues
451
-					if(is_admin()){
451
+					if (is_admin()) {
452 452
 						$custom_css = "
453 453
                 body{
454 454
                     background-color: #f1f1f1;
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 						    padding: 0;
502 502
 						}
503 503
 					";
504
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
504
+						wp_add_inline_style('ayecode-ui', $custom_css);
505 505
 					}
506 506
 
507 507
 					// custom changes
508
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
508
+					wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
509 509
 
510 510
 				}
511 511
 			}
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
                 function aui_init_flatpickr(){
769 769
                     if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
770 770
                         $aui_doing_init_flatpickr = true;
771
-						<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
771
+						<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
772 772
                         jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
773 773
                     }
774 774
                     $aui_doing_init_flatpickr = false;
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
 				<?php
1463 1463
 				// FSE tweaks.
1464
-				if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?>
1464
+				if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?>
1465 1465
                 function aui_fse_set_data_scroll() {
1466 1466
                     console.log('init scroll');
1467 1467
                     let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
@@ -1501,10 +1501,10 @@  discard block
 block discarded – undo
1501 1501
 			/*
1502 1502
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1503 1503
 			 */
1504
-			return str_replace( array(
1504
+			return str_replace(array(
1505 1505
 				'<script>',
1506 1506
 				'</script>'
1507
-			), '', self::minify_js($output) );
1507
+			), '', self::minify_js($output));
1508 1508
 		}
1509 1509
 
1510 1510
 
@@ -1518,13 +1518,13 @@  discard block
 block discarded – undo
1518 1518
 			ob_start();
1519 1519
 			?>
1520 1520
             <script>
1521
-				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1521
+				<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1522 1522
                 /* With Avada builder */
1523 1523
 
1524 1524
 				<?php } ?>
1525 1525
             </script>
1526 1526
 			<?php
1527
-			return str_replace( array(
1527
+			return str_replace(array(
1528 1528
 				'<script>',
1529 1529
 				'</script>'
1530 1530
 			), '', ob_get_clean());
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
 		 *
1536 1536
 		 * If this remains small then its best to use this than to add another JS file.
1537 1537
 		 */
1538
-		public function inline_script_file_browser(){
1538
+		public function inline_script_file_browser() {
1539 1539
 			ob_start();
1540 1540
 			?>
1541 1541
             <script>
@@ -1550,10 +1550,10 @@  discard block
 block discarded – undo
1550 1550
 			/*
1551 1551
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1552 1552
 			 */
1553
-			return str_replace( array(
1553
+			return str_replace(array(
1554 1554
 				'<script>',
1555 1555
 				'</script>'
1556
-			), '', $output );
1556
+			), '', $output);
1557 1557
 		}
1558 1558
 
1559 1559
 		/**
@@ -1561,53 +1561,53 @@  discard block
 block discarded – undo
1561 1561
 		 */
1562 1562
 		public function enqueue_scripts() {
1563 1563
 
1564
-			if( is_admin() && !$this->is_aui_screen()){
1564
+			if (is_admin() && !$this->is_aui_screen()) {
1565 1565
 				// don't add wp-admin scripts if not requested to
1566
-			}else {
1566
+			} else {
1567 1567
 
1568 1568
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1569 1569
 
1570 1570
 				// select2
1571
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1571
+				wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
1572 1572
 
1573 1573
 				// flatpickr
1574
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1574
+				wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version);
1575 1575
 
1576 1576
 				// flatpickr
1577
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1577
+				wp_register_script('iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version);
1578 1578
 
1579 1579
 				// Bootstrap file browser
1580
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1581
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1580
+				wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
1581
+				wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
1582 1582
 
1583 1583
 				$load_inline = false;
1584 1584
 
1585
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1585
+				if ($this->settings[$js_setting] == 'core-popper') {
1586 1586
 					// Bootstrap bundle
1587 1587
 					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1588
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1588
+					wp_register_script('bootstrap-js-bundle', $url, array(
1589 1589
 						'select2',
1590 1590
 						'jquery'
1591
-					), $this->version, $this->is_bs3_compat() );
1591
+					), $this->version, $this->is_bs3_compat());
1592 1592
 					// if in admin then add to footer for compatibility.
1593
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1593
+					is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
1594 1594
 					$script = $this->inline_script();
1595
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1596
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1595
+					wp_add_inline_script('bootstrap-js-bundle', $script);
1596
+				} elseif ($this->settings[$js_setting] == 'popper') {
1597 1597
 					$url = $this->url . 'assets/js/popper.min.js';
1598
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1599
-					wp_enqueue_script( 'bootstrap-js-popper' );
1598
+					wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->version);
1599
+					wp_enqueue_script('bootstrap-js-popper');
1600 1600
 					$load_inline = true;
1601 1601
 				} else {
1602 1602
 					$load_inline = true;
1603 1603
 				}
1604 1604
 
1605 1605
 				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1606
-				if ( $load_inline ) {
1607
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1608
-					wp_enqueue_script( 'bootstrap-dummy' );
1606
+				if ($load_inline) {
1607
+					wp_register_script('bootstrap-dummy', '', array('select2', 'jquery'));
1608
+					wp_enqueue_script('bootstrap-dummy');
1609 1609
 					$script = $this->inline_script();
1610
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1610
+					wp_add_inline_script('bootstrap-dummy', $script);
1611 1611
 				}
1612 1612
 			}
1613 1613
 
@@ -1616,17 +1616,17 @@  discard block
 block discarded – undo
1616 1616
 		/**
1617 1617
 		 * Enqueue flatpickr if called.
1618 1618
 		 */
1619
-		public function enqueue_flatpickr(){
1620
-			wp_enqueue_style( 'flatpickr' );
1621
-			wp_enqueue_script( 'flatpickr' );
1619
+		public function enqueue_flatpickr() {
1620
+			wp_enqueue_style('flatpickr');
1621
+			wp_enqueue_script('flatpickr');
1622 1622
 		}
1623 1623
 
1624 1624
 		/**
1625 1625
 		 * Enqueue iconpicker if called.
1626 1626
 		 */
1627
-		public function enqueue_iconpicker(){
1628
-			wp_enqueue_style( 'iconpicker' );
1629
-			wp_enqueue_script( 'iconpicker' );
1627
+		public function enqueue_iconpicker() {
1628
+			wp_enqueue_style('iconpicker');
1629
+			wp_enqueue_script('iconpicker');
1630 1630
 		}
1631 1631
 
1632 1632
 		/**
@@ -1635,19 +1635,19 @@  discard block
 block discarded – undo
1635 1635
 		 * @return string
1636 1636
 		 */
1637 1637
 		public function get_url() {
1638
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1639
-			$content_url = untrailingslashit( WP_CONTENT_URL );
1638
+			$content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR));
1639
+			$content_url = untrailingslashit(WP_CONTENT_URL);
1640 1640
 
1641 1641
 			// Replace http:// to https://.
1642
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1643
-				$content_url = str_replace( 'http://', 'https://', $content_url );
1642
+			if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) {
1643
+				$content_url = str_replace('http://', 'https://', $content_url);
1644 1644
 			}
1645 1645
 
1646 1646
 			// Check if we are inside a plugin
1647
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1648
-			$url = str_replace( $content_dir, $content_url, $file_dir );
1647
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
1648
+			$url = str_replace($content_dir, $content_url, $file_dir);
1649 1649
 
1650
-			return trailingslashit( $url );
1650
+			return trailingslashit($url);
1651 1651
 		}
1652 1652
 
1653 1653
 		/**
@@ -1659,15 +1659,15 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
 			$url = '';
1661 1661
 			// check if we are inside a plugin
1662
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1662
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
1663 1663
 
1664 1664
 			// add check in-case user has changed wp-content dir name.
1665 1665
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1666
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1667
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1666
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
1667
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
1668 1668
 
1669
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1670
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1669
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1670
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
1671 1671
 			}
1672 1672
 
1673 1673
 			return $url;
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 		 * Register the database settings with WordPress.
1678 1678
 		 */
1679 1679
 		public function register_settings() {
1680
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1680
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
1681 1681
 		}
1682 1682
 
1683 1683
 		/**
@@ -1686,10 +1686,10 @@  discard block
 block discarded – undo
1686 1686
 		 */
1687 1687
 		public function menu_item() {
1688 1688
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1689
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1689
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1690 1690
 				$this,
1691 1691
 				'settings_page'
1692
-			) );
1692
+			));
1693 1693
 		}
1694 1694
 
1695 1695
 		/**
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 		 *
1698 1698
 		 * @return array
1699 1699
 		 */
1700
-		public function theme_js_settings(){
1700
+		public function theme_js_settings() {
1701 1701
 			return array(
1702 1702
 				'ayetheme' => 'popper',
1703 1703
 				'listimia' => 'required',
@@ -1713,40 +1713,40 @@  discard block
 block discarded – undo
1713 1713
 		 */
1714 1714
 		public function get_settings() {
1715 1715
 
1716
-			$db_settings = get_option( 'ayecode-ui-settings' );
1716
+			$db_settings = get_option('ayecode-ui-settings');
1717 1717
 			$js_default = 'core-popper';
1718 1718
 			$js_default_backend = $js_default;
1719 1719
 
1720 1720
 			// maybe set defaults (if no settings set)
1721
-			if(empty($db_settings)){
1722
-				$active_theme = strtolower( get_template() ); // active parent theme.
1721
+			if (empty($db_settings)) {
1722
+				$active_theme = strtolower(get_template()); // active parent theme.
1723 1723
 				$theme_js_settings = self::theme_js_settings();
1724
-				if(isset($theme_js_settings[$active_theme])){
1724
+				if (isset($theme_js_settings[$active_theme])) {
1725 1725
 					$js_default = $theme_js_settings[$active_theme];
1726
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1726
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
1727 1727
 				}
1728 1728
 			}
1729 1729
 
1730 1730
 			/**
1731 1731
 			 * Filter the default settings.
1732 1732
 			 */
1733
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
1733
+			$defaults = apply_filters('ayecode-ui-default-settings', array(
1734 1734
 				'css'            => 'compatibility', // core, compatibility
1735 1735
 				'js'             => $js_default, // js to load, core-popper, popper
1736 1736
 				'html_font_size' => '16', // js to load, core-popper, popper
1737 1737
 				'css_backend'    => 'compatibility', // core, compatibility
1738 1738
 				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
1739 1739
 				'disable_admin'  => '', // URL snippets to disable loading on admin
1740
-			), $db_settings );
1740
+			), $db_settings);
1741 1741
 
1742
-			$settings = wp_parse_args( $db_settings, $defaults );
1742
+			$settings = wp_parse_args($db_settings, $defaults);
1743 1743
 
1744 1744
 			/**
1745 1745
 			 * Filter the Bootstrap settings.
1746 1746
 			 *
1747 1747
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1748 1748
 			 */
1749
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1749
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
1750 1750
 		}
1751 1751
 
1752 1752
 
@@ -1754,90 +1754,90 @@  discard block
 block discarded – undo
1754 1754
 		 * The settings page html output.
1755 1755
 		 */
1756 1756
 		public function settings_page() {
1757
-			if ( ! current_user_can( 'manage_options' ) ) {
1758
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1757
+			if (!current_user_can('manage_options')) {
1758
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
1759 1759
 			}
1760 1760
 			?>
1761 1761
             <div class="wrap">
1762 1762
                 <h1><?php echo $this->name; ?></h1>
1763
-                <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.",'aui') );?></p>
1763
+                <p><?php echo apply_filters('ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'aui')); ?></p>
1764 1764
                 <form method="post" action="options.php">
1765 1765
 					<?php
1766
-					settings_fields( 'ayecode-ui-settings' );
1767
-					do_settings_sections( 'ayecode-ui-settings' );
1766
+					settings_fields('ayecode-ui-settings');
1767
+					do_settings_sections('ayecode-ui-settings');
1768 1768
 					?>
1769 1769
 
1770
-                    <h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1770
+                    <h2><?php _e('Frontend', 'aui'); ?></h2>
1771 1771
                     <table class="form-table wpbs-table-settings">
1772 1772
                         <tr valign="top">
1773 1773
                             <th scope="row"><label
1774
-                                        for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1774
+                                        for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
1775 1775
                             <td>
1776 1776
                                 <select name="ayecode-ui-settings[css]" id="wpbs-css">
1777
-                                    <option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1778
-                                    <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1779
-                                    <option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1777
+                                    <option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1778
+                                    <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1779
+                                    <option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1780 1780
                                 </select>
1781 1781
                             </td>
1782 1782
                         </tr>
1783 1783
 
1784 1784
                         <tr valign="top">
1785 1785
                             <th scope="row"><label
1786
-                                        for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1786
+                                        for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
1787 1787
                             <td>
1788 1788
                                 <select name="ayecode-ui-settings[js]" id="wpbs-js">
1789
-                                    <option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1790
-                                    <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1791
-                                    <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1792
-                                    <option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1789
+                                    <option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1790
+                                    <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1791
+                                    <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1792
+                                    <option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1793 1793
                                 </select>
1794 1794
                             </td>
1795 1795
                         </tr>
1796 1796
 
1797 1797
                         <tr valign="top">
1798 1798
                             <th scope="row"><label
1799
-                                        for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
1799
+                                        for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
1800 1800
                             <td>
1801
-                                <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" />
1802
-                                <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.",'aui');?></p>
1801
+                                <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" />
1802
+                                <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'aui'); ?></p>
1803 1803
                             </td>
1804 1804
                         </tr>
1805 1805
 
1806 1806
                     </table>
1807 1807
 
1808
-                    <h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1808
+                    <h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1809 1809
                     <table class="form-table wpbs-table-settings">
1810 1810
                         <tr valign="top">
1811 1811
                             <th scope="row"><label
1812
-                                        for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1812
+                                        for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1813 1813
                             <td>
1814 1814
                                 <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1815
-                                    <option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1816
-                                    <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option>
1817
-                                    <option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1815
+                                    <option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1816
+                                    <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option>
1817
+                                    <option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1818 1818
                                 </select>
1819 1819
                             </td>
1820 1820
                         </tr>
1821 1821
 
1822 1822
                         <tr valign="top">
1823 1823
                             <th scope="row"><label
1824
-                                        for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1824
+                                        for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1825 1825
                             <td>
1826 1826
                                 <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1827
-                                    <option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1828
-                                    <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1829
-                                    <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1830
-                                    <option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1827
+                                    <option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1828
+                                    <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1829
+                                    <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1830
+                                    <option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1831 1831
                                 </select>
1832 1832
                             </td>
1833 1833
                         </tr>
1834 1834
 
1835 1835
                         <tr valign="top">
1836 1836
                             <th scope="row"><label
1837
-                                        for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1837
+                                        for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1838 1838
                             <td>
1839
-                                <p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p>
1840
-                                <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin'];?></textarea>
1839
+                                <p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p>
1840
+                                <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin']; ?></textarea>
1841 1841
 
1842 1842
                             </td>
1843 1843
                         </tr>
@@ -1855,9 +1855,9 @@  discard block
 block discarded – undo
1855 1855
 			<?php
1856 1856
 		}
1857 1857
 
1858
-		public function customizer_settings($wp_customize){
1858
+		public function customizer_settings($wp_customize) {
1859 1859
 			$wp_customize->add_section('aui_settings', array(
1860
-				'title'    => __('AyeCode UI','aui'),
1860
+				'title'    => __('AyeCode UI', 'aui'),
1861 1861
 				'priority' => 120,
1862 1862
 			));
1863 1863
 
@@ -1871,8 +1871,8 @@  discard block
 block discarded – undo
1871 1871
 				'type'              => 'option',
1872 1872
 				'transport'         => 'refresh',
1873 1873
 			));
1874
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
-				'label'    => __('Primary Color','aui'),
1874
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
+				'label'    => __('Primary Color', 'aui'),
1876 1876
 				'section'  => 'aui_settings',
1877 1877
 				'settings' => 'aui_options[color_primary]',
1878 1878
 			)));
@@ -1884,8 +1884,8 @@  discard block
 block discarded – undo
1884 1884
 				'type'              => 'option',
1885 1885
 				'transport'         => 'refresh',
1886 1886
 			));
1887
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
-				'label'    => __('Secondary Color','aui'),
1887
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
+				'label'    => __('Secondary Color', 'aui'),
1889 1889
 				'section'  => 'aui_settings',
1890 1890
 				'settings' => 'aui_options[color_secondary]',
1891 1891
 			)));
@@ -1911,12 +1911,12 @@  discard block
 block discarded – undo
1911 1911
                 .collapse.show:not(.in){display: inherit;}
1912 1912
                 .fade.show{opacity: 1;}
1913 1913
 
1914
-                <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?>
1914
+                <?php if (defined('SVQ_THEME_VERSION')) { ?>
1915 1915
                 /* KLEO theme specific */
1916 1916
                 .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;}
1917 1917
                 <?php } ?>
1918 1918
 
1919
-                <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1919
+                <?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1920 1920
                 /* With Avada builder */
1921 1921
                 body.modal-open .modal.in  {opacity:1;z-index: 99999}
1922 1922
                 body.modal-open .modal.bsui.in .modal-content  {box-shadow: none;}
@@ -1927,34 +1927,34 @@  discard block
 block discarded – undo
1927 1927
                 <?php } ?>
1928 1928
             </style>
1929 1929
 			<?php
1930
-			return str_replace( array(
1930
+			return str_replace(array(
1931 1931
 				'<style>',
1932 1932
 				'</style>'
1933
-			), '', self::minify_css( ob_get_clean() ) );
1933
+			), '', self::minify_css(ob_get_clean()));
1934 1934
 		}
1935 1935
 
1936 1936
 
1937 1937
 		public static function custom_css($compatibility = true) {
1938 1938
 			$colors = array();
1939
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1939
+			if (defined('BLOCKSTRAP_VERSION')) {
1940 1940
 
1941 1941
 				$setting = wp_get_global_settings();
1942
-				if(!empty($setting['color']['palette']['theme'])){
1943
-					foreach($setting['color']['palette']['theme'] as $color){
1942
+				if (!empty($setting['color']['palette']['theme'])) {
1943
+					foreach ($setting['color']['palette']['theme'] as $color) {
1944 1944
 						$colors[$color['slug']] = esc_attr($color['color']);
1945 1945
 					}
1946 1946
 				}
1947 1947
 
1948
-				if(!empty($setting['color']['palette']['custom'])){
1949
-					foreach($setting['color']['palette']['custom'] as $color){
1948
+				if (!empty($setting['color']['palette']['custom'])) {
1949
+					foreach ($setting['color']['palette']['custom'] as $color) {
1950 1950
 						$colors[$color['slug']] = esc_attr($color['color']);
1951 1951
 					}
1952 1952
 				}
1953
-			}else{
1953
+			} else {
1954 1954
 				$settings = get_option('aui_options');
1955 1955
 				$colors = array(
1956
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1956
+					'primary'   => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
+					'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1958 1958
 				);
1959 1959
 			}
1960 1960
 
@@ -1965,20 +1965,20 @@  discard block
 block discarded – undo
1965 1965
                 <?php
1966 1966
 
1967 1967
 					// BS v3 compat
1968
-					if( self::is_bs3_compat() ){
1968
+					if (self::is_bs3_compat()) {
1969 1969
 						echo self::bs3_compat_css();
1970 1970
 					}
1971 1971
 
1972
-					if(!empty($colors)){
1972
+					if (!empty($colors)) {
1973 1973
 						$d_colors = self::get_colors(true);
1974 1974
 						//print_r($d_colors );exit;
1975 1975
 //                        print_r($colors );exit;
1976
-						$is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1977
-						foreach($colors as $key => $color ){
1978
-							if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1976
+						$is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template';
1977
+						foreach ($colors as $key => $color) {
1978
+							if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) {
1979 1979
 								$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1980 1980
 								$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1981
-								echo self::css_overwrite($key,$var,$compat);
1981
+								echo self::css_overwrite($key, $var, $compat);
1982 1982
 							}
1983 1983
 						}
1984 1984
 					   // exit;
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 					// Set admin bar z-index lower when modal is open.
1988 1988
 					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1989 1989
 
1990
-					if(is_admin()){
1990
+					if (is_admin()) {
1991 1991
 						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1992 1992
 					}
1993 1993
 				?>
@@ -1998,10 +1998,10 @@  discard block
 block discarded – undo
1998 1998
 			/*
1999 1999
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2000 2000
 			 */
2001
-			return str_replace( array(
2001
+			return str_replace(array(
2002 2002
 				'<style>',
2003 2003
 				'</style>'
2004
-			), '', self::minify_css( ob_get_clean() ) );
2004
+			), '', self::minify_css(ob_get_clean()));
2005 2005
 		}
2006 2006
 
2007 2007
 
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 		 *
2012 2012
 		 * @return bool
2013 2013
 		 */
2014
-		public static function is_bs3_compat(){
2014
+		public static function is_bs3_compat() {
2015 2015
 			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2016 2016
 		}
2017 2017
 
@@ -2024,22 +2024,22 @@  discard block
 block discarded – undo
2024 2024
 		 *
2025 2025
 		 * @return string
2026 2026
 		 */
2027
-		public static function css_overwrite($type,$color_code,$compatibility){
2027
+		public static function css_overwrite($type, $color_code, $compatibility) {
2028 2028
 
2029 2029
 			$is_var = false;
2030
-			if(!$color_code){return '';}
2031
-			if(!sanitize_hex_color($color_code)){
2030
+			if (!$color_code) {return ''; }
2031
+			if (!sanitize_hex_color($color_code)) {
2032 2032
 				$color_code = esc_attr($color_code);
2033 2033
 				$is_var = true;
2034 2034
 //                echo '###1'.$color_code;//exit;
2035 2035
 			}
2036
-			if(!$color_code){return '';}
2036
+			if (!$color_code) {return ''; }
2037 2037
 
2038
-			if($compatibility===true || $compatibility===1){
2038
+			if ($compatibility === true || $compatibility === 1) {
2039 2039
 				$compatibility = '.bsui';
2040
-			}elseif(!$compatibility){
2040
+			}elseif (!$compatibility) {
2041 2041
 				$compatibility = '';
2042
-			}else{
2042
+			} else {
2043 2043
 				$compatibility = esc_attr($compatibility);
2044 2044
 			}
2045 2045
 
@@ -2051,25 +2051,25 @@  discard block
 block discarded – undo
2051 2051
 			 * c = color, b = background color, o = border-color, f = fill
2052 2052
 			 */
2053 2053
 			$selectors = array(
2054
-				".btn-{$type}"                                              => array( 'b', 'o' ),
2055
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2056
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2057
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2058
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2059
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2060
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2061
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2062
-				".badge-{$type}"                                            => array( 'b' ),
2063
-				".alert-{$type}"                                            => array( 'b', 'o' ),
2064
-				".bg-{$type}"                                               => array( 'b', 'f' ),
2065
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
2054
+				".btn-{$type}"                                              => array('b', 'o'),
2055
+				".btn-{$type}.disabled"                                     => array('b', 'o'),
2056
+				".btn-{$type}:disabled"                                     => array('b', 'o'),
2057
+				".btn-outline-{$type}"                                      => array('c', 'o'),
2058
+				".btn-outline-{$type}:hover"                                => array('b', 'o'),
2059
+				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'),
2060
+				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'),
2061
+				".show>.btn-outline-{$type}.dropdown-toggle"                => array('b', 'o'),
2062
+				".badge-{$type}"                                            => array('b'),
2063
+				".alert-{$type}"                                            => array('b', 'o'),
2064
+				".bg-{$type}"                                               => array('b', 'f'),
2065
+				".btn-link.btn-{$type}"                                     => array('c'),
2066 2066
 			);
2067 2067
 
2068
-			if ( $type == 'primary' ) {
2068
+			if ($type == 'primary') {
2069 2069
 				$selectors = $selectors + array(
2070
-						'a'                                                                                                    => array( 'c' ),
2071
-						'.btn-link'                                                                                            => array( 'c' ),
2072
-						'.dropdown-item.active'                                                                                => array( 'b' ),
2070
+						'a'                                                                                                    => array('c'),
2071
+						'.btn-link'                                                                                            => array('c'),
2072
+						'.dropdown-item.active'                                                                                => array('b'),
2073 2073
 						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
2074 2074
 							'b',
2075 2075
 							'o'
@@ -2078,19 +2078,19 @@  discard block
 block discarded – undo
2078 2078
 							'b',
2079 2079
 							'o'
2080 2080
 						),
2081
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2082
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2083
-						'.page-link'                                                                                           => array( 'c' ),
2081
+						'.nav-pills .nav-link.active'                                                                          => array('b'),
2082
+						'.nav-pills .show>.nav-link'                                                                           => array('b'),
2083
+						'.page-link'                                                                                           => array('c'),
2084 2084
 						'.page-item.active .page-link'                                                                         => array(
2085 2085
 							'b',
2086 2086
 							'o'
2087 2087
 						),
2088
-						'.progress-bar'                                                                                        => array( 'b' ),
2088
+						'.progress-bar'                                                                                        => array('b'),
2089 2089
 						'.list-group-item.active'                                                                              => array(
2090 2090
 							'b',
2091 2091
 							'o'
2092 2092
 						),
2093
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2093
+						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2094 2094
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2095 2095
 //				    '.custom-range::-moz-range-thumb' => array('b'),
2096 2096
 //				    '.custom-range::-ms-thumb' => array('b'),
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 			}
2099 2099
 
2100 2100
 			$important_selectors = array(
2101
-				".bg-{$type}" => array('b','f'),
2101
+				".bg-{$type}" => array('b', 'f'),
2102 2102
 				".border-{$type}" => array('o'),
2103 2103
 				".text-{$type}" => array('c'),
2104 2104
 			);
@@ -2115,55 +2115,55 @@  discard block
 block discarded – undo
2115 2115
 			$output = '';
2116 2116
 
2117 2117
 			// build rules into each type
2118
-			foreach($selectors as $selector => $types){
2119
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2120
-				$types = array_combine($types,$types);
2121
-				if(isset($types['c'])){$color[] = $selector;}
2122
-				if(isset($types['b'])){$background[] = $selector;}
2123
-				if(isset($types['o'])){$border[] = $selector;}
2124
-				if(isset($types['f'])){$fill[] = $selector;}
2118
+			foreach ($selectors as $selector => $types) {
2119
+				$selector = $compatibility ? $compatibility . " " . $selector : $selector;
2120
+				$types = array_combine($types, $types);
2121
+				if (isset($types['c'])) {$color[] = $selector; }
2122
+				if (isset($types['b'])) {$background[] = $selector; }
2123
+				if (isset($types['o'])) {$border[] = $selector; }
2124
+				if (isset($types['f'])) {$fill[] = $selector; }
2125 2125
 			}
2126 2126
 
2127 2127
 			// build rules into each type
2128
-			foreach($important_selectors as $selector => $types){
2129
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2130
-				$types = array_combine($types,$types);
2131
-				if(isset($types['c'])){$color_i[] = $selector;}
2132
-				if(isset($types['b'])){$background_i[] = $selector;}
2133
-				if(isset($types['o'])){$border_i[] = $selector;}
2134
-				if(isset($types['f'])){$fill_i[] = $selector;}
2128
+			foreach ($important_selectors as $selector => $types) {
2129
+				$selector = $compatibility ? $compatibility . " " . $selector : $selector;
2130
+				$types = array_combine($types, $types);
2131
+				if (isset($types['c'])) {$color_i[] = $selector; }
2132
+				if (isset($types['b'])) {$background_i[] = $selector; }
2133
+				if (isset($types['o'])) {$border_i[] = $selector; }
2134
+				if (isset($types['f'])) {$fill_i[] = $selector; }
2135 2135
 			}
2136 2136
 
2137 2137
 			// add any color rules
2138
-			if(!empty($color)){
2139
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2138
+			if (!empty($color)) {
2139
+				$output .= implode(",", $color) . "{color: $color_code;} ";
2140 2140
 			}
2141
-			if(!empty($color_i)){
2142
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2141
+			if (!empty($color_i)) {
2142
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
2143 2143
 			}
2144 2144
 
2145 2145
 			// add any background color rules
2146
-			if(!empty($background)){
2147
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2146
+			if (!empty($background)) {
2147
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
2148 2148
 			}
2149
-			if(!empty($background_i)){
2150
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2149
+			if (!empty($background_i)) {
2150
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
2151 2151
 			}
2152 2152
 
2153 2153
 			// add any border color rules
2154
-			if(!empty($border)){
2155
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2154
+			if (!empty($border)) {
2155
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
2156 2156
 			}
2157
-			if(!empty($border_i)){
2158
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2157
+			if (!empty($border_i)) {
2158
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
2159 2159
 			}
2160 2160
 
2161 2161
 			// add any fill color rules
2162
-			if(!empty($fill)){
2163
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2162
+			if (!empty($fill)) {
2163
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
2164 2164
 			}
2165
-			if(!empty($fill_i)){
2166
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2165
+			if (!empty($fill_i)) {
2166
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
2167 2167
 			}
2168 2168
 
2169 2169
 
@@ -2171,26 +2171,26 @@  discard block
 block discarded – undo
2171 2171
 
2172 2172
 			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
2173 2173
 			// darken
2174
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2175
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2176
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2174
+			$darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075");
2175
+			$darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10");
2176
+			$darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125");
2177 2177
 
2178 2178
 			// lighten
2179
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2179
+			$lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25");
2180 2180
 
2181 2181
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
2182
-			$op_25 = $color_code."40"; // 25% opacity
2182
+			$op_25 = $color_code . "40"; // 25% opacity
2183 2183
 
2184 2184
 
2185 2185
 			// button states
2186
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2187
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2186
+			$output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : '';
2187
+			$output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
2188 2188
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
2189
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2190
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2191
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2189
+			$output .= $prefix . " .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2190
+			$output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
2191
+			$output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2192 2192
 
2193
-			if ( $type == 'primary' ) {
2193
+			if ($type == 'primary') {
2194 2194
 				// dropdown's
2195 2195
 				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2196 2196
 
@@ -2214,11 +2214,11 @@  discard block
 block discarded – undo
2214 2214
 		 *
2215 2215
 		 * @return string
2216 2216
 		 */
2217
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
2217
+		public static function css_primary($color_code, $compatibility, $use_variable = false) {
2218 2218
 
2219
-			if(!$use_variable){
2219
+			if (!$use_variable) {
2220 2220
 				$color_code = sanitize_hex_color($color_code);
2221
-				if(!$color_code){return '';}
2221
+				if (!$color_code) {return ''; }
2222 2222
 			}
2223 2223
 
2224 2224
 			/**
@@ -2226,36 +2226,36 @@  discard block
 block discarded – undo
2226 2226
 			 */
2227 2227
 			$selectors = array(
2228 2228
 				'a' => array('c'),
2229
-				'.btn-primary' => array('b','o'),
2230
-				'.btn-primary.disabled' => array('b','o'),
2231
-				'.btn-primary:disabled' => array('b','o'),
2232
-				'.btn-outline-primary' => array('c','o'),
2233
-				'.btn-outline-primary:hover' => array('b','o'),
2234
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2235
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2236
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2229
+				'.btn-primary' => array('b', 'o'),
2230
+				'.btn-primary.disabled' => array('b', 'o'),
2231
+				'.btn-primary:disabled' => array('b', 'o'),
2232
+				'.btn-outline-primary' => array('c', 'o'),
2233
+				'.btn-outline-primary:hover' => array('b', 'o'),
2234
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
2235
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
2236
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
2237 2237
 				'.btn-link' => array('c'),
2238 2238
 				'.dropdown-item.active' => array('b'),
2239
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2240
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2239
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
2240
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
2241 2241
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2242 2242
 //				'.custom-range::-moz-range-thumb' => array('b'),
2243 2243
 //				'.custom-range::-ms-thumb' => array('b'),
2244 2244
 				'.nav-pills .nav-link.active' => array('b'),
2245 2245
 				'.nav-pills .show>.nav-link' => array('b'),
2246 2246
 				'.page-link' => array('c'),
2247
-				'.page-item.active .page-link' => array('b','o'),
2247
+				'.page-item.active .page-link' => array('b', 'o'),
2248 2248
 				'.badge-primary' => array('b'),
2249
-				'.alert-primary' => array('b','o'),
2249
+				'.alert-primary' => array('b', 'o'),
2250 2250
 				'.progress-bar' => array('b'),
2251
-				'.list-group-item.active' => array('b','o'),
2252
-				'.bg-primary' => array('b','f'),
2251
+				'.list-group-item.active' => array('b', 'o'),
2252
+				'.bg-primary' => array('b', 'f'),
2253 2253
 				'.btn-link.btn-primary' => array('c'),
2254 2254
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2255 2255
 			);
2256 2256
 
2257 2257
 			$important_selectors = array(
2258
-				'.bg-primary' => array('b','f'),
2258
+				'.bg-primary' => array('b', 'f'),
2259 2259
 				'.border-primary' => array('o'),
2260 2260
 				'.text-primary' => array('c'),
2261 2261
 			);
@@ -2272,88 +2272,88 @@  discard block
 block discarded – undo
2272 2272
 			$output = '';
2273 2273
 
2274 2274
 			// build rules into each type
2275
-			foreach($selectors as $selector => $types){
2276
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2277
-				$types = array_combine($types,$types);
2278
-				if(isset($types['c'])){$color[] = $selector;}
2279
-				if(isset($types['b'])){$background[] = $selector;}
2280
-				if(isset($types['o'])){$border[] = $selector;}
2281
-				if(isset($types['f'])){$fill[] = $selector;}
2275
+			foreach ($selectors as $selector => $types) {
2276
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2277
+				$types = array_combine($types, $types);
2278
+				if (isset($types['c'])) {$color[] = $selector; }
2279
+				if (isset($types['b'])) {$background[] = $selector; }
2280
+				if (isset($types['o'])) {$border[] = $selector; }
2281
+				if (isset($types['f'])) {$fill[] = $selector; }
2282 2282
 			}
2283 2283
 
2284 2284
 			// build rules into each type
2285
-			foreach($important_selectors as $selector => $types){
2286
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2287
-				$types = array_combine($types,$types);
2288
-				if(isset($types['c'])){$color_i[] = $selector;}
2289
-				if(isset($types['b'])){$background_i[] = $selector;}
2290
-				if(isset($types['o'])){$border_i[] = $selector;}
2291
-				if(isset($types['f'])){$fill_i[] = $selector;}
2285
+			foreach ($important_selectors as $selector => $types) {
2286
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2287
+				$types = array_combine($types, $types);
2288
+				if (isset($types['c'])) {$color_i[] = $selector; }
2289
+				if (isset($types['b'])) {$background_i[] = $selector; }
2290
+				if (isset($types['o'])) {$border_i[] = $selector; }
2291
+				if (isset($types['f'])) {$fill_i[] = $selector; }
2292 2292
 			}
2293 2293
 
2294 2294
 			// add any color rules
2295
-			if(!empty($color)){
2296
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2295
+			if (!empty($color)) {
2296
+				$output .= implode(",", $color) . "{color: $color_code;} ";
2297 2297
 			}
2298
-			if(!empty($color_i)){
2299
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2298
+			if (!empty($color_i)) {
2299
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
2300 2300
 			}
2301 2301
 
2302 2302
 			// add any background color rules
2303
-			if(!empty($background)){
2304
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2303
+			if (!empty($background)) {
2304
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
2305 2305
 			}
2306
-			if(!empty($background_i)){
2307
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2306
+			if (!empty($background_i)) {
2307
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
2308 2308
 			}
2309 2309
 
2310 2310
 			// add any border color rules
2311
-			if(!empty($border)){
2312
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2311
+			if (!empty($border)) {
2312
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
2313 2313
 			}
2314
-			if(!empty($border_i)){
2315
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2314
+			if (!empty($border_i)) {
2315
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
2316 2316
 			}
2317 2317
 
2318 2318
 			// add any fill color rules
2319
-			if(!empty($fill)){
2320
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2319
+			if (!empty($fill)) {
2320
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
2321 2321
 			}
2322
-			if(!empty($fill_i)){
2323
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2322
+			if (!empty($fill_i)) {
2323
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
2324 2324
 			}
2325 2325
 
2326 2326
 
2327 2327
 			$prefix = $compatibility ? ".bsui " : "";
2328 2328
 
2329 2329
 			// darken
2330
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2331
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2332
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2330
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
2331
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
2332
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
2333 2333
 
2334 2334
 			// lighten
2335
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2335
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
2336 2336
 
2337 2337
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
2338
-			$op_25 = $color_code."40"; // 25% opacity
2338
+			$op_25 = $color_code . "40"; // 25% opacity
2339 2339
 
2340 2340
 
2341 2341
 			// button states
2342
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2343
-			$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;} ";
2344
-			$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.";} ";
2345
-			$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;} ";
2342
+			$output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
2343
+			$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;} ";
2344
+			$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 . ";} ";
2345
+			$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;} ";
2346 2346
 
2347 2347
 
2348 2348
 			// dropdown's
2349
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2349
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2350 2350
 
2351 2351
 
2352 2352
 			// input states
2353
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2353
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2354 2354
 
2355 2355
 			// page link
2356
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2356
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2357 2357
 
2358 2358
 			return $output;
2359 2359
 		}
@@ -2367,30 +2367,30 @@  discard block
 block discarded – undo
2367 2367
 		 *
2368 2368
 		 * @return string
2369 2369
 		 */
2370
-		public static function css_secondary($color_code,$compatibility){;
2370
+		public static function css_secondary($color_code, $compatibility) {;
2371 2371
 			$color_code = sanitize_hex_color($color_code);
2372
-			if(!$color_code){return '';}
2372
+			if (!$color_code) {return ''; }
2373 2373
 			/**
2374 2374
 			 * c = color, b = background color, o = border-color, f = fill
2375 2375
 			 */
2376 2376
 			$selectors = array(
2377
-				'.btn-secondary' => array('b','o'),
2378
-				'.btn-secondary.disabled' => array('b','o'),
2379
-				'.btn-secondary:disabled' => array('b','o'),
2380
-				'.btn-outline-secondary' => array('c','o'),
2381
-				'.btn-outline-secondary:hover' => array('b','o'),
2377
+				'.btn-secondary' => array('b', 'o'),
2378
+				'.btn-secondary.disabled' => array('b', 'o'),
2379
+				'.btn-secondary:disabled' => array('b', 'o'),
2380
+				'.btn-outline-secondary' => array('c', 'o'),
2381
+				'.btn-outline-secondary:hover' => array('b', 'o'),
2382 2382
 				'.btn-outline-secondary.disabled' => array('c'),
2383 2383
 				'.btn-outline-secondary:disabled' => array('c'),
2384
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2385
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2386
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2384
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
2385
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
2386
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
2387 2387
 				'.badge-secondary' => array('b'),
2388
-				'.alert-secondary' => array('b','o'),
2388
+				'.alert-secondary' => array('b', 'o'),
2389 2389
 				'.btn-link.btn-secondary' => array('c'),
2390 2390
 			);
2391 2391
 
2392 2392
 			$important_selectors = array(
2393
-				'.bg-secondary' => array('b','f'),
2393
+				'.bg-secondary' => array('b', 'f'),
2394 2394
 				'.border-secondary' => array('o'),
2395 2395
 				'.text-secondary' => array('c'),
2396 2396
 			);
@@ -2407,77 +2407,77 @@  discard block
 block discarded – undo
2407 2407
 			$output = '';
2408 2408
 
2409 2409
 			// build rules into each type
2410
-			foreach($selectors as $selector => $types){
2411
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2412
-				$types = array_combine($types,$types);
2413
-				if(isset($types['c'])){$color[] = $selector;}
2414
-				if(isset($types['b'])){$background[] = $selector;}
2415
-				if(isset($types['o'])){$border[] = $selector;}
2416
-				if(isset($types['f'])){$fill[] = $selector;}
2410
+			foreach ($selectors as $selector => $types) {
2411
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2412
+				$types = array_combine($types, $types);
2413
+				if (isset($types['c'])) {$color[] = $selector; }
2414
+				if (isset($types['b'])) {$background[] = $selector; }
2415
+				if (isset($types['o'])) {$border[] = $selector; }
2416
+				if (isset($types['f'])) {$fill[] = $selector; }
2417 2417
 			}
2418 2418
 
2419 2419
 			// build rules into each type
2420
-			foreach($important_selectors as $selector => $types){
2421
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2422
-				$types = array_combine($types,$types);
2423
-				if(isset($types['c'])){$color_i[] = $selector;}
2424
-				if(isset($types['b'])){$background_i[] = $selector;}
2425
-				if(isset($types['o'])){$border_i[] = $selector;}
2426
-				if(isset($types['f'])){$fill_i[] = $selector;}
2420
+			foreach ($important_selectors as $selector => $types) {
2421
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2422
+				$types = array_combine($types, $types);
2423
+				if (isset($types['c'])) {$color_i[] = $selector; }
2424
+				if (isset($types['b'])) {$background_i[] = $selector; }
2425
+				if (isset($types['o'])) {$border_i[] = $selector; }
2426
+				if (isset($types['f'])) {$fill_i[] = $selector; }
2427 2427
 			}
2428 2428
 
2429 2429
 			// add any color rules
2430
-			if(!empty($color)){
2431
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2430
+			if (!empty($color)) {
2431
+				$output .= implode(",", $color) . "{color: $color_code;} ";
2432 2432
 			}
2433
-			if(!empty($color_i)){
2434
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2433
+			if (!empty($color_i)) {
2434
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
2435 2435
 			}
2436 2436
 
2437 2437
 			// add any background color rules
2438
-			if(!empty($background)){
2439
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2438
+			if (!empty($background)) {
2439
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
2440 2440
 			}
2441
-			if(!empty($background_i)){
2442
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2441
+			if (!empty($background_i)) {
2442
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
2443 2443
 			}
2444 2444
 
2445 2445
 			// add any border color rules
2446
-			if(!empty($border)){
2447
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2446
+			if (!empty($border)) {
2447
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
2448 2448
 			}
2449
-			if(!empty($border_i)){
2450
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2449
+			if (!empty($border_i)) {
2450
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
2451 2451
 			}
2452 2452
 
2453 2453
 			// add any fill color rules
2454
-			if(!empty($fill)){
2455
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2454
+			if (!empty($fill)) {
2455
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
2456 2456
 			}
2457
-			if(!empty($fill_i)){
2458
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2457
+			if (!empty($fill_i)) {
2458
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
2459 2459
 			}
2460 2460
 
2461 2461
 
2462 2462
 			$prefix = $compatibility ? ".bsui " : "";
2463 2463
 
2464 2464
 			// darken
2465
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2466
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2467
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2465
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
2466
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
2467
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
2468 2468
 
2469 2469
 			// lighten
2470
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2470
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
2471 2471
 
2472 2472
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
2473
-			$op_25 = $color_code."40"; // 25% opacity
2473
+			$op_25 = $color_code . "40"; // 25% opacity
2474 2474
 
2475 2475
 
2476 2476
 			// button states
2477
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2478
-			$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;} ";
2479
-			$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.";} ";
2480
-			$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;} ";
2477
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
2478
+			$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;} ";
2479
+			$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 . ";} ";
2480
+			$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;} ";
2481 2481
 
2482 2482
 
2483 2483
 			return $output;
@@ -2513,8 +2513,8 @@  discard block
 block discarded – undo
2513 2513
 		/**
2514 2514
 		 * Check if we should display examples.
2515 2515
 		 */
2516
-		public function maybe_show_examples(){
2517
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2516
+		public function maybe_show_examples() {
2517
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
2518 2518
 				echo "<head>";
2519 2519
 				wp_head();
2520 2520
 				echo "</head>";
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
 		 *
2531 2531
 		 * @return string
2532 2532
 		 */
2533
-		public function get_examples(){
2533
+		public function get_examples() {
2534 2534
 			$output = '';
2535 2535
 
2536 2536
 
@@ -2636,74 +2636,74 @@  discard block
 block discarded – undo
2636 2636
 		 */
2637 2637
 		public static function calendar_params() {
2638 2638
 			$params = array(
2639
-				'month_long_1' => __( 'January', 'aui' ),
2640
-				'month_long_2' => __( 'February', 'aui' ),
2641
-				'month_long_3' => __( 'March', 'aui' ),
2642
-				'month_long_4' => __( 'April', 'aui' ),
2643
-				'month_long_5' => __( 'May', 'aui' ),
2644
-				'month_long_6' => __( 'June', 'aui' ),
2645
-				'month_long_7' => __( 'July', 'aui' ),
2646
-				'month_long_8' => __( 'August', 'aui' ),
2647
-				'month_long_9' => __( 'September', 'aui' ),
2648
-				'month_long_10' => __( 'October', 'aui' ),
2649
-				'month_long_11' => __( 'November', 'aui' ),
2650
-				'month_long_12' => __( 'December', 'aui' ),
2651
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2652
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2653
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2654
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2655
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2656
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2657
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2658
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2659
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2660
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2661
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2662
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2663
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2664
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2665
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2666
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2667
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2668
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2669
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2670
-				'day_s2_1' => __( 'Su', 'aui' ),
2671
-				'day_s2_2' => __( 'Mo', 'aui' ),
2672
-				'day_s2_3' => __( 'Tu', 'aui' ),
2673
-				'day_s2_4' => __( 'We', 'aui' ),
2674
-				'day_s2_5' => __( 'Th', 'aui' ),
2675
-				'day_s2_6' => __( 'Fr', 'aui' ),
2676
-				'day_s2_7' => __( 'Sa', 'aui' ),
2677
-				'day_s3_1' => __( 'Sun', 'aui' ),
2678
-				'day_s3_2' => __( 'Mon', 'aui' ),
2679
-				'day_s3_3' => __( 'Tue', 'aui' ),
2680
-				'day_s3_4' => __( 'Wed', 'aui' ),
2681
-				'day_s3_5' => __( 'Thu', 'aui' ),
2682
-				'day_s3_6' => __( 'Fri', 'aui' ),
2683
-				'day_s3_7' => __( 'Sat', 'aui' ),
2684
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2685
-				'day_s5_2' => __( 'Monday', 'aui' ),
2686
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2687
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2688
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2689
-				'day_s5_6' => __( 'Friday', 'aui' ),
2690
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2691
-				'am_lower' => __( 'am', 'aui' ),
2692
-				'pm_lower' => __( 'pm', 'aui' ),
2693
-				'am_upper' => __( 'AM', 'aui' ),
2694
-				'pm_upper' => __( 'PM', 'aui' ),
2695
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2639
+				'month_long_1' => __('January', 'aui'),
2640
+				'month_long_2' => __('February', 'aui'),
2641
+				'month_long_3' => __('March', 'aui'),
2642
+				'month_long_4' => __('April', 'aui'),
2643
+				'month_long_5' => __('May', 'aui'),
2644
+				'month_long_6' => __('June', 'aui'),
2645
+				'month_long_7' => __('July', 'aui'),
2646
+				'month_long_8' => __('August', 'aui'),
2647
+				'month_long_9' => __('September', 'aui'),
2648
+				'month_long_10' => __('October', 'aui'),
2649
+				'month_long_11' => __('November', 'aui'),
2650
+				'month_long_12' => __('December', 'aui'),
2651
+				'month_s_1' => _x('Jan', 'January abbreviation', 'aui'),
2652
+				'month_s_2' => _x('Feb', 'February abbreviation', 'aui'),
2653
+				'month_s_3' => _x('Mar', 'March abbreviation', 'aui'),
2654
+				'month_s_4' => _x('Apr', 'April abbreviation', 'aui'),
2655
+				'month_s_5' => _x('May', 'May abbreviation', 'aui'),
2656
+				'month_s_6' => _x('Jun', 'June abbreviation', 'aui'),
2657
+				'month_s_7' => _x('Jul', 'July abbreviation', 'aui'),
2658
+				'month_s_8' => _x('Aug', 'August abbreviation', 'aui'),
2659
+				'month_s_9' => _x('Sep', 'September abbreviation', 'aui'),
2660
+				'month_s_10' => _x('Oct', 'October abbreviation', 'aui'),
2661
+				'month_s_11' => _x('Nov', 'November abbreviation', 'aui'),
2662
+				'month_s_12' => _x('Dec', 'December abbreviation', 'aui'),
2663
+				'day_s1_1' => _x('S', 'Sunday initial', 'aui'),
2664
+				'day_s1_2' => _x('M', 'Monday initial', 'aui'),
2665
+				'day_s1_3' => _x('T', 'Tuesday initial', 'aui'),
2666
+				'day_s1_4' => _x('W', 'Wednesday initial', 'aui'),
2667
+				'day_s1_5' => _x('T', 'Friday initial', 'aui'),
2668
+				'day_s1_6' => _x('F', 'Thursday initial', 'aui'),
2669
+				'day_s1_7' => _x('S', 'Saturday initial', 'aui'),
2670
+				'day_s2_1' => __('Su', 'aui'),
2671
+				'day_s2_2' => __('Mo', 'aui'),
2672
+				'day_s2_3' => __('Tu', 'aui'),
2673
+				'day_s2_4' => __('We', 'aui'),
2674
+				'day_s2_5' => __('Th', 'aui'),
2675
+				'day_s2_6' => __('Fr', 'aui'),
2676
+				'day_s2_7' => __('Sa', 'aui'),
2677
+				'day_s3_1' => __('Sun', 'aui'),
2678
+				'day_s3_2' => __('Mon', 'aui'),
2679
+				'day_s3_3' => __('Tue', 'aui'),
2680
+				'day_s3_4' => __('Wed', 'aui'),
2681
+				'day_s3_5' => __('Thu', 'aui'),
2682
+				'day_s3_6' => __('Fri', 'aui'),
2683
+				'day_s3_7' => __('Sat', 'aui'),
2684
+				'day_s5_1' => __('Sunday', 'aui'),
2685
+				'day_s5_2' => __('Monday', 'aui'),
2686
+				'day_s5_3' => __('Tuesday', 'aui'),
2687
+				'day_s5_4' => __('Wednesday', 'aui'),
2688
+				'day_s5_5' => __('Thursday', 'aui'),
2689
+				'day_s5_6' => __('Friday', 'aui'),
2690
+				'day_s5_7' => __('Saturday', 'aui'),
2691
+				'am_lower' => __('am', 'aui'),
2692
+				'pm_lower' => __('pm', 'aui'),
2693
+				'am_upper' => __('AM', 'aui'),
2694
+				'pm_upper' => __('PM', 'aui'),
2695
+				'firstDayOfWeek' => (int) get_option('start_of_week'),
2696 2696
 				'time_24hr' => false,
2697
-				'year' => __( 'Year', 'aui' ),
2698
-				'hour' => __( 'Hour', 'aui' ),
2699
-				'minute' => __( 'Minute', 'aui' ),
2700
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2701
-				'rangeSeparator' => __( ' to ', 'aui' ),
2702
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2703
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2697
+				'year' => __('Year', 'aui'),
2698
+				'hour' => __('Hour', 'aui'),
2699
+				'minute' => __('Minute', 'aui'),
2700
+				'weekAbbreviation' => __('Wk', 'aui'),
2701
+				'rangeSeparator' => __(' to ', 'aui'),
2702
+				'scrollTitle' => __('Scroll to increment', 'aui'),
2703
+				'toggleTitle' => __('Click to toggle', 'aui')
2704 2704
 			);
2705 2705
 
2706
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2706
+			return apply_filters('ayecode_ui_calendar_params', $params);
2707 2707
 		}
2708 2708
 
2709 2709
 		/**
@@ -2716,47 +2716,47 @@  discard block
 block discarded – undo
2716 2716
 		public static function flatpickr_locale() {
2717 2717
 			$params = self::calendar_params();
2718 2718
 
2719
-			if ( is_string( $params ) ) {
2720
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2719
+			if (is_string($params)) {
2720
+				$params = html_entity_decode($params, ENT_QUOTES, 'UTF-8');
2721 2721
 			} else {
2722
-				foreach ( (array) $params as $key => $value ) {
2723
-					if ( ! is_scalar( $value ) ) {
2722
+				foreach ((array) $params as $key => $value) {
2723
+					if (!is_scalar($value)) {
2724 2724
 						continue;
2725 2725
 					}
2726 2726
 
2727
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2727
+					$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2728 2728
 				}
2729 2729
 			}
2730 2730
 
2731 2731
 			$day_s3 = array();
2732 2732
 			$day_s5 = array();
2733 2733
 
2734
-			for ( $i = 1; $i <= 7; $i ++ ) {
2735
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2736
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2734
+			for ($i = 1; $i <= 7; $i++) {
2735
+				$day_s3[] = addslashes($params['day_s3_' . $i]);
2736
+				$day_s5[] = addslashes($params['day_s3_' . $i]);
2737 2737
 			}
2738 2738
 
2739 2739
 			$month_s = array();
2740 2740
 			$month_long = array();
2741 2741
 
2742
-			for ( $i = 1; $i <= 12; $i ++ ) {
2743
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2744
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2742
+			for ($i = 1; $i <= 12; $i++) {
2743
+				$month_s[] = addslashes($params['month_s_' . $i]);
2744
+				$month_long[] = addslashes($params['month_long_' . $i]);
2745 2745
 			}
2746 2746
 
2747 2747
 			ob_start();
2748
-		if ( 0 ) { ?><script><?php } ?>
2748
+		if (0) { ?><script><?php } ?>
2749 2749
                 {
2750 2750
                     weekdays: {
2751
-                        shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
2752
-                            longhand: ['<?php echo implode( "','", $day_s5 ); ?>'],
2751
+                        shorthand: ['<?php echo implode("','", $day_s3); ?>'],
2752
+                            longhand: ['<?php echo implode("','", $day_s5); ?>'],
2753 2753
                     },
2754 2754
                     months: {
2755
-                        shorthand: ['<?php echo implode( "','", $month_s ); ?>'],
2756
-                            longhand: ['<?php echo implode( "','", $month_long ); ?>'],
2755
+                        shorthand: ['<?php echo implode("','", $month_s); ?>'],
2756
+                            longhand: ['<?php echo implode("','", $month_long); ?>'],
2757 2757
                     },
2758 2758
                     daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31],
2759
-                        firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>,
2759
+                        firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>,
2760 2760
                     ordinal: function (nth) {
2761 2761
                         var s = nth % 100;
2762 2762
                         if (s > 3 && s < 21)
@@ -2772,21 +2772,21 @@  discard block
 block discarded – undo
2772 2772
                                 return "th";
2773 2773
                         }
2774 2774
                     },
2775
-                    rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>',
2776
-                        weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>',
2777
-                    scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>',
2778
-                    toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>',
2779
-                    amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'],
2780
-                    yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>',
2781
-                    hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>',
2782
-                    minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>',
2783
-                    time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?>
2775
+                    rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>',
2776
+                        weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>',
2777
+                    scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>',
2778
+                    toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>',
2779
+                    amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'],
2780
+                    yearAriaLabel: '<?php echo addslashes($params['year']); ?>',
2781
+                    hourAriaLabel: '<?php echo addslashes($params['hour']); ?>',
2782
+                    minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>',
2783
+                    time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?>
2784 2784
                 }
2785
-				<?php if ( 0 ) { ?></script><?php } ?>
2785
+				<?php if (0) { ?></script><?php } ?>
2786 2786
 			<?php
2787 2787
 			$locale = ob_get_clean();
2788 2788
 
2789
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2789
+			return apply_filters('ayecode_ui_flatpickr_locale', trim($locale));
2790 2790
 		}
2791 2791
 
2792 2792
 		/**
@@ -2798,20 +2798,20 @@  discard block
 block discarded – undo
2798 2798
 		 */
2799 2799
 		public static function select2_params() {
2800 2800
 			$params = array(
2801
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2802
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2803
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2804
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2805
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2806
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2807
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2808
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2809
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2810
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2811
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2801
+				'i18n_select_state_text'    => esc_attr__('Select an option&hellip;', 'aui'),
2802
+				'i18n_no_matches'           => _x('No matches found', 'enhanced select', 'aui'),
2803
+				'i18n_ajax_error'           => _x('Loading failed', 'enhanced select', 'aui'),
2804
+				'i18n_input_too_short_1'    => _x('Please enter 1 or more characters', 'enhanced select', 'aui'),
2805
+				'i18n_input_too_short_n'    => _x('Please enter %item% or more characters', 'enhanced select', 'aui'),
2806
+				'i18n_input_too_long_1'     => _x('Please delete 1 character', 'enhanced select', 'aui'),
2807
+				'i18n_input_too_long_n'     => _x('Please delete %item% characters', 'enhanced select', 'aui'),
2808
+				'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'aui'),
2809
+				'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'aui'),
2810
+				'i18n_load_more'            => _x('Loading more results&hellip;', 'enhanced select', 'aui'),
2811
+				'i18n_searching'            => _x('Searching&hellip;', 'enhanced select', 'aui')
2812 2812
 			);
2813 2813
 
2814
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2814
+			return apply_filters('ayecode_ui_select2_params', $params);
2815 2815
 		}
2816 2816
 
2817 2817
 		/**
@@ -2824,17 +2824,17 @@  discard block
 block discarded – undo
2824 2824
 		public static function select2_locale() {
2825 2825
 			$params = self::select2_params();
2826 2826
 
2827
-			foreach ( (array) $params as $key => $value ) {
2828
-				if ( ! is_scalar( $value ) ) {
2827
+			foreach ((array) $params as $key => $value) {
2828
+				if (!is_scalar($value)) {
2829 2829
 					continue;
2830 2830
 				}
2831 2831
 
2832
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2832
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2833 2833
 			}
2834 2834
 
2835
-			$locale = json_encode( $params );
2835
+			$locale = json_encode($params);
2836 2836
 
2837
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2837
+			return apply_filters('ayecode_ui_select2_locale', trim($locale));
2838 2838
 		}
2839 2839
 
2840 2840
 		/**
@@ -2847,35 +2847,35 @@  discard block
 block discarded – undo
2847 2847
 		public static function timeago_locale() {
2848 2848
 			$params = array(
2849 2849
 				'prefix_ago' => '',
2850
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2851
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2850
+				'suffix_ago' => ' ' . _x('ago', 'time ago', 'aui'),
2851
+				'prefix_after' => _x('after', 'time ago', 'aui') . ' ',
2852 2852
 				'suffix_after' => '',
2853
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2854
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2855
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2856
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2857
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2858
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2859
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2860
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2861
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2862
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2863
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2853
+				'seconds' => _x('less than a minute', 'time ago', 'aui'),
2854
+				'minute' => _x('about a minute', 'time ago', 'aui'),
2855
+				'minutes' => _x('%d minutes', 'time ago', 'aui'),
2856
+				'hour' => _x('about an hour', 'time ago', 'aui'),
2857
+				'hours' => _x('about %d hours', 'time ago', 'aui'),
2858
+				'day' => _x('a day', 'time ago', 'aui'),
2859
+				'days' => _x('%d days', 'time ago', 'aui'),
2860
+				'month' => _x('about a month', 'time ago', 'aui'),
2861
+				'months' => _x('%d months', 'time ago', 'aui'),
2862
+				'year' => _x('about a year', 'time ago', 'aui'),
2863
+				'years' => _x('%d years', 'time ago', 'aui'),
2864 2864
 			);
2865 2865
 
2866
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2866
+			$params = apply_filters('ayecode_ui_timeago_params', $params);
2867 2867
 
2868
-			foreach ( (array) $params as $key => $value ) {
2869
-				if ( ! is_scalar( $value ) ) {
2868
+			foreach ((array) $params as $key => $value) {
2869
+				if (!is_scalar($value)) {
2870 2870
 					continue;
2871 2871
 				}
2872 2872
 
2873
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2873
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2874 2874
 			}
2875 2875
 
2876
-			$locale = json_encode( $params );
2876
+			$locale = json_encode($params);
2877 2877
 
2878
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2878
+			return apply_filters('ayecode_ui_timeago_locale', trim($locale));
2879 2879
 		}
2880 2880
 
2881 2881
 		/**
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
 		 * @return mixed
2887 2887
 		 */
2888 2888
 		public static function minify_js($input) {
2889
-			if(trim($input) === "") return $input;
2889
+			if (trim($input) === "") return $input;
2890 2890
 			return preg_replace(
2891 2891
 				array(
2892 2892
 					// Remove comment(s)
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 		 * @return mixed
2919 2919
 		 */
2920 2920
 		public static function minify_css($input) {
2921
-			if(trim($input) === "") return $input;
2921
+			if (trim($input) === "") return $input;
2922 2922
 			return preg_replace(
2923 2923
 				array(
2924 2924
 					// Remove comment(s)
@@ -3466,12 +3466,12 @@  discard block
 block discarded – undo
3466 3466
                         });
3467 3467
                     }
3468 3468
                 }
3469
-				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
3469
+				<?php do_action('aui_conditional_fields_js', $this); ?>
3470 3470
             </script>
3471 3471
 			<?php
3472 3472
 			$output = ob_get_clean();
3473 3473
 
3474
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3474
+			return str_replace(array('<script>', '</script>'), '', self::minify_js($output));
3475 3475
 		}
3476 3476
 	}
3477 3477
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 3 patches
Braces   +48 added lines, -50 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             if(!empty($this->options['nested-block'])){
61 61
                 if(empty($this->options['output_types'])){
62 62
                     $this->options['output_types'] = array('shortcode','block');
63
-                }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
63
+                } elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64 64
                     unset($this->options['output_types'][$key]);
65 65
                 }
66 66
             }
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 				<?php
700 700
 				if(! empty( $insert_shortcode_function )){
701 701
 					echo $insert_shortcode_function;
702
-				}else{
702
+				} else{
703 703
 
704 704
 				/**
705 705
 				 * Function for super duper insert shortcode.
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
                     var InnerBlocks = blockEditor.InnerBlocks;
2133 2133
 
2134 2134
 					var term_query_type = '';
2135
-					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>;
2135
+					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";} else{echo "[]";} ?>;
2136 2136
 					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2137 2137
 					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2138 2138
                     const MediaUpload = wp.blockEditor.MediaUpload;
@@ -2251,8 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 
2252 2252
 								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253 2253
 									continue;
2254
-								}
2255
-								elseif ( $args['type'] == 'checkbox' ) {
2254
+								} elseif ( $args['type'] == 'checkbox' ) {
2256 2255
 									$type    = 'boolean';
2257 2256
 									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258 2257
 								} elseif ( $args['type'] == 'number' ) {
@@ -2380,7 +2379,7 @@  discard block
 block discarded – undo
2380 2379
                             <?php
2381 2380
                             if(!empty($this->options['block-edit-raw'])) {
2382 2381
                                 echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2383
-                            }else{
2382
+                            } else{
2384 2383
                             ?>
2385 2384
 
2386 2385
 function hasSelectedInnerBlock(props) {
@@ -2421,7 +2420,7 @@  discard block
 block discarded – undo
2421 2420
 
2422 2421
 								// taxonomies
2423 2422
 								if( $value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run ){
2424
-									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];}else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
2423
+									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];} else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
2425 2424
 										while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
2426 2425
 										taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
2427 2426
 									}
@@ -2470,7 +2469,7 @@  discard block
 block discarded – undo
2470 2469
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2471 2470
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2472 2471
 	echo 'const { deviceType } = "";';
2473
-}else{
2472
+} else{
2474 2473
 ?>
2475 2474
 /** Get device type const. */
2476 2475
 const { deviceType } = wp.data.useSelect != 'undefined' ?  wp.data.useSelect(select => {
@@ -2504,7 +2503,7 @@  discard block
 block discarded – undo
2504 2503
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2505 2504
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2506 2505
 										echo $post->ID;
2507
-									}else{echo '0';}?>,
2506
+									} else{echo '0';}?>,
2508 2507
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2509 2508
 									};
2510 2509
 
@@ -2524,7 +2523,7 @@  discard block
 block discarded – undo
2524 2523
 										is_fetching = false;
2525 2524
 										prev_attributes[props.clientId] = props.attributes;
2526 2525
                                              <?php
2527
-                                        }else{
2526
+                                        } else{
2528 2527
                                         ?>
2529 2528
                                        props.setAttributes({content: env});
2530 2529
 										is_fetching = false;
@@ -2703,7 +2702,7 @@  discard block
 block discarded – undo
2703 2702
 //
2704 2703
 
2705 2704
 									}
2706
-									}else {
2705
+									} else {
2707 2706
 									?>
2708 2707
 									el(wp.components.PanelBody, {
2709 2708
 											title: '<?php esc_attr_e( "Settings" ); ?>',
@@ -2729,9 +2728,9 @@  discard block
 block discarded – undo
2729 2728
 								// If the user sets block-output array then build it
2730 2729
 								if ( ! empty( $this->options['block-output'] ) ) {
2731 2730
 								$this->block_element( $this->options['block-output'] );
2732
-							}elseif(!empty($this->options['block-edit-return'])){
2731
+							} elseif(!empty($this->options['block-edit-return'])){
2733 2732
                                    echo $this->options['block-edit-return'];
2734
-							}else{
2733
+							} else{
2735 2734
 								// if no block-output is set then we try and get the shortcode html output via ajax.
2736 2735
 								?>
2737 2736
 								el('div', wp.blockEditor.useBlockProps({
@@ -2835,9 +2834,9 @@  discard block
 block discarded – undo
2835 2834
                                );
2836 2835
                                 <?php
2837 2836
 
2838
-							}elseif(!empty($this->options['block-save-return'])){
2837
+							} elseif(!empty($this->options['block-save-return'])){
2839 2838
                                    echo 'return ' . $this->options['block-save-return'];
2840
-							}elseif(!empty($this->options['nested-block'])){
2839
+							} elseif(!empty($this->options['nested-block'])){
2841 2840
                                 ?>
2842 2841
                               return el(
2843 2842
                                    '',
@@ -2847,13 +2846,13 @@  discard block
 block discarded – undo
2847 2846
                                    el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2848 2847
                                );
2849 2848
                                 <?php
2850
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2849
+							} elseif(!empty( $this->options['block-save-return'] ) ){
2851 2850
                                 echo "return ". $this->options['block-edit-return'].";";
2852
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2851
+							} elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853 2852
 							?>
2854 2853
 							return content;
2855 2854
 							<?php
2856
-							}else{
2855
+							} else{
2857 2856
 							?>
2858 2857
 							var block_wrap = 'div';
2859 2858
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -2904,9 +2903,9 @@  discard block
 block discarded – undo
2904 2903
                 $device_type_icon = '';
2905 2904
                 if($device_type=='Desktop'){
2906 2905
                     $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2907
-                }elseif($device_type=='Tablet'){
2906
+                } elseif($device_type=='Tablet'){
2908 2907
                     $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2909
-                }elseif($device_type=='Mobile'){
2908
+                } elseif($device_type=='Mobile'){
2910 2909
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2911 2910
                 }
2912 2911
 				echo $element_require;
@@ -2951,7 +2950,7 @@  discard block
 block discarded – undo
2951 2950
 
2952 2951
 					<?php
2953 2952
 					if(false){?></script><?php }
2954
-				}elseif(!empty($args['row']['close'])){
2953
+				} elseif(!empty($args['row']['close'])){
2955 2954
 					if(false){?><script><?php }?>
2956 2955
 						el(
2957 2956
 							'div',
@@ -2960,7 +2959,7 @@  discard block
 block discarded – undo
2960 2959
 							},
2961 2960
 					<?php
2962 2961
 					if(false){?></script><?php }
2963
-				}else{
2962
+				} else{
2964 2963
 					if(false){?><script><?php }?>
2965 2964
 						el(
2966 2965
 							'div',
@@ -3069,9 +3068,9 @@  discard block
 block discarded – undo
3069 3068
             $device_type_icon = '';
3070 3069
             if($device_type=='Desktop'){
3071 3070
                 $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3072
-            }elseif($device_type=='Tablet'){
3071
+            } elseif($device_type=='Tablet'){
3073 3072
                 $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3074
-            }elseif($device_type=='Mobile'){
3073
+            } elseif($device_type=='Mobile'){
3075 3074
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3076 3075
             }
3077 3076
 
@@ -3105,12 +3104,12 @@  discard block
 block discarded – undo
3105 3104
 				if ( $args['type'] == 'number' ) {
3106 3105
 					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107 3106
 				}
3108
-			}else if ( $args['type'] == 'styleid' ) {
3107
+			} else if ( $args['type'] == 'styleid' ) {
3109 3108
 				$type = 'TextControl';
3110 3109
 				$args['type'] == 'text';
3111 3110
 				// Save numbers as numbers and not strings
3112 3111
 				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
-			}else if ( $args['type'] == 'notice' ) {
3112
+			} else if ( $args['type'] == 'notice' ) {
3114 3113
 
3115 3114
 				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116 3115
 				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
@@ -3185,10 +3184,10 @@  discard block
 block discarded – undo
3185 3184
                             $key: value
3186 3185
                         });
3187 3186
                     },";
3188
-			}elseif ( $args['type'] == 'gradient' ) {
3187
+			} elseif ( $args['type'] == 'gradient' ) {
3189 3188
 				$type = 'GradientPicker';
3190 3189
 
3191
-			}elseif ( $args['type'] == 'image' ) {
3190
+			} elseif ( $args['type'] == 'image' ) {
3192 3191
 //                print_r($args);
3193 3192
 
3194 3193
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3250,7 +3249,7 @@  discard block
 block discarded – undo
3250 3249
                 $onchange = "";
3251 3250
 
3252 3251
                 //$inside_elements = ",el('div',{},'file upload')";
3253
-			}elseif ( $args['type'] == 'images' ) {
3252
+			} elseif ( $args['type'] == 'images' ) {
3254 3253
 				//                print_r($args);
3255 3254
 
3256 3255
                 $img_preview = "props.attributes.$key && (function() {
@@ -3335,8 +3334,7 @@  discard block
 block discarded – undo
3335 3334
                 $onchange = "";
3336 3335
 
3337 3336
                 //$inside_elements = ",el('div',{},'file upload')";
3338
-			}
3339
-			elseif ( $args['type'] == 'checkbox' ) {
3337
+			} elseif ( $args['type'] == 'checkbox' ) {
3340 3338
 				$type = 'CheckboxControl';
3341 3339
 				$extra .= "checked: props.attributes.$key,";
3342 3340
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
@@ -3348,9 +3346,9 @@  discard block
 block discarded – undo
3348 3346
 
3349 3347
 				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350 3348
 					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3349
+				} elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352 3350
 					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
-				}else {
3351
+				} else {
3354 3352
 
3355 3353
 					if ( ! empty( $args['options'] ) ) {
3356 3354
 						$options .= "options: [";
@@ -3414,7 +3412,7 @@  discard block
 block discarded – undo
3414 3412
 
3415 3413
 			} elseif ( $args['type'] == 'alignment' ) {
3416 3414
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
-			}elseif ( $args['type'] == 'margins' ) {
3415
+			} elseif ( $args['type'] == 'margins' ) {
3418 3416
 
3419 3417
 			} else {
3420 3418
 				return;// if we have not implemented the control then don't break the JS.
@@ -3444,7 +3442,7 @@  discard block
 block discarded – undo
3444 3442
 			label: <?php
3445 3443
 			if(empty($args['title'])){
3446 3444
                 echo "''";
3447
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3445
+			} elseif(empty($args['row']) && !empty($args['device_type'])){
3448 3446
                 ?>el('label', {
3449 3447
 									className: 'components-base-control__label',
3450 3448
 									style: {width:"100%"}
@@ -3459,7 +3457,7 @@  discard block
 block discarded – undo
3459 3457
 
3460 3458
 							)<?php
3461 3459
 
3462
-			}else{
3460
+			} else{
3463 3461
                  ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3464 3462
 
3465 3463
 			}
@@ -3467,7 +3465,7 @@  discard block
 block discarded – undo
3467 3465
 			?>,
3468 3466
 			help: <?php if ( isset( $args['desc'] ) ) {
3469 3467
 				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
-			}else{ echo "''"; } ?>,
3468
+			} else{ echo "''"; } ?>,
3471 3469
 			value: <?php echo $value; ?>,
3472 3470
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3473 3471
 				echo "type: '" . addslashes( $args['type'] ) . "',";
@@ -3507,7 +3505,7 @@  discard block
 block discarded – undo
3507 3505
 				foreach ( $custom_attributes as $key => $val ) {
3508 3506
 					if(is_array($val)){
3509 3507
 						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
-					}else{
3508
+					} else{
3511 3509
 						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3512 3510
 					}
3513 3511
 				}
@@ -3547,7 +3545,7 @@  discard block
 block discarded – undo
3547 3545
 
3548 3546
                             if($new_args['element']=='InnerBlocks'){
3549 3547
                                 echo "\n el( InnerBlocks, {";
3550
-                            }elseif($new_args['element']=='innerBlocksProps'){
3548
+                            } elseif($new_args['element']=='innerBlocksProps'){
3551 3549
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3552 3550
                               //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3553 3551
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
@@ -3560,11 +3558,11 @@  discard block
 block discarded – undo
3560 3558
                             //    echo '###';
3561 3559
 
3562 3560
                               //  echo '###';
3563
-                            }elseif($new_args['element']=='BlocksProps'){
3561
+                            } elseif($new_args['element']=='BlocksProps'){
3564 3562
 
3565 3563
 								if ( isset($new_args['if_inner_element']) ) {
3566 3564
 									$element = $new_args['if_inner_element'];
3567
-								}else {
3565
+								} else {
3568 3566
 									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3569 3567
 								}
3570 3568
 
@@ -3575,7 +3573,7 @@  discard block
 block discarded – undo
3575 3573
 
3576 3574
                                // echo "} ),";
3577 3575
 
3578
-                            }else{
3576
+                            } else{
3579 3577
                                 echo "\n el( '" . $new_args['element'] . "', {";
3580 3578
                             }
3581 3579
 
@@ -3600,7 +3598,7 @@  discard block
 block discarded – undo
3600 3598
 
3601 3599
 									if ( $new_key === 'content' ) {
3602 3600
 										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
-									}else if ( $new_key === 'if_content' ) {
3601
+									} else if ( $new_key === 'if_content' ) {
3604 3602
 										echo  $this->block_props_replace(  $new_value  );
3605 3603
 									}
3606 3604
 
@@ -3630,7 +3628,7 @@  discard block
 block discarded – undo
3630 3628
 
3631 3629
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3632 3630
                                 echo "))";// end content
3633
-                            }else{
3631
+                            } else{
3634 3632
                                 echo ")";// end content
3635 3633
                             }
3636 3634
 
@@ -3916,7 +3914,7 @@  discard block
 block discarded – undo
3916 3914
 
3917 3915
 				if(empty($instance['widget_title_tag'])){
3918 3916
 					$output = $args['before_title'] . $title . $args['after_title'];
3919
-				}else{
3917
+				} else{
3920 3918
 					$title_tag = esc_attr( $instance['widget_title_tag'] );
3921 3919
 
3922 3920
 					// classes
@@ -4021,9 +4019,9 @@  discard block
 block discarded – undo
4021 4019
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4022 4020
 					<div class='col pr-2'>
4023 4021
 					<?php
4024
-				}elseif(!empty($args['row']['close'])){
4022
+				} elseif(!empty($args['row']['close'])){
4025 4023
 					echo "<div class='col pl-0'>";
4026
-				}else{
4024
+				} else{
4027 4025
 					echo "<div class='col pl-0 pr-2'>";
4028 4026
 				}
4029 4027
 			}
@@ -4241,11 +4239,11 @@  discard block
 block discarded – undo
4241 4239
 		public function get_widget_icon($icon = 'box-top', $title = ''){
4242 4240
 			if($icon=='box-top'){
4243 4241
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4244
-			}elseif($icon=='box-right'){
4242
+			} elseif($icon=='box-right'){
4245 4243
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4246
-			}elseif($icon=='box-bottom'){
4244
+			} elseif($icon=='box-bottom'){
4247 4245
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4248
-			}elseif($icon=='box-left'){
4246
+			} elseif($icon=='box-left'){
4249 4247
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4250 4248
 			}
4251 4249
 		}
Please login to merge, or discard this patch.
Indentation   +1995 added lines, -1995 removed lines patch added patch discarded remove patch
@@ -1,60 +1,60 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
7 7
 
8
-	define( 'SUPER_DUPER_VER', '1.1.10' );
9
-
10
-	/**
11
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
-	 *
13
-	 * Should not be called direct but extended instead.
14
-	 *
15
-	 * Class WP_Super_Duper
16
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
-	 * @ver 1.1.1
18
-	 */
19
-	class WP_Super_Duper extends WP_Widget {
20
-
21
-		public $version = SUPER_DUPER_VER;
22
-		public $font_awesome_icon_version = "5.11.2";
23
-		public $block_code;
24
-		public $options;
25
-		public $base_id;
26
-		public $settings_hash;
27
-		public $arguments = array();
28
-		public $instance = array();
29
-		private $class_name;
30
-
31
-		/**
32
-		 * The relative url to the current folder.
33
-		 *
34
-		 * @var string
35
-		 */
36
-		public $url = '';
37
-
38
-		/**
39
-		 * Take the array options and use them to build.
40
-		 */
41
-		public function __construct( $options ) {
42
-			global $sd_widgets;
43
-
44
-			$sd_widgets[ $options['base_id'] ] = array(
45
-				'name'       => $options['name'],
46
-				'class_name' => $options['class_name'],
47
-				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
-			);
49
-			$this->base_id                     = $options['base_id'];
50
-			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
54
-			$this->options = $options;
55
-
56
-			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
8
+    define( 'SUPER_DUPER_VER', '1.1.10' );
9
+
10
+    /**
11
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
+     *
13
+     * Should not be called direct but extended instead.
14
+     *
15
+     * Class WP_Super_Duper
16
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
+     * @ver 1.1.1
18
+     */
19
+    class WP_Super_Duper extends WP_Widget {
20
+
21
+        public $version = SUPER_DUPER_VER;
22
+        public $font_awesome_icon_version = "5.11.2";
23
+        public $block_code;
24
+        public $options;
25
+        public $base_id;
26
+        public $settings_hash;
27
+        public $arguments = array();
28
+        public $instance = array();
29
+        private $class_name;
30
+
31
+        /**
32
+         * The relative url to the current folder.
33
+         *
34
+         * @var string
35
+         */
36
+        public $url = '';
37
+
38
+        /**
39
+         * Take the array options and use them to build.
40
+         */
41
+        public function __construct( $options ) {
42
+            global $sd_widgets;
43
+
44
+            $sd_widgets[ $options['base_id'] ] = array(
45
+                'name'       => $options['name'],
46
+                'class_name' => $options['class_name'],
47
+                'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
+            );
49
+            $this->base_id                     = $options['base_id'];
50
+            // lets filter the options before we do anything
51
+            $options       = apply_filters( "wp_super_duper_options", $options );
52
+            $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
+            $options       = $this->add_name_from_key( $options );
54
+            $this->options = $options;
55
+
56
+            $this->base_id   = $options['base_id'];
57
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58 58
 
59 59
             // nested blocks can't work as a widget
60 60
             if(!empty($this->options['nested-block'])){
@@ -65,234 +65,234 @@  discard block
 block discarded – undo
65 65
                 }
66 66
             }
67 67
 
68
-			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
68
+            // init parent
69
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70 70
                 parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
-			}
71
+            }
72 72
 
73 73
 
74
-			if ( isset( $options['class_name'] ) ) {
75
-				// register widget
76
-				$this->class_name = $options['class_name'];
74
+            if ( isset( $options['class_name'] ) ) {
75
+                // register widget
76
+                $this->class_name = $options['class_name'];
77 77
 
78
-				// register shortcode, this needs to be done even for blocks and widgets
78
+                // register shortcode, this needs to be done even for blocks and widgets
79 79
                 $this->register_shortcode();
80 80
 
81 81
 
82
-				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
85
-				}
82
+                // Fusion Builder (avada) support
83
+                if ( function_exists( 'fusion_builder_map' ) ) {
84
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
85
+                }
86 86
 
87
-				// register block
88
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
89
-				    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
87
+                // register block
88
+                if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
89
+                    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
90 90
                 }
91
-			}
91
+            }
92 92
 
93
-			// add the CSS and JS we need ONCE
94
-			global $sd_widget_scripts;
93
+            // add the CSS and JS we need ONCE
94
+            global $sd_widget_scripts;
95 95
 
96
-			if ( ! $sd_widget_scripts ) {
97
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
98
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
99
-				wp_add_inline_style( 'widgets', $this->widget_css() );
96
+            if ( ! $sd_widget_scripts ) {
97
+                wp_add_inline_script( 'admin-widgets', $this->widget_js() );
98
+                wp_add_inline_script( 'customize-controls', $this->widget_js() );
99
+                wp_add_inline_style( 'widgets', $this->widget_css() );
100 100
 
101
-				// maybe add elementor editor styles
102
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
101
+                // maybe add elementor editor styles
102
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
103 103
 
104
-				$sd_widget_scripts = true;
104
+                $sd_widget_scripts = true;
105 105
 
106
-				// add shortcode insert button once
107
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
108
-				// generatepress theme sections compatibility
109
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
110
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
111
-				}
112
-				/* Load script on Divi theme builder page */
113
-				if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
114
-					add_thickbox();
115
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
116
-				}
106
+                // add shortcode insert button once
107
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
108
+                // generatepress theme sections compatibility
109
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
110
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
111
+                }
112
+                /* Load script on Divi theme builder page */
113
+                if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
114
+                    add_thickbox();
115
+                    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
116
+                }
117 117
 
118
-				if ( $this->is_preview() ) {
119
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
120
-					// this makes the insert button work for elementor
121
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
122
-						$this,
123
-						'shortcode_insert_button_script'
124
-					) ); // for elementor
125
-				}
126
-				// this makes the insert button work for cornerstone
127
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
118
+                if ( $this->is_preview() ) {
119
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
120
+                    // this makes the insert button work for elementor
121
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
122
+                        $this,
123
+                        'shortcode_insert_button_script'
124
+                    ) ); // for elementor
125
+                }
126
+                // this makes the insert button work for cornerstone
127
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
128 128
 
129
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
130
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
129
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
130
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
131 131
 
132
-				// add generator text to admin head
133
-				add_action( 'admin_head', array( $this, 'generator' ) );
134
-			}
132
+                // add generator text to admin head
133
+                add_action( 'admin_head', array( $this, 'generator' ) );
134
+            }
135 135
 
136
-			do_action( 'wp_super_duper_widget_init', $options, $this );
137
-		}
136
+            do_action( 'wp_super_duper_widget_init', $options, $this );
137
+        }
138 138
 
139 139
         /**
140 140
          * The register widget function
141 141
          * @return void
142 142
          */
143
-		public function _register() {
143
+        public function _register() {
144 144
             if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
145 145
                 parent::_register();
146
-			}
147
-		}
146
+            }
147
+        }
148 148
 
149
-		/**
150
-		 * Add our widget CSS to elementor editor.
151
-		 */
152
-		public function elementor_editor_styles() {
153
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
154
-		}
149
+        /**
150
+         * Add our widget CSS to elementor editor.
151
+         */
152
+        public function elementor_editor_styles() {
153
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
154
+        }
155 155
 
156
-		public function register_fusion_element() {
156
+        public function register_fusion_element() {
157 157
 
158
-			$options = $this->options;
158
+            $options = $this->options;
159 159
 
160
-			if ( $this->base_id ) {
160
+            if ( $this->base_id ) {
161 161
 
162
-				$params = $this->get_fusion_params();
162
+                $params = $this->get_fusion_params();
163 163
 
164
-				$args = array(
165
-					'name'            => $options['name'],
166
-					'shortcode'       => $this->base_id,
167
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
168
-					'allow_generator' => true,
169
-				);
164
+                $args = array(
165
+                    'name'            => $options['name'],
166
+                    'shortcode'       => $this->base_id,
167
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
168
+                    'allow_generator' => true,
169
+                );
170 170
 
171
-				if ( ! empty( $params ) ) {
172
-					$args['params'] = $params;
173
-				}
171
+                if ( ! empty( $params ) ) {
172
+                    $args['params'] = $params;
173
+                }
174 174
 
175
-				fusion_builder_map( $args );
176
-			}
175
+                fusion_builder_map( $args );
176
+            }
177 177
 
178
-		}
178
+        }
179 179
 
180
-		public function get_fusion_params() {
181
-			$params    = array();
182
-			$arguments = $this->get_arguments();
183
-
184
-			if ( ! empty( $arguments ) ) {
185
-				foreach ( $arguments as $key => $val ) {
186
-					$param = array();
187
-					// type
188
-					$param['type'] = str_replace(
189
-						array(
190
-							"text",
191
-							"number",
192
-							"email",
193
-							"color",
194
-							"checkbox"
195
-						),
196
-						array(
197
-							"textfield",
198
-							"textfield",
199
-							"textfield",
200
-							"colorpicker",
201
-							"select",
202
-
203
-						),
204
-						$val['type'] );
205
-
206
-					// multiselect
207
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
208
-						$param['type']     = 'multiple_select';
209
-						$param['multiple'] = true;
210
-					}
180
+        public function get_fusion_params() {
181
+            $params    = array();
182
+            $arguments = $this->get_arguments();
183
+
184
+            if ( ! empty( $arguments ) ) {
185
+                foreach ( $arguments as $key => $val ) {
186
+                    $param = array();
187
+                    // type
188
+                    $param['type'] = str_replace(
189
+                        array(
190
+                            "text",
191
+                            "number",
192
+                            "email",
193
+                            "color",
194
+                            "checkbox"
195
+                        ),
196
+                        array(
197
+                            "textfield",
198
+                            "textfield",
199
+                            "textfield",
200
+                            "colorpicker",
201
+                            "select",
211 202
 
212
-					// heading
213
-					$param['heading'] = $val['title'];
203
+                        ),
204
+                        $val['type'] );
214 205
 
215
-					// description
216
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
206
+                    // multiselect
207
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
208
+                        $param['type']     = 'multiple_select';
209
+                        $param['multiple'] = true;
210
+                    }
217 211
 
218
-					// param_name
219
-					$param['param_name'] = $key;
212
+                    // heading
213
+                    $param['heading'] = $val['title'];
220 214
 
221
-					// Default
222
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
215
+                    // description
216
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
223 217
 
224
-					// Group
225
-					if ( isset( $val['group'] ) ) {
226
-						$param['group'] = $val['group'];
227
-					}
218
+                    // param_name
219
+                    $param['param_name'] = $key;
228 220
 
229
-					// value
230
-					if ( $val['type'] == 'checkbox' ) {
231
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
232
-							unset( $param['default'] );
233
-						}
234
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
235
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
236
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
237
-					} else {
238
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
239
-					}
221
+                    // Default
222
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
240 223
 
241
-					// setup the param
242
-					$params[] = $param;
224
+                    // Group
225
+                    if ( isset( $val['group'] ) ) {
226
+                        $param['group'] = $val['group'];
227
+                    }
243 228
 
244
-				}
245
-			}
229
+                    // value
230
+                    if ( $val['type'] == 'checkbox' ) {
231
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
232
+                            unset( $param['default'] );
233
+                        }
234
+                        $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
235
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
236
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
237
+                    } else {
238
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
239
+                    }
246 240
 
241
+                    // setup the param
242
+                    $params[] = $param;
247 243
 
248
-			return $params;
249
-		}
244
+                }
245
+            }
250 246
 
251
-		/**
252
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
253
-		 */
254
-		public static function maybe_cornerstone_builder() {
255
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
256
-				self::shortcode_insert_button_script();
257
-			}
258
-		}
259 247
 
260
-		/**
261
-		 * A function to ge the shortcode builder picker html.
262
-		 *
263
-		 * @param string $editor_id
264
-		 *
265
-		 * @return string
266
-		 */
267
-		public static function get_picker( $editor_id = '' ) {
268
-
269
-			ob_start();
270
-			if ( isset( $_POST['editor_id'] ) ) {
271
-				$editor_id = esc_attr( $_POST['editor_id'] );
272
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
273
-				$editor_id = 'main_content_content_vb_tiny_mce';
274
-			}
248
+            return $params;
249
+        }
250
+
251
+        /**
252
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
253
+         */
254
+        public static function maybe_cornerstone_builder() {
255
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
256
+                self::shortcode_insert_button_script();
257
+            }
258
+        }
259
+
260
+        /**
261
+         * A function to ge the shortcode builder picker html.
262
+         *
263
+         * @param string $editor_id
264
+         *
265
+         * @return string
266
+         */
267
+        public static function get_picker( $editor_id = '' ) {
268
+
269
+            ob_start();
270
+            if ( isset( $_POST['editor_id'] ) ) {
271
+                $editor_id = esc_attr( $_POST['editor_id'] );
272
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
273
+                $editor_id = 'main_content_content_vb_tiny_mce';
274
+            }
275 275
 
276
-			global $sd_widgets;
276
+            global $sd_widgets;
277 277
 
278 278
 //			print_r($sd_widgets);exit;
279
-			?>
279
+            ?>
280 280
 
281 281
 			<div class="sd-shortcode-left-wrap">
282 282
 				<?php
283
-				ksort( $sd_widgets );
284
-				//				print_r($sd_widgets);exit;
285
-				if ( ! empty( $sd_widgets ) ) {
286
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
287
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
288
-					foreach ( $sd_widgets as $shortcode => $class ) {
289
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
290
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
291
-					}
292
-					echo "</select>";
283
+                ksort( $sd_widgets );
284
+                //				print_r($sd_widgets);exit;
285
+                if ( ! empty( $sd_widgets ) ) {
286
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
287
+                    echo "<option>" . __( 'Select shortcode' ) . "</option>";
288
+                    foreach ( $sd_widgets as $shortcode => $class ) {
289
+                        if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
290
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
291
+                    }
292
+                    echo "</select>";
293 293
 
294
-				}
295
-				?>
294
+                }
295
+                ?>
296 296
 				<div class="sd-shortcode-settings"></div>
297 297
 
298 298
 			</div>
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 					<?php if ( $editor_id != '' ) { ?>
304 304
 						<button class="button sd-insert-shortcode-button"
305 305
 						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
306
-							        echo "'" . $editor_id . "'";
307
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
306
+                                    echo "'" . $editor_id . "'";
307
+                                } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
308 308
 					<?php } ?>
309 309
 					<button class="button"
310 310
 					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -312,135 +312,135 @@  discard block
 block discarded – undo
312 312
 			</div>
313 313
 			<?php
314 314
 
315
-			$html = ob_get_clean();
315
+            $html = ob_get_clean();
316 316
 
317
-			if ( wp_doing_ajax() ) {
318
-				echo $html;
319
-				$should_die = true;
317
+            if ( wp_doing_ajax() ) {
318
+                echo $html;
319
+                $should_die = true;
320 320
 
321
-				// some builder get the editor via ajax so we should not die on those occasions
322
-				$dont_die = array(
323
-					'parent_tag',// WP Bakery
324
-					'avia_request' // enfold
325
-				);
321
+                // some builder get the editor via ajax so we should not die on those occasions
322
+                $dont_die = array(
323
+                    'parent_tag',// WP Bakery
324
+                    'avia_request' // enfold
325
+                );
326 326
 
327
-				foreach ( $dont_die as $request ) {
328
-					if ( isset( $_REQUEST[ $request ] ) ) {
329
-						$should_die = false;
330
-					}
331
-				}
327
+                foreach ( $dont_die as $request ) {
328
+                    if ( isset( $_REQUEST[ $request ] ) ) {
329
+                        $should_die = false;
330
+                    }
331
+                }
332 332
 
333
-				if ( $should_die ) {
334
-					wp_die();
335
-				}
333
+                if ( $should_die ) {
334
+                    wp_die();
335
+                }
336 336
 
337
-			} else {
338
-				return $html;
339
-			}
337
+            } else {
338
+                return $html;
339
+            }
340 340
 
341
-			return '';
341
+            return '';
342 342
 
343
-		}
343
+        }
344 344
 
345
-		/**
346
-		 * Output the version in the admin header.
347
-		 */
348
-		public function generator() {
349
-			echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
350
-		}
345
+        /**
346
+         * Output the version in the admin header.
347
+         */
348
+        public function generator() {
349
+            echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
350
+        }
351 351
 
352
-		/**
353
-		 * Get widget settings.
354
-		 *
355
-		 * @since 1.0.0
356
-		 */
357
-		public static function get_widget_settings() {
358
-			global $sd_widgets;
359
-
360
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
361
-			if ( ! $shortcode ) {
362
-				wp_die();
363
-			}
364
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
365
-			if ( ! $widget_args ) {
366
-				wp_die();
367
-			}
368
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
-			if ( ! $class_name ) {
370
-				wp_die();
371
-			}
352
+        /**
353
+         * Get widget settings.
354
+         *
355
+         * @since 1.0.0
356
+         */
357
+        public static function get_widget_settings() {
358
+            global $sd_widgets;
359
+
360
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
361
+            if ( ! $shortcode ) {
362
+                wp_die();
363
+            }
364
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
365
+            if ( ! $widget_args ) {
366
+                wp_die();
367
+            }
368
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
+            if ( ! $class_name ) {
370
+                wp_die();
371
+            }
372 372
 
373
-			// invoke an instance method
374
-			$widget = new $class_name;
373
+            // invoke an instance method
374
+            $widget = new $class_name;
375 375
 
376
-			ob_start();
377
-			$widget->form( array() );
378
-			$form = ob_get_clean();
379
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
380
-			echo "<style>" . $widget->widget_css() . "</style>";
381
-			echo "<script>" . $widget->widget_js() . "</script>";
382
-			?>
376
+            ob_start();
377
+            $widget->form( array() );
378
+            $form = ob_get_clean();
379
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
380
+            echo "<style>" . $widget->widget_css() . "</style>";
381
+            echo "<script>" . $widget->widget_js() . "</script>";
382
+            ?>
383 383
 			<?php
384
-			wp_die();
385
-		}
384
+            wp_die();
385
+        }
386 386
 
387
-		/**
388
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
389
-		 *
390
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
391
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
392
-		 *
393
-		 *@since 1.0.0
394
-		 *
395
-		 */
396
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
397
-			global $sd_widgets, $shortcode_insert_button_once;
398
-			if ( $shortcode_insert_button_once ) {
399
-				return;
400
-			}
401
-			add_thickbox();
387
+        /**
388
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
389
+         *
390
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
391
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
392
+         *
393
+         *@since 1.0.0
394
+         *
395
+         */
396
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
397
+            global $sd_widgets, $shortcode_insert_button_once;
398
+            if ( $shortcode_insert_button_once ) {
399
+                return;
400
+            }
401
+            add_thickbox();
402 402
 
403 403
 
404
-			/**
405
-			 * Cornerstone makes us play dirty tricks :/
406
-			 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
407
-			 */
408
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
409
-				echo '<span id="insert-media-button">';
410
-			}
404
+            /**
405
+             * Cornerstone makes us play dirty tricks :/
406
+             * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
407
+             */
408
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
409
+                echo '<span id="insert-media-button">';
410
+            }
411 411
 
412
-			echo self::shortcode_button( 'this', 'true' );
412
+            echo self::shortcode_button( 'this', 'true' );
413 413
 
414
-			// see opening note
415
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
416
-				echo '</span>'; // end #insert-media-button
417
-			}
414
+            // see opening note
415
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
416
+                echo '</span>'; // end #insert-media-button
417
+            }
418 418
 
419
-			// Add separate script for generatepress theme sections
420
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
421
-			} else {
422
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
423
-			}
419
+            // Add separate script for generatepress theme sections
420
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
421
+            } else {
422
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
423
+            }
424 424
 
425
-			$shortcode_insert_button_once = true;
426
-		}
425
+            $shortcode_insert_button_once = true;
426
+        }
427 427
 
428
-		/**
429
-		 * Gets the shortcode insert button html.
430
-		 *
431
-		 * @param string $id
432
-		 * @param string $search_for_id
433
-		 *
434
-		 * @return mixed
435
-		 */
436
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
437
-			ob_start();
438
-			?>
428
+        /**
429
+         * Gets the shortcode insert button html.
430
+         *
431
+         * @param string $id
432
+         * @param string $search_for_id
433
+         *
434
+         * @return mixed
435
+         */
436
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
437
+            ob_start();
438
+            ?>
439 439
 			<span class="sd-lable-shortcode-inserter">
440 440
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
441
-				if ( $search_for_id ) {
442
-					echo "," . $search_for_id;
443
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
441
+                if ( $search_for_id ) {
442
+                    echo "," . $search_for_id;
443
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
444 444
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
445 445
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
446 446
 					      class="dashicons dashicons-screenoptions"></span>
@@ -451,21 +451,21 @@  discard block
 block discarded – undo
451 451
 			</span>
452 452
 
453 453
 			<?php
454
-			$html = ob_get_clean();
454
+            $html = ob_get_clean();
455 455
 
456
-			// remove line breaks so we can use it in js
457
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
458
-		}
456
+            // remove line breaks so we can use it in js
457
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
458
+        }
459 459
 
460
-		/**
461
-		 * Makes SD work with the siteOrigin page builder.
462
-		 *
463
-		 * @return mixed
464
-		 *@since 1.0.6
465
-		 */
466
-		public static function siteorigin_js() {
467
-			ob_start();
468
-			?>
460
+        /**
461
+         * Makes SD work with the siteOrigin page builder.
462
+         *
463
+         * @return mixed
464
+         *@since 1.0.6
465
+         */
466
+        public static function siteorigin_js() {
467
+            ob_start();
468
+            ?>
469 469
 			<script>
470 470
 				/**
471 471
 				 * Check a form to see what items should be shown or hidden.
@@ -541,29 +541,29 @@  discard block
 block discarded – undo
541 541
 				});
542 542
 			</script>
543 543
 			<?php
544
-			$output = ob_get_clean();
544
+            $output = ob_get_clean();
545 545
 
546
-			/*
546
+            /*
547 547
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
548 548
 			 */
549 549
 
550
-			return str_replace( array(
551
-				'<script>',
552
-				'</script>'
553
-			), '', $output );
554
-		}
550
+            return str_replace( array(
551
+                '<script>',
552
+                '</script>'
553
+            ), '', $output );
554
+        }
555 555
 
556
-		/**
557
-		 * Output the JS and CSS for the shortcode insert button.
558
-		 *
559
-		 * @param string $editor_id
560
-		 * @param string $insert_shortcode_function
561
-		 *
562
-		 *@since 1.0.6
563
-		 *
564
-		 */
565
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
566
-			?>
556
+        /**
557
+         * Output the JS and CSS for the shortcode insert button.
558
+         *
559
+         * @param string $editor_id
560
+         * @param string $insert_shortcode_function
561
+         *
562
+         *@since 1.0.6
563
+         *
564
+         */
565
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
566
+            ?>
567 567
 			<style>
568 568
 				.sd-shortcode-left-wrap {
569 569
 					float: left;
@@ -691,35 +691,35 @@  discard block
 block discarded – undo
691 691
 				<?php } ?>
692 692
 			</style>
693 693
 			<?php
694
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
695
-				echo "<script>" . self::siteorigin_js() . "</script>";
696
-			}
697
-			?>
694
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
695
+                echo "<script>" . self::siteorigin_js() . "</script>";
696
+            }
697
+            ?>
698 698
 			<script>
699 699
 				<?php
700
-				if(! empty( $insert_shortcode_function )){
701
-					echo $insert_shortcode_function;
702
-				}else{
703
-
704
-				/**
705
-				 * Function for super duper insert shortcode.
706
-				 *
707
-				 * @since 1.0.0
708
-				 */
709
-				?>
700
+                if(! empty( $insert_shortcode_function )){
701
+                    echo $insert_shortcode_function;
702
+                }else{
703
+
704
+                /**
705
+                 * Function for super duper insert shortcode.
706
+                 *
707
+                 * @since 1.0.0
708
+                 */
709
+                ?>
710 710
 				function sd_insert_shortcode($editor_id) {
711 711
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
712 712
 					if ($shortcode) {
713 713
 						if (!$editor_id) {
714 714
 							<?php
715
-							if ( isset( $_REQUEST['et_fb'] ) ) {
716
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
717
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
718
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
719
-							} else {
720
-								echo '$editor_id = "#wp-content-editor-container textarea";';
721
-							}
722
-							?>
715
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
716
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
717
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
718
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
719
+                            } else {
720
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
721
+                            }
722
+                            ?>
723 723
 						} else {
724 724
 							$editor_id = '#' + $editor_id;
725 725
 						}
@@ -1046,18 +1046,18 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 			</script>
1048 1048
 			<?php
1049
-		}
1049
+        }
1050 1050
 
1051
-		/**
1052
-		 * Gets some CSS for the widgets screen.
1053
-		 *
1054
-		 * @param bool $advanced If we should include advanced CSS.
1055
-		 *
1056
-		 * @return mixed
1057
-		 */
1058
-		public function widget_css( $advanced = true ) {
1059
-			ob_start();
1060
-			?>
1051
+        /**
1052
+         * Gets some CSS for the widgets screen.
1053
+         *
1054
+         * @param bool $advanced If we should include advanced CSS.
1055
+         *
1056
+         * @return mixed
1057
+         */
1058
+        public function widget_css( $advanced = true ) {
1059
+            ob_start();
1060
+            ?>
1061 1061
 			<style>
1062 1062
 				<?php if( $advanced ){ ?>
1063 1063
 				.sd-advanced-setting {
@@ -1095,26 +1095,26 @@  discard block
 block discarded – undo
1095 1095
 				}
1096 1096
 			</style>
1097 1097
 			<?php
1098
-			$output = ob_get_clean();
1098
+            $output = ob_get_clean();
1099 1099
 
1100
-			/*
1100
+            /*
1101 1101
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1102 1102
 			 */
1103 1103
 
1104
-			return str_replace( array(
1105
-				'<style>',
1106
-				'</style>'
1107
-			), '', $output );
1108
-		}
1104
+            return str_replace( array(
1105
+                '<style>',
1106
+                '</style>'
1107
+            ), '', $output );
1108
+        }
1109 1109
 
1110
-		/**
1111
-		 * Gets some JS for the widgets screen.
1112
-		 *
1113
-		 * @return mixed
1114
-		 */
1115
-		public function widget_js() {
1116
-			ob_start();
1117
-			?>
1110
+        /**
1111
+         * Gets some JS for the widgets screen.
1112
+         *
1113
+         * @return mixed
1114
+         */
1115
+        public function widget_js() {
1116
+            ob_start();
1117
+            ?>
1118 1118
 			<script>
1119 1119
 
1120 1120
 				/**
@@ -1265,471 +1265,471 @@  discard block
 block discarded – undo
1265 1265
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1266 1266
 			</script>
1267 1267
 			<?php
1268
-			$output = ob_get_clean();
1268
+            $output = ob_get_clean();
1269 1269
 
1270
-			/*
1270
+            /*
1271 1271
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1272 1272
 			 */
1273 1273
 
1274
-			return str_replace( array(
1275
-				'<script>',
1276
-				'</script>'
1277
-			), '', $output );
1278
-		}
1274
+            return str_replace( array(
1275
+                '<script>',
1276
+                '</script>'
1277
+            ), '', $output );
1278
+        }
1279 1279
 
1280 1280
 
1281
-		/**
1282
-		 * Set the name from the argument key.
1283
-		 *
1284
-		 * @param $options
1285
-		 *
1286
-		 * @return mixed
1287
-		 */
1288
-		private function add_name_from_key( $options, $arguments = false ) {
1289
-			if ( ! empty( $options['arguments'] ) ) {
1290
-				foreach ( $options['arguments'] as $key => $val ) {
1291
-					$options['arguments'][ $key ]['name'] = $key;
1292
-				}
1293
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1294
-				foreach ( $options as $key => $val ) {
1295
-					$options[ $key ]['name'] = $key;
1296
-				}
1297
-			}
1281
+        /**
1282
+         * Set the name from the argument key.
1283
+         *
1284
+         * @param $options
1285
+         *
1286
+         * @return mixed
1287
+         */
1288
+        private function add_name_from_key( $options, $arguments = false ) {
1289
+            if ( ! empty( $options['arguments'] ) ) {
1290
+                foreach ( $options['arguments'] as $key => $val ) {
1291
+                    $options['arguments'][ $key ]['name'] = $key;
1292
+                }
1293
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1294
+                foreach ( $options as $key => $val ) {
1295
+                    $options[ $key ]['name'] = $key;
1296
+                }
1297
+            }
1298 1298
 
1299
-			return $options;
1300
-		}
1299
+            return $options;
1300
+        }
1301 1301
 
1302
-		/**
1303
-		 * Register the parent shortcode.
1304
-		 *
1305
-		 * @since 1.0.0
1306
-		 */
1307
-		public function register_shortcode() {
1308
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1309
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1310
-		}
1302
+        /**
1303
+         * Register the parent shortcode.
1304
+         *
1305
+         * @since 1.0.0
1306
+         */
1307
+        public function register_shortcode() {
1308
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1309
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1310
+        }
1311 1311
 
1312
-		/**
1313
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1314
-		 *
1315
-		 * @since 1.0.0
1316
-		 */
1317
-		public function render_shortcode() {
1318
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1319
-			if ( ! current_user_can( 'manage_options' ) ) {
1320
-				wp_die();
1321
-			}
1312
+        /**
1313
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1314
+         *
1315
+         * @since 1.0.0
1316
+         */
1317
+        public function render_shortcode() {
1318
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1319
+            if ( ! current_user_can( 'manage_options' ) ) {
1320
+                wp_die();
1321
+            }
1322 1322
 
1323
-			// we might need the $post value here so lets set it.
1324
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1325
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1326
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1327
-					global $post;
1328
-					$post = $post_obj;
1329
-				}
1330
-			}
1323
+            // we might need the $post value here so lets set it.
1324
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1325
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1326
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1327
+                    global $post;
1328
+                    $post = $post_obj;
1329
+                }
1330
+            }
1331 1331
 
1332
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1333
-				$is_preview = $this->is_preview();
1334
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1335
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1336
-				$attributes       = '';
1337
-				if ( ! empty( $attributes_array ) ) {
1338
-					foreach ( $attributes_array as $key => $value ) {
1339
-						if ( is_array( $value ) ) {
1340
-							$value = implode( ",", $value );
1341
-						}
1332
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1333
+                $is_preview = $this->is_preview();
1334
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1335
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1336
+                $attributes       = '';
1337
+                if ( ! empty( $attributes_array ) ) {
1338
+                    foreach ( $attributes_array as $key => $value ) {
1339
+                        if ( is_array( $value ) ) {
1340
+                            $value = implode( ",", $value );
1341
+                        }
1342 1342
 
1343
-						if ( ! empty( $value ) ) {
1344
-							$value = wp_unslash( $value );
1343
+                        if ( ! empty( $value ) ) {
1344
+                            $value = wp_unslash( $value );
1345 1345
 
1346
-							// Encode [ and ].
1347
-							if ( $is_preview ) {
1348
-								$value = $this->encode_shortcodes( $value );
1349
-							}
1350
-						}
1351
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1352
-					}
1353
-				}
1346
+                            // Encode [ and ].
1347
+                            if ( $is_preview ) {
1348
+                                $value = $this->encode_shortcodes( $value );
1349
+                            }
1350
+                        }
1351
+                        $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1352
+                    }
1353
+                }
1354 1354
 
1355
-				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1355
+                $shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1356 1356
 
1357
-				$content = do_shortcode( $shortcode );
1357
+                $content = do_shortcode( $shortcode );
1358 1358
 
1359
-				// Decode [ and ].
1360
-				if ( ! empty( $content ) && $is_preview ) {
1361
-					$content = $this->decode_shortcodes( $content );
1362
-				}
1359
+                // Decode [ and ].
1360
+                if ( ! empty( $content ) && $is_preview ) {
1361
+                    $content = $this->decode_shortcodes( $content );
1362
+                }
1363 1363
 
1364
-				echo $content;
1365
-			}
1366
-			wp_die();
1367
-		}
1364
+                echo $content;
1365
+            }
1366
+            wp_die();
1367
+        }
1368 1368
 
1369
-		/**
1370
-		 * Output the shortcode.
1371
-		 *
1372
-		 * @param array $args
1373
-		 * @param string $content
1374
-		 *
1375
-		 * @return string
1376
-		 */
1377
-		public function shortcode_output( $args = array(), $content = '' ) {
1378
-			$_instance = $args;
1379
-
1380
-			$args = $this->argument_values( $args );
1381
-
1382
-			// add extra argument so we know its a output to gutenberg
1383
-			//$args
1384
-			$args = $this->string_to_bool( $args );
1385
-
1386
-			// if we have a enclosed shortcode we add it to the special `html` argument
1387
-			if ( ! empty( $content ) ) {
1388
-				$args['html'] = $content;
1389
-			}
1369
+        /**
1370
+         * Output the shortcode.
1371
+         *
1372
+         * @param array $args
1373
+         * @param string $content
1374
+         *
1375
+         * @return string
1376
+         */
1377
+        public function shortcode_output( $args = array(), $content = '' ) {
1378
+            $_instance = $args;
1390 1379
 
1391
-			if ( ! $this->is_preview() ) {
1392
-				/**
1393
-				 * Filters the settings for a particular widget args.
1394
-				 *
1395
-				 * @param array          $args      The current widget instance's settings.
1396
-				 * @param WP_Super_Duper $widget    The current widget settings.
1397
-				 * @param array          $_instance An array of default widget arguments.
1398
-				 *
1399
-				 *@since 1.0.28
1400
-				 *
1401
-				 */
1402
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1380
+            $args = $this->argument_values( $args );
1403 1381
 
1404
-				if ( ! is_array( $args ) ) {
1405
-					return $args;
1406
-				}
1407
-			}
1382
+            // add extra argument so we know its a output to gutenberg
1383
+            //$args
1384
+            $args = $this->string_to_bool( $args );
1408 1385
 
1409
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1410
-			$class .= " sdel-".$this->get_instance_hash();
1386
+            // if we have a enclosed shortcode we add it to the special `html` argument
1387
+            if ( ! empty( $content ) ) {
1388
+                $args['html'] = $content;
1389
+            }
1411 1390
 
1412
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1413
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1391
+            if ( ! $this->is_preview() ) {
1392
+                /**
1393
+                 * Filters the settings for a particular widget args.
1394
+                 *
1395
+                 * @param array          $args      The current widget instance's settings.
1396
+                 * @param WP_Super_Duper $widget    The current widget settings.
1397
+                 * @param array          $_instance An array of default widget arguments.
1398
+                 *
1399
+                 *@since 1.0.28
1400
+                 *
1401
+                 */
1402
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1403
+
1404
+                if ( ! is_array( $args ) ) {
1405
+                    return $args;
1406
+                }
1407
+            }
1414 1408
 
1415
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1416
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1409
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1410
+            $class .= " sdel-".$this->get_instance_hash();
1417 1411
 
1418
-			$shortcode_args = array();
1419
-			$output         = '';
1420
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1421
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1422
-				$no_wrap = true;
1423
-			}
1424
-			$main_content = $this->output( $args, $shortcode_args, $content );
1425
-			if ( $main_content && ! $no_wrap ) {
1426
-				// wrap the shortcode in a div with the same class as the widget
1427
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1428
-				if ( ! empty( $args['title'] ) ) {
1429
-					// if its a shortcode and there is a title try to grab the title wrappers
1430
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1431
-					if ( empty( $instance ) ) {
1432
-						global $wp_registered_sidebars;
1433
-						if ( ! empty( $wp_registered_sidebars ) ) {
1434
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1435
-								if ( ! empty( $sidebar['before_title'] ) ) {
1436
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1437
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1438
-									break;
1439
-								}
1440
-							}
1441
-						}
1442
-					}
1443
-					$output .= $this->output_title( $shortcode_args, $args );
1444
-				}
1445
-				$output .= $main_content;
1446
-				$output .= '</div>';
1447
-			} elseif ( $main_content && $no_wrap ) {
1448
-				$output .= $main_content;
1449
-			}
1412
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1413
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1450 1414
 
1451
-			// if preview show a placeholder if empty
1452
-			if ( $this->is_preview() && $output == '' ) {
1453
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1454
-			}
1415
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1416
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1455 1417
 
1456
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1457
-		}
1418
+            $shortcode_args = array();
1419
+            $output         = '';
1420
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1421
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1422
+                $no_wrap = true;
1423
+            }
1424
+            $main_content = $this->output( $args, $shortcode_args, $content );
1425
+            if ( $main_content && ! $no_wrap ) {
1426
+                // wrap the shortcode in a div with the same class as the widget
1427
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1428
+                if ( ! empty( $args['title'] ) ) {
1429
+                    // if its a shortcode and there is a title try to grab the title wrappers
1430
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1431
+                    if ( empty( $instance ) ) {
1432
+                        global $wp_registered_sidebars;
1433
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1434
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1435
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1436
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1437
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1438
+                                    break;
1439
+                                }
1440
+                            }
1441
+                        }
1442
+                    }
1443
+                    $output .= $this->output_title( $shortcode_args, $args );
1444
+                }
1445
+                $output .= $main_content;
1446
+                $output .= '</div>';
1447
+            } elseif ( $main_content && $no_wrap ) {
1448
+                $output .= $main_content;
1449
+            }
1458 1450
 
1459
-		/**
1460
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1461
-		 *
1462
-		 * @param string $name
1463
-		 *
1464
-		 * @return string
1465
-		 */
1466
-		public function preview_placeholder_text( $name = '' ) {
1467
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1468
-		}
1451
+            // if preview show a placeholder if empty
1452
+            if ( $this->is_preview() && $output == '' ) {
1453
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1454
+            }
1469 1455
 
1470
-		/**
1471
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1472
-		 *
1473
-		 * @param $options
1474
-		 *
1475
-		 * @return mixed
1476
-		 */
1477
-		public function string_to_bool( $options ) {
1478
-			// convert bool strings to booleans
1479
-			foreach ( $options as $key => $val ) {
1480
-				if ( $val == 'false' ) {
1481
-					$options[ $key ] = false;
1482
-				} elseif ( $val == 'true' ) {
1483
-					$options[ $key ] = true;
1484
-				}
1485
-			}
1456
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1457
+        }
1486 1458
 
1487
-			return $options;
1488
-		}
1459
+        /**
1460
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1461
+         *
1462
+         * @param string $name
1463
+         *
1464
+         * @return string
1465
+         */
1466
+        public function preview_placeholder_text( $name = '' ) {
1467
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1468
+        }
1489 1469
 
1490
-		/**
1491
-		 * Get the argument values that are also filterable.
1492
-		 *
1493
-		 * @param $instance
1494
-		 *
1495
-		 * @return array
1496
-		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1497
-		 *
1498
-		 */
1499
-		public function argument_values( $instance ) {
1500
-			$argument_values = array();
1501
-
1502
-			// set widget instance
1503
-			$this->instance = $instance;
1504
-
1505
-			if ( empty( $this->arguments ) ) {
1506
-				$this->arguments = $this->get_arguments();
1507
-			}
1470
+        /**
1471
+         * Sometimes booleans values can be turned to strings, so we fix that.
1472
+         *
1473
+         * @param $options
1474
+         *
1475
+         * @return mixed
1476
+         */
1477
+        public function string_to_bool( $options ) {
1478
+            // convert bool strings to booleans
1479
+            foreach ( $options as $key => $val ) {
1480
+                if ( $val == 'false' ) {
1481
+                    $options[ $key ] = false;
1482
+                } elseif ( $val == 'true' ) {
1483
+                    $options[ $key ] = true;
1484
+                }
1485
+            }
1508 1486
 
1509
-			if ( ! empty( $this->arguments ) ) {
1510
-				foreach ( $this->arguments as $key => $args ) {
1511
-					// set the input name from the key
1512
-					$args['name'] = $key;
1513
-					//
1514
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1515
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1516
-						// don't set default for an empty checkbox
1517
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1518
-						$argument_values[ $key ] = $args['default'];
1519
-					}
1520
-				}
1521
-			}
1487
+            return $options;
1488
+        }
1522 1489
 
1523
-			return $argument_values;
1524
-		}
1490
+        /**
1491
+         * Get the argument values that are also filterable.
1492
+         *
1493
+         * @param $instance
1494
+         *
1495
+         * @return array
1496
+         *@since 1.0.12 Don't set checkbox default value if the value is empty.
1497
+         *
1498
+         */
1499
+        public function argument_values( $instance ) {
1500
+            $argument_values = array();
1525 1501
 
1526
-		/**
1527
-		 * Set arguments in super duper.
1528
-		 *
1529
-		 * @return array Set arguments.
1530
-		 *@since 1.0.0
1531
-		 *
1532
-		 */
1533
-		public function set_arguments() {
1534
-			return $this->arguments;
1535
-		}
1502
+            // set widget instance
1503
+            $this->instance = $instance;
1536 1504
 
1537
-		/**
1538
-		 * Get arguments in super duper.
1539
-		 *
1540
-		 * @return array Get arguments.
1541
-		 *@since 1.0.0
1542
-		 *
1543
-		 */
1544
-		public function get_arguments() {
1545
-			if ( empty( $this->arguments ) ) {
1546
-				$this->arguments = $this->set_arguments();
1547
-			}
1505
+            if ( empty( $this->arguments ) ) {
1506
+                $this->arguments = $this->get_arguments();
1507
+            }
1548 1508
 
1549
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1550
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1509
+            if ( ! empty( $this->arguments ) ) {
1510
+                foreach ( $this->arguments as $key => $args ) {
1511
+                    // set the input name from the key
1512
+                    $args['name'] = $key;
1513
+                    //
1514
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1515
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1516
+                        // don't set default for an empty checkbox
1517
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1518
+                        $argument_values[ $key ] = $args['default'];
1519
+                    }
1520
+                }
1521
+            }
1551 1522
 
1552
-			return $this->arguments;
1553
-		}
1523
+            return $argument_values;
1524
+        }
1554 1525
 
1555
-		/**
1556
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1557
-		 *
1558
-		 * @param array $args
1559
-		 * @param array $widget_args
1560
-		 * @param string $content
1561
-		 */
1562
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1526
+        /**
1527
+         * Set arguments in super duper.
1528
+         *
1529
+         * @return array Set arguments.
1530
+         *@since 1.0.0
1531
+         *
1532
+         */
1533
+        public function set_arguments() {
1534
+            return $this->arguments;
1535
+        }
1563 1536
 
1564
-		}
1537
+        /**
1538
+         * Get arguments in super duper.
1539
+         *
1540
+         * @return array Get arguments.
1541
+         *@since 1.0.0
1542
+         *
1543
+         */
1544
+        public function get_arguments() {
1545
+            if ( empty( $this->arguments ) ) {
1546
+                $this->arguments = $this->set_arguments();
1547
+            }
1565 1548
 
1566
-		/**
1567
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1568
-		 */
1569
-		public function register_block() {
1570
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1571
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1572
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1573
-			}
1574
-		}
1549
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1550
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1575 1551
 
1576
-		/**
1577
-		 * Check if we need to show advanced options.
1578
-		 *
1579
-		 * @return bool
1580
-		 */
1581
-		public function block_show_advanced() {
1582
-
1583
-			$show      = false;
1584
-			$arguments = $this->get_arguments();
1585
-
1586
-			if ( ! empty( $arguments ) ) {
1587
-				foreach ( $arguments as $argument ) {
1588
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1589
-						$show = true;
1590
-						break; // no need to continue if we know we have it
1591
-					}
1592
-				}
1593
-			}
1552
+            return $this->arguments;
1553
+        }
1594 1554
 
1595
-			return $show;
1596
-		}
1555
+        /**
1556
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1557
+         *
1558
+         * @param array $args
1559
+         * @param array $widget_args
1560
+         * @param string $content
1561
+         */
1562
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1597 1563
 
1598
-		/**
1599
-		 * Get the url path to the current folder.
1600
-		 *
1601
-		 * @return string
1602
-		 */
1603
-		public function get_url() {
1604
-			$url = $this->url;
1605
-
1606
-			if ( ! $url ) {
1607
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1608
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1609
-
1610
-				// Replace http:// to https://.
1611
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1612
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1613
-				}
1564
+        }
1614 1565
 
1615
-				// Check if we are inside a plugin
1616
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1617
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1618
-				$url = trailingslashit( $url );
1619
-				$this->url = $url;
1620
-			}
1566
+        /**
1567
+         * Add the dynamic block code inline when the wp-block in enqueued.
1568
+         */
1569
+        public function register_block() {
1570
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1571
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1572
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1573
+            }
1574
+        }
1621 1575
 
1622
-			return $url;
1623
-		}
1576
+        /**
1577
+         * Check if we need to show advanced options.
1578
+         *
1579
+         * @return bool
1580
+         */
1581
+        public function block_show_advanced() {
1624 1582
 
1625
-		/**
1626
-		 * Get the url path to the current folder.
1627
-		 *
1628
-		 * @return string
1629
-		 */
1630
-		public function get_url_old() {
1583
+            $show      = false;
1584
+            $arguments = $this->get_arguments();
1631 1585
 
1632
-			$url = $this->url;
1586
+            if ( ! empty( $arguments ) ) {
1587
+                foreach ( $arguments as $argument ) {
1588
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1589
+                        $show = true;
1590
+                        break; // no need to continue if we know we have it
1591
+                    }
1592
+                }
1593
+            }
1633 1594
 
1634
-			if ( ! $url ) {
1635
-				// check if we are inside a plugin
1636
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1595
+            return $show;
1596
+        }
1637 1597
 
1638
-				$dir_parts = explode( "/wp-content/", $file_dir );
1639
-				$url_parts = explode( "/wp-content/", plugins_url() );
1598
+        /**
1599
+         * Get the url path to the current folder.
1600
+         *
1601
+         * @return string
1602
+         */
1603
+        public function get_url() {
1604
+            $url = $this->url;
1640 1605
 
1641
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1642
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1643
-					$this->url = $url;
1644
-				}
1645
-			}
1606
+            if ( ! $url ) {
1607
+                $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1608
+                $content_url = untrailingslashit( WP_CONTENT_URL );
1646 1609
 
1610
+                // Replace http:// to https://.
1611
+                if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1612
+                    $content_url = str_replace( 'http://', 'https://', $content_url );
1613
+                }
1647 1614
 
1648
-			return $url;
1649
-		}
1615
+                // Check if we are inside a plugin
1616
+                $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1617
+                $url = str_replace( $content_dir, $content_url, $file_dir );
1618
+                $url = trailingslashit( $url );
1619
+                $this->url = $url;
1620
+            }
1650 1621
 
1651
-		/**
1652
-		 * Generate the block icon.
1653
-		 *
1654
-		 * Enables the use of Font Awesome icons.
1655
-		 *
1656
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1657
-		 *
1658
-		 * @param $icon
1659
-		 *
1660
-		 * @return string
1661
-		 *@since 1.1.0
1662
-		 */
1663
-		public function get_block_icon( $icon ) {
1664
-
1665
-			// check if we have a Font Awesome icon
1666
-			$fa_type = '';
1667
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1668
-				$fa_type = 'solid';
1669
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1670
-				$fa_type = 'regular';
1671
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1672
-				$fa_type = 'brands';
1673
-			} else {
1674
-				$icon = "'" . $icon . "'";
1675
-			}
1622
+            return $url;
1623
+        }
1676 1624
 
1677
-			// set the icon if we found one
1678
-			if ( $fa_type ) {
1679
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1680
-				$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1681
-			}
1625
+        /**
1626
+         * Get the url path to the current folder.
1627
+         *
1628
+         * @return string
1629
+         */
1630
+        public function get_url_old() {
1682 1631
 
1683
-			return $icon;
1684
-		}
1632
+            $url = $this->url;
1633
+
1634
+            if ( ! $url ) {
1635
+                // check if we are inside a plugin
1636
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1637
+
1638
+                $dir_parts = explode( "/wp-content/", $file_dir );
1639
+                $url_parts = explode( "/wp-content/", plugins_url() );
1640
+
1641
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1642
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1643
+                    $this->url = $url;
1644
+                }
1645
+            }
1646
+
1647
+
1648
+            return $url;
1649
+        }
1650
+
1651
+        /**
1652
+         * Generate the block icon.
1653
+         *
1654
+         * Enables the use of Font Awesome icons.
1655
+         *
1656
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1657
+         *
1658
+         * @param $icon
1659
+         *
1660
+         * @return string
1661
+         *@since 1.1.0
1662
+         */
1663
+        public function get_block_icon( $icon ) {
1664
+
1665
+            // check if we have a Font Awesome icon
1666
+            $fa_type = '';
1667
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1668
+                $fa_type = 'solid';
1669
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1670
+                $fa_type = 'regular';
1671
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1672
+                $fa_type = 'brands';
1673
+            } else {
1674
+                $icon = "'" . $icon . "'";
1675
+            }
1685 1676
 
1686
-		public function group_arguments( $arguments ) {
1677
+            // set the icon if we found one
1678
+            if ( $fa_type ) {
1679
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1680
+                $icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1681
+            }
1682
+
1683
+            return $icon;
1684
+        }
1685
+
1686
+        public function group_arguments( $arguments ) {
1687 1687
 //			echo '###';print_r($arguments);
1688
-			if ( ! empty( $arguments ) ) {
1689
-				$temp_arguments = array();
1690
-				$general        = __( "General" );
1691
-				$add_sections   = false;
1692
-				foreach ( $arguments as $key => $args ) {
1693
-					if ( isset( $args['group'] ) ) {
1694
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1695
-						$add_sections                             = true;
1696
-					} else {
1697
-						$temp_arguments[ $general ][ $key ] = $args;
1698
-					}
1699
-				}
1688
+            if ( ! empty( $arguments ) ) {
1689
+                $temp_arguments = array();
1690
+                $general        = __( "General" );
1691
+                $add_sections   = false;
1692
+                foreach ( $arguments as $key => $args ) {
1693
+                    if ( isset( $args['group'] ) ) {
1694
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1695
+                        $add_sections                             = true;
1696
+                    } else {
1697
+                        $temp_arguments[ $general ][ $key ] = $args;
1698
+                    }
1699
+                }
1700 1700
 
1701
-				// only add sections if more than one
1702
-				if ( $add_sections ) {
1703
-					$arguments = $temp_arguments;
1704
-				}
1705
-			}
1701
+                // only add sections if more than one
1702
+                if ( $add_sections ) {
1703
+                    $arguments = $temp_arguments;
1704
+                }
1705
+            }
1706 1706
 
1707 1707
 //			echo '###';print_r($arguments);
1708
-			return $arguments;
1709
-		}
1708
+            return $arguments;
1709
+        }
1710 1710
 
1711 1711
 
1712
-		/**
1713
-		 * Output the JS for building the dynamic Guntenberg block.
1714
-		 *
1715
-		 * @return mixed
1716
-		 *@since 1.0.9 Save numbers as numbers and not strings.
1717
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1718
-		 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1719
-		 */
1720
-		public function block() {
1712
+        /**
1713
+         * Output the JS for building the dynamic Guntenberg block.
1714
+         *
1715
+         * @return mixed
1716
+         *@since 1.0.9 Save numbers as numbers and not strings.
1717
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1718
+         * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1719
+         */
1720
+        public function block() {
1721 1721
             global $sd_is_js_functions_loaded;
1722 1722
 
1723
-			ob_start();
1723
+            ob_start();
1724 1724
 
1725
-			$show_advanced = $this->block_show_advanced();
1725
+            $show_advanced = $this->block_show_advanced();
1726 1726
 
1727 1727
 
1728
-			?>
1728
+            ?>
1729 1729
 			<script>
1730 1730
 
1731 1731
 			<?php
1732
-			if(!$sd_is_js_functions_loaded){
1732
+            if(!$sd_is_js_functions_loaded){
1733 1733
                 $sd_is_js_functions_loaded = true;
1734 1734
             ?>
1735 1735
 
@@ -2103,10 +2103,10 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
             }
2105 2105
 
2106
-			if(method_exists($this,'block_global_js')){
2107
-					echo $this->block_global_js();
2108
-			}
2109
-			?>
2106
+            if(method_exists($this,'block_global_js')){
2107
+                    echo $this->block_global_js();
2108
+            }
2109
+            ?>
2110 2110
 
2111 2111
 jQuery(function() {
2112 2112
 
@@ -2156,14 +2156,14 @@  discard block
 block discarded – undo
2156 2156
 						icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
2157 2157
 						supports: {
2158 2158
 							<?php
2159
-							if ( isset( $this->options['block-supports'] ) ) {
2160
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2161
-							}
2162
-							?>
2159
+                            if ( isset( $this->options['block-supports'] ) ) {
2160
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
2161
+                            }
2162
+                            ?>
2163 2163
 						},
2164 2164
 						<?php
2165
-						if ( isset( $this->options['block-label'] ) ) {
2166
-						?>
2165
+                        if ( isset( $this->options['block-label'] ) ) {
2166
+                        ?>
2167 2167
 						__experimentalLabel( attributes, { context } ) {
2168 2168
                             return <?php echo $this->options['block-label']; ?>;
2169 2169
                         },
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
                         ?>
2173 2173
 						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
2174 2174
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2175
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2175
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
2176 2176
 
2177 2177
 //						// block hover preview.
2178 2178
 //						$example_args = array();
@@ -2197,86 +2197,86 @@  discard block
 block discarded – undo
2197 2197
 
2198 2198
                         }
2199 2199
 
2200
-						// maybe set no_wrap
2201
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2202
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2203
-							$no_wrap = true;
2204
-						}
2205
-						if ( $no_wrap ) {
2206
-							$this->options['block-wrap'] = '';
2207
-						}
2200
+                        // maybe set no_wrap
2201
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2202
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2203
+                            $no_wrap = true;
2204
+                        }
2205
+                        if ( $no_wrap ) {
2206
+                            $this->options['block-wrap'] = '';
2207
+                        }
2208 2208
 
2209
-						// maybe load the drag/drop functions.
2210
-						$img_drag_drop = false;
2209
+                        // maybe load the drag/drop functions.
2210
+                        $img_drag_drop = false;
2211 2211
 
2212
-						$show_alignment = false;
2213
-						// align feature
2214
-						/*echo "supports: {";
2212
+                        $show_alignment = false;
2213
+                        // align feature
2214
+                        /*echo "supports: {";
2215 2215
 						echo "	align: true,";
2216 2216
 						echo "  html: false";
2217 2217
 						echo "},";*/
2218 2218
 
2219
-						if ( ! empty( $this->arguments ) ) {
2220
-							echo "attributes : {";
2219
+                        if ( ! empty( $this->arguments ) ) {
2220
+                            echo "attributes : {";
2221 2221
 
2222
-							if ( $show_advanced ) {
2223
-								echo "show_advanced: {";
2224
-								echo "	type: 'boolean',";
2225
-								echo "  default: false,";
2226
-								echo "},";
2227
-							}
2222
+                            if ( $show_advanced ) {
2223
+                                echo "show_advanced: {";
2224
+                                echo "	type: 'boolean',";
2225
+                                echo "  default: false,";
2226
+                                echo "},";
2227
+                            }
2228 2228
 
2229
-							// block wrap element
2230
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2231
-								echo "block_wrap: {";
2232
-								echo "	type: 'string',";
2233
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2234
-								echo "},";
2235
-							}
2229
+                            // block wrap element
2230
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2231
+                                echo "block_wrap: {";
2232
+                                echo "	type: 'string',";
2233
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2234
+                                echo "},";
2235
+                            }
2236 2236
 
2237 2237
 
2238 2238
 
2239
-							foreach ( $this->arguments as $key => $args ) {
2239
+                            foreach ( $this->arguments as $key => $args ) {
2240 2240
 
2241
-								if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2242
-									$img_drag_drop = true;
2243
-								}
2241
+                                if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2242
+                                    $img_drag_drop = true;
2243
+                                }
2244 2244
 
2245
-								// set if we should show alignment
2246
-								if ( $key == 'alignment' ) {
2247
-									$show_alignment = true;
2248
-								}
2245
+                                // set if we should show alignment
2246
+                                if ( $key == 'alignment' ) {
2247
+                                    $show_alignment = true;
2248
+                                }
2249 2249
 
2250
-								$extra = '';
2250
+                                $extra = '';
2251 2251
 
2252
-								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253
-									continue;
2254
-								}
2255
-								elseif ( $args['type'] == 'checkbox' ) {
2256
-									$type    = 'boolean';
2257
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258
-								} elseif ( $args['type'] == 'number' ) {
2259
-									$type    = 'number';
2260
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2261
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2262
-									$type = 'array';
2263
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2264
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2265
-									} else {
2266
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2267
-									}
2268
-								} elseif ( $args['type'] == 'tagselect' ) {
2269
-									$type    = 'array';
2270
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2271
-								} elseif ( $args['type'] == 'multiselect' ) {
2272
-									$type    = 'array';
2273
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2274
-								} elseif ( $args['type'] == 'image_xy' ) {
2275
-									$type    = 'object';
2276
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2277
-								} elseif ( $args['type'] == 'image' ) {
2278
-									$type    = 'string';
2279
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2252
+                                if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253
+                                    continue;
2254
+                                }
2255
+                                elseif ( $args['type'] == 'checkbox' ) {
2256
+                                    $type    = 'boolean';
2257
+                                    $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258
+                                } elseif ( $args['type'] == 'number' ) {
2259
+                                    $type    = 'number';
2260
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2261
+                                } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2262
+                                    $type = 'array';
2263
+                                    if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2264
+                                        $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2265
+                                    } else {
2266
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2267
+                                    }
2268
+                                } elseif ( $args['type'] == 'tagselect' ) {
2269
+                                    $type    = 'array';
2270
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2271
+                                } elseif ( $args['type'] == 'multiselect' ) {
2272
+                                    $type    = 'array';
2273
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2274
+                                } elseif ( $args['type'] == 'image_xy' ) {
2275
+                                    $type    = 'object';
2276
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2277
+                                } elseif ( $args['type'] == 'image' ) {
2278
+                                    $type    = 'string';
2279
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2280 2280
 
2281 2281
                                     // add a field for ID
2282 2282
 //                                    echo $key . "_id : {";
@@ -2286,25 +2286,25 @@  discard block
 block discarded – undo
2286 2286
 //                                    echo "type : 'object',";
2287 2287
 //                                    echo "},";
2288 2288
 
2289
-								} else {
2290
-									$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2291
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2289
+                                } else {
2290
+                                    $type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2291
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2292 2292
 
2293
-								}
2294
-								echo $key . " : {";
2295
-								echo "type : '$type',";
2296
-								echo "default : $default,";
2297
-								echo "},";
2298
-							}
2293
+                                }
2294
+                                echo $key . " : {";
2295
+                                echo "type : '$type',";
2296
+                                echo "default : $default,";
2297
+                                echo "},";
2298
+                            }
2299 2299
 
2300
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2301
-							echo "className: { type: 'string', default: '' },";
2300
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2301
+                            echo "className: { type: 'string', default: '' },";
2302 2302
 
2303
-							echo "},";
2303
+                            echo "},";
2304 2304
 
2305
-						}
2305
+                        }
2306 2306
 
2307
-						?>
2307
+                        ?>
2308 2308
 
2309 2309
 						// The "edit" property must be a valid function.
2310 2310
 						edit: function (props) {
@@ -2404,9 +2404,9 @@  discard block
 block discarded – undo
2404 2404
 
2405 2405
 							var $value = '';
2406 2406
 							<?php
2407
-							// if we have a post_type and a category then link them
2408
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2409
-							?>
2407
+                            // if we have a post_type and a category then link them
2408
+                            if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2409
+                            ?>
2410 2410
 							if(typeof(prev_attributes[props.clientId]) != 'undefined' ){
2411 2411
 								$pt = props.attributes.post_type;
2412 2412
 								if(post_type_rest_slugs.length){
@@ -2469,7 +2469,7 @@  discard block
 block discarded – undo
2469 2469
 <?php
2470 2470
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2471 2471
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2472
-	echo 'const { deviceType } = "";';
2472
+    echo 'const { deviceType } = "";';
2473 2473
 }else{
2474 2474
 ?>
2475 2475
 /** Get device type const. */
@@ -2503,8 +2503,8 @@  discard block
 block discarded – undo
2503 2503
 										'attributes': props.attributes,
2504 2504
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2505 2505
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2506
-										echo $post->ID;
2507
-									}else{echo '0';}?>,
2506
+                                        echo $post->ID;
2507
+                                    }else{echo '0';}?>,
2508 2508
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2509 2509
 									};
2510 2510
 
@@ -2581,10 +2581,10 @@  discard block
 block discarded – undo
2581 2581
 
2582 2582
 									<?php
2583 2583
 
2584
-									if(! empty( $this->arguments )){
2584
+                                    if(! empty( $this->arguments )){
2585 2585
 
2586
-									if ( $show_advanced ) {
2587
-									?>
2586
+                                    if ( $show_advanced ) {
2587
+                                    ?>
2588 2588
 									el('div', {
2589 2589
 											style: {'padding-left': '16px','padding-right': '16px'}
2590 2590
 										},
@@ -2602,146 +2602,146 @@  discard block
 block discarded – undo
2602 2602
 									,
2603 2603
 									<?php
2604 2604
 
2605
-									}
2605
+                                    }
2606 2606
 
2607
-								//	print_r( $this->arguments);
2607
+                                //	print_r( $this->arguments);
2608 2608
 
2609
-									//echo '####';
2609
+                                    //echo '####';
2610 2610
 
2611
-									$arguments = $this->group_arguments( $this->arguments );
2611
+                                    $arguments = $this->group_arguments( $this->arguments );
2612 2612
 //print_r($arguments ); exit;
2613
-									// Do we have sections?
2614
-									$has_sections = $arguments == $this->arguments ? false : true;
2613
+                                    // Do we have sections?
2614
+                                    $has_sections = $arguments == $this->arguments ? false : true;
2615 2615
 
2616 2616
 
2617
-									if($has_sections){
2618
-									$panel_count = 0;
2619
-									$open_tab = '';
2617
+                                    if($has_sections){
2618
+                                    $panel_count = 0;
2619
+                                    $open_tab = '';
2620 2620
 
2621
-									$open_tab_groups = array();
2622
-									$used_tabs = array();
2623
-									foreach($arguments as $key => $args){
2621
+                                    $open_tab_groups = array();
2622
+                                    $used_tabs = array();
2623
+                                    foreach($arguments as $key => $args){
2624 2624
 
2625
-										$close_tab = false;
2626
-										$close_tabs = false;
2625
+                                        $close_tab = false;
2626
+                                        $close_tabs = false;
2627 2627
 
2628
-										 if(!empty($this->options['block_group_tabs'])) {
2629
-											foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2630
-												if(in_array($key,$tab_args['groups'])){
2628
+                                            if(!empty($this->options['block_group_tabs'])) {
2629
+                                            foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2630
+                                                if(in_array($key,$tab_args['groups'])){
2631 2631
 
2632
-													$open_tab_groups[] = $key;
2632
+                                                    $open_tab_groups[] = $key;
2633 2633
 
2634
-													if($open_tab != $tab_name){
2635
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2636
-														$tab_args['tab']['open'] = true;
2634
+                                                    if($open_tab != $tab_name){
2635
+                                                        $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2636
+                                                        $tab_args['tab']['open'] = true;
2637 2637
 
2638
-														$this->block_tab_start( '', $tab_args );
2638
+                                                        $this->block_tab_start( '', $tab_args );
2639 2639
 //														echo '###open'.$tab_name;print_r($tab_args);
2640
-														$open_tab = $tab_name;
2641
-														$used_tabs[] = $tab_name;
2642
-													}
2640
+                                                        $open_tab = $tab_name;
2641
+                                                        $used_tabs[] = $tab_name;
2642
+                                                    }
2643 2643
 
2644
-													if($open_tab_groups == $tab_args['groups']){
2645
-														//$open_tab = '';
2646
-														$close_tab = true;
2647
-														$open_tab_groups = array();
2644
+                                                    if($open_tab_groups == $tab_args['groups']){
2645
+                                                        //$open_tab = '';
2646
+                                                        $close_tab = true;
2647
+                                                        $open_tab_groups = array();
2648 2648
 
2649 2649
 //													print_r(array_keys($this->options['block_group_tabs']));echo '####';print_r($used_tabs);
2650
-													if($used_tabs == array_keys($this->options['block_group_tabs'])){
2650
+                                                    if($used_tabs == array_keys($this->options['block_group_tabs'])){
2651 2651
 //														echo '@@@';
2652
-															$close_tabs = true;
2653
-														}
2654
-													}
2652
+                                                            $close_tabs = true;
2653
+                                                        }
2654
+                                                    }
2655 2655
 
2656
-												}
2657
-											}
2658
-										}
2656
+                                                }
2657
+                                            }
2658
+                                        }
2659 2659
 
2660 2660
 //
2661 2661
 
2662
-									//	print_r($arguments);exit;
2662
+                                    //	print_r($arguments);exit;
2663 2663
 
2664
-										?>
2664
+                                        ?>
2665 2665
 										el(wp.components.PanelBody, {
2666 2666
 												title: '<?php esc_attr_e( $key ); ?>',
2667 2667
 												initialOpen: <?php if ( $panel_count ) {
2668
-												echo "false";
2669
-											} else {
2670
-												echo "true";
2671
-											}?>
2668
+                                                echo "false";
2669
+                                            } else {
2670
+                                                echo "true";
2671
+                                            }?>
2672 2672
 											},
2673 2673
 											<?php
2674 2674
 
2675 2675
 
2676 2676
 
2677
-											foreach ( $args as $k => $a ) {
2677
+                                            foreach ( $args as $k => $a ) {
2678 2678
 
2679
-												$this->block_tab_start( $k, $a );
2680
-												$this->block_row_start( $k, $a );
2681
-												$this->build_block_arguments( $k, $a );
2682
-												$this->block_row_end( $k, $a );
2683
-												$this->block_tab_end( $k, $a );
2684
-											}
2685
-											?>
2679
+                                                $this->block_tab_start( $k, $a );
2680
+                                                $this->block_row_start( $k, $a );
2681
+                                                $this->build_block_arguments( $k, $a );
2682
+                                                $this->block_row_end( $k, $a );
2683
+                                                $this->block_tab_end( $k, $a );
2684
+                                            }
2685
+                                            ?>
2686 2686
 										),
2687 2687
 										<?php
2688
-										$panel_count ++;
2688
+                                        $panel_count ++;
2689 2689
 
2690 2690
 
2691
-										if($close_tab || $close_tabs){
2692
-											$tab_args = array(
2693
-												'tab'	=> array(
2694
-													'tabs_close' => $close_tabs,
2695
-												'close' => true,
2696
-												)
2691
+                                        if($close_tab || $close_tabs){
2692
+                                            $tab_args = array(
2693
+                                                'tab'	=> array(
2694
+                                                    'tabs_close' => $close_tabs,
2695
+                                                'close' => true,
2696
+                                                )
2697 2697
 
2698
-											);
2699
-											$this->block_tab_end( '', $tab_args );
2698
+                                            );
2699
+                                            $this->block_tab_end( '', $tab_args );
2700 2700
 //											echo '###close'; print_r($tab_args);
2701
-											$panel_count = 0;
2702
-										}
2701
+                                            $panel_count = 0;
2702
+                                        }
2703 2703
 //
2704 2704
 
2705
-									}
2706
-									}else {
2707
-									?>
2705
+                                    }
2706
+                                    }else {
2707
+                                    ?>
2708 2708
 									el(wp.components.PanelBody, {
2709 2709
 											title: '<?php esc_attr_e( "Settings" ); ?>',
2710 2710
 											initialOpen: true
2711 2711
 										},
2712 2712
 										<?php
2713
-										foreach ( $this->arguments as $key => $args ) {
2714
-											$this->block_row_start( $key, $args );
2715
-											$this->build_block_arguments( $key, $args );
2716
-											$this->block_row_end( $key, $args );
2717
-										}
2718
-										?>
2713
+                                        foreach ( $this->arguments as $key => $args ) {
2714
+                                            $this->block_row_start( $key, $args );
2715
+                                            $this->build_block_arguments( $key, $args );
2716
+                                            $this->block_row_end( $key, $args );
2717
+                                        }
2718
+                                        ?>
2719 2719
 									),
2720 2720
 									<?php
2721
-									}
2721
+                                    }
2722 2722
 
2723
-									}
2724
-									?>
2723
+                                    }
2724
+                                    ?>
2725 2725
 
2726 2726
 								),
2727 2727
 
2728 2728
 								<?php
2729
-								// If the user sets block-output array then build it
2730
-								if ( ! empty( $this->options['block-output'] ) ) {
2731
-								$this->block_element( $this->options['block-output'] );
2732
-							}elseif(!empty($this->options['block-edit-return'])){
2733
-                                   echo $this->options['block-edit-return'];
2734
-							}else{
2735
-								// if no block-output is set then we try and get the shortcode html output via ajax.
2736
-								?>
2729
+                                // If the user sets block-output array then build it
2730
+                                if ( ! empty( $this->options['block-output'] ) ) {
2731
+                                $this->block_element( $this->options['block-output'] );
2732
+                            }elseif(!empty($this->options['block-edit-return'])){
2733
+                                    echo $this->options['block-edit-return'];
2734
+                            }else{
2735
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
2736
+                                ?>
2737 2737
 								el('div', wp.blockEditor.useBlockProps({
2738 2738
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
2739 2739
 									className: props.className,
2740 2740
 									style: {'minHeight': '30px'}
2741 2741
 								}))
2742 2742
 								<?php
2743
-								}
2744
-								?>
2743
+                                }
2744
+                                ?>
2745 2745
 							]; // end return
2746 2746
 
2747 2747
 							<?php
@@ -2760,11 +2760,11 @@  discard block
 block discarded – undo
2760 2760
 							$html = '';
2761 2761
 							<?php
2762 2762
 
2763
-							if(! empty( $this->arguments )){
2763
+                            if(! empty( $this->arguments )){
2764 2764
 
2765
-							foreach($this->arguments as $key => $args){
2766
-                               // if($args['type']=='tabs'){continue;}
2767
-							?>
2765
+                            foreach($this->arguments as $key => $args){
2766
+                                // if($args['type']=='tabs'){continue;}
2767
+                            ?>
2768 2768
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2769 2769
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
2770 2770
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -2775,10 +2775,10 @@  discard block
 block discarded – undo
2775 2775
 								}
2776 2776
 							}
2777 2777
 							<?php
2778
-							}
2779
-							}
2778
+                            }
2779
+                            }
2780 2780
 
2781
-							?>
2781
+                            ?>
2782 2782
 							content += "]";
2783 2783
 
2784 2784
                             <?php
@@ -2825,7 +2825,7 @@  discard block
 block discarded – undo
2825 2825
 //                               $this->block_element( $this->options['block-output'], true );
2826 2826
 //                               echo ";";
2827 2827
 
2828
-                               ?>
2828
+                                ?>
2829 2829
                               return el(
2830 2830
                                    '',
2831 2831
                                    {},
@@ -2835,9 +2835,9 @@  discard block
 block discarded – undo
2835 2835
                                );
2836 2836
                                 <?php
2837 2837
 
2838
-							}elseif(!empty($this->options['block-save-return'])){
2839
-                                   echo 'return ' . $this->options['block-save-return'];
2840
-							}elseif(!empty($this->options['nested-block'])){
2838
+                            }elseif(!empty($this->options['block-save-return'])){
2839
+                                    echo 'return ' . $this->options['block-save-return'];
2840
+                            }elseif(!empty($this->options['nested-block'])){
2841 2841
                                 ?>
2842 2842
                               return el(
2843 2843
                                    '',
@@ -2847,22 +2847,22 @@  discard block
 block discarded – undo
2847 2847
                                    el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2848 2848
                                );
2849 2849
                                 <?php
2850
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2850
+                            }elseif(!empty( $this->options['block-save-return'] ) ){
2851 2851
                                 echo "return ". $this->options['block-edit-return'].";";
2852
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853
-							?>
2852
+                            }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853
+                            ?>
2854 2854
 							return content;
2855 2855
 							<?php
2856
-							}else{
2857
-							?>
2856
+                            }else{
2857
+                            ?>
2858 2858
 							var block_wrap = 'div';
2859 2859
 							if (attr.hasOwnProperty("block_wrap")) {
2860 2860
 								block_wrap = attr.block_wrap;
2861 2861
 							}
2862 2862
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
2863 2863
 							<?php
2864
-							}
2865
-							?>
2864
+                            }
2865
+                            ?>
2866 2866
 
2867 2867
 
2868 2868
 						}
@@ -2876,29 +2876,29 @@  discard block
 block discarded – undo
2876 2876
                 });
2877 2877
 			</script>
2878 2878
 			<?php
2879
-			$output = ob_get_clean();
2879
+            $output = ob_get_clean();
2880 2880
 
2881
-			/*
2881
+            /*
2882 2882
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2883 2883
 			 */
2884 2884
 
2885
-			return str_replace( array(
2886
-				'<script>',
2887
-				'</script>'
2888
-			), '', $output );
2889
-		}
2885
+            return str_replace( array(
2886
+                '<script>',
2887
+                '</script>'
2888
+            ), '', $output );
2889
+        }
2890 2890
 
2891 2891
 
2892 2892
 
2893
-		public function block_row_start($key, $args){
2893
+        public function block_row_start($key, $args){
2894 2894
 
2895
-			// check for row
2896
-			if(!empty($args['row'])){
2895
+            // check for row
2896
+            if(!empty($args['row'])){
2897 2897
 
2898
-				if(!empty($args['row']['open'])){
2898
+                if(!empty($args['row']['open'])){
2899 2899
 
2900
-				// element require
2901
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2900
+                // element require
2901
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2902 2902
                 $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
2903 2903
                 $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
2904 2904
                 $device_type_icon = '';
@@ -2909,10 +2909,10 @@  discard block
 block discarded – undo
2909 2909
                 }elseif($device_type=='Mobile'){
2910 2910
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2911 2911
                 }
2912
-				echo $element_require;
2912
+                echo $element_require;
2913 2913
                 echo $device_type_require;
2914 2914
 
2915
-					if(false){?><script><?php }?>
2915
+                    if(false){?><script><?php }?>
2916 2916
 						el('div', {
2917 2917
 								className: 'bsui components-base-control',
2918 2918
 							},
@@ -2950,51 +2950,51 @@  discard block
 block discarded – undo
2950 2950
 									},
2951 2951
 
2952 2952
 					<?php
2953
-					if(false){?></script><?php }
2954
-				}elseif(!empty($args['row']['close'])){
2955
-					if(false){?><script><?php }?>
2953
+                    if(false){?></script><?php }
2954
+                }elseif(!empty($args['row']['close'])){
2955
+                    if(false){?><script><?php }?>
2956 2956
 						el(
2957 2957
 							'div',
2958 2958
 							{
2959 2959
 								className: 'col pl-0',
2960 2960
 							},
2961 2961
 					<?php
2962
-					if(false){?></script><?php }
2963
-				}else{
2964
-					if(false){?><script><?php }?>
2962
+                    if(false){?></script><?php }
2963
+                }else{
2964
+                    if(false){?><script><?php }?>
2965 2965
 						el(
2966 2966
 							'div',
2967 2967
 							{
2968 2968
 								className: 'col pl-0 pr-2',
2969 2969
 							},
2970 2970
 					<?php
2971
-					if(false){?></script><?php }
2972
-				}
2971
+                    if(false){?></script><?php }
2972
+                }
2973 2973
 
2974
-			}
2974
+            }
2975 2975
 
2976
-		}
2976
+        }
2977 2977
 
2978
-		public function block_row_end($key, $args){
2978
+        public function block_row_end($key, $args){
2979 2979
 
2980
-			if(!empty($args['row'])){
2981
-				// maybe close
2982
-				if(!empty($args['row']['close'])){
2983
-					echo "))";
2984
-				}
2980
+            if(!empty($args['row'])){
2981
+                // maybe close
2982
+                if(!empty($args['row']['close'])){
2983
+                    echo "))";
2984
+                }
2985 2985
 
2986
-				echo "),";
2987
-			}
2988
-		}
2986
+                echo "),";
2987
+            }
2988
+        }
2989 2989
 
2990
-		public function block_tab_start($key, $args){
2990
+        public function block_tab_start($key, $args){
2991 2991
 
2992
-			// check for row
2993
-			if(!empty($args['tab'])){
2992
+            // check for row
2993
+            if(!empty($args['tab'])){
2994 2994
 
2995
-				if(!empty($args['tab']['tabs_open'])){
2995
+                if(!empty($args['tab']['tabs_open'])){
2996 2996
 
2997
-					if(false){?><script><?php }?>
2997
+                    if(false){?><script><?php }?>
2998 2998
 
2999 2999
 el('div',{className: 'bsui'},
3000 3000
 
@@ -3007,12 +3007,12 @@  discard block
 block discarded – undo
3007 3007
 										tabs: [
3008 3008
 
3009 3009
 					<?php
3010
-					if(false){?></script><?php }
3011
-				}
3010
+                    if(false){?></script><?php }
3011
+                }
3012 3012
 
3013
-				if(!empty($args['tab']['open'])){
3013
+                if(!empty($args['tab']['open'])){
3014 3014
 
3015
-					if(false){?><script><?php }?>
3015
+                    if(false){?><script><?php }?>
3016 3016
 							{
3017 3017
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3018 3018
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -3021,23 +3021,23 @@  discard block
 block discarded – undo
3021 3021
 									className: 'components-base-control__help mb-0',
3022 3022
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3023 3023
 								}),<?php }
3024
-					if(false){?></script><?php }
3025
-				}
3024
+                    if(false){?></script><?php }
3025
+                }
3026 3026
 
3027
-			}
3027
+            }
3028 3028
 
3029
-		}
3029
+        }
3030 3030
 
3031
-		public function block_tab_end($key, $args){
3031
+        public function block_tab_end($key, $args){
3032 3032
 
3033
-			if(!empty($args['tab'])){
3034
-				// maybe close
3035
-				if(!empty($args['tab']['close'])){
3036
-					echo ")}, /* tab close */";
3037
-				}
3033
+            if(!empty($args['tab'])){
3034
+                // maybe close
3035
+                if(!empty($args['tab']['close'])){
3036
+                    echo ")}, /* tab close */";
3037
+                }
3038 3038
 
3039
-				if(!empty($args['tab']['tabs_close'])){
3040
-					if(false){?><script><?php }?>
3039
+                if(!empty($args['tab']['tabs_close'])){
3040
+                    if(false){?><script><?php }?>
3041 3041
 							],
3042 3042
 									},
3043 3043
 									( tab ) => {
@@ -3047,22 +3047,22 @@  discard block
 block discarded – undo
3047 3047
 								}
3048 3048
 								)), /* tabs close */
3049 3049
 					<?php if(false){ ?></script><?php }
3050
-				}
3051
-			}
3052
-		}
3050
+                }
3051
+            }
3052
+        }
3053 3053
 
3054
-		public function build_block_arguments( $key, $args ) {
3055
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3056
-			$options           = '';
3057
-			$extra             = '';
3058
-			$require           = '';
3054
+        public function build_block_arguments( $key, $args ) {
3055
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3056
+            $options           = '';
3057
+            $extra             = '';
3058
+            $require           = '';
3059 3059
             $inside_elements   = '';
3060
-			$after_elements	   = '';
3060
+            $after_elements	   = '';
3061 3061
 
3062
-			// `content` is a protected and special argument
3063
-			if ( $key == 'content' ) {
3064
-				return;
3065
-			}
3062
+            // `content` is a protected and special argument
3063
+            if ( $key == 'content' ) {
3064
+                return;
3065
+            }
3066 3066
 
3067 3067
             $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3068 3068
             $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
@@ -3075,51 +3075,51 @@  discard block
 block discarded – undo
3075 3075
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3076 3076
             }
3077 3077
 
3078
-			// icon
3079
-			$icon = '';
3080
-			if( !empty( $args['icon'] ) ){
3081
-				$icon .= "el('div', {";
3082
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3083
-									$icon .= "className: 'text-center',";
3084
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3085
-								$icon .= "}),";
3086
-
3087
-				// blank title as its added to the icon.
3088
-				$args['title'] = '';
3089
-			}
3078
+            // icon
3079
+            $icon = '';
3080
+            if( !empty( $args['icon'] ) ){
3081
+                $icon .= "el('div', {";
3082
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3083
+                                    $icon .= "className: 'text-center',";
3084
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3085
+                                $icon .= "}),";
3086
+
3087
+                // blank title as its added to the icon.
3088
+                $args['title'] = '';
3089
+            }
3090 3090
 
3091
-			// require advanced
3092
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3091
+            // require advanced
3092
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3093 3093
 
3094
-			// element require
3095
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3094
+            // element require
3095
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3096 3096
 
3097 3097
 
3098
-			$onchange  = "props.setAttributes({ $key: $key } )";
3099
-			$onchangecomplete  = "";
3100
-			$value     = "props.attributes.$key";
3101
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3102
-			if ( in_array( $args['type'], $text_type ) ) {
3103
-				$type = 'TextControl';
3104
-				// Save numbers as numbers and not strings
3105
-				if ( $args['type'] == 'number' ) {
3106
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107
-				}
3108
-			}else if ( $args['type'] == 'styleid' ) {
3109
-				$type = 'TextControl';
3110
-				$args['type'] == 'text';
3111
-				// Save numbers as numbers and not strings
3112
-				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
-			}else if ( $args['type'] == 'notice' ) {
3114
-
3115
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3117
-
3118
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3119
-				echo $notice_message ? $element_require . $notice : '';
3120
-				return;
3121
-			}
3122
-			/*
3098
+            $onchange  = "props.setAttributes({ $key: $key } )";
3099
+            $onchangecomplete  = "";
3100
+            $value     = "props.attributes.$key";
3101
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3102
+            if ( in_array( $args['type'], $text_type ) ) {
3103
+                $type = 'TextControl';
3104
+                // Save numbers as numbers and not strings
3105
+                if ( $args['type'] == 'number' ) {
3106
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107
+                }
3108
+            }else if ( $args['type'] == 'styleid' ) {
3109
+                $type = 'TextControl';
3110
+                $args['type'] == 'text';
3111
+                // Save numbers as numbers and not strings
3112
+                $value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
+            }else if ( $args['type'] == 'notice' ) {
3114
+
3115
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3117
+
3118
+                $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3119
+                echo $notice_message ? $element_require . $notice : '';
3120
+                return;
3121
+            }
3122
+            /*
3123 3123
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3124 3124
 						elseif($args['type']=='tabs'){
3125 3125
 							?>
@@ -3172,23 +3172,23 @@  discard block
 block discarded – undo
3172 3172
 							return;
3173 3173
 						}
3174 3174
 */
3175
-			elseif ( $args['type'] == 'color' ) {
3176
-				$type = 'ColorPicker';
3177
-				$onchange = "";
3178
-				$extra = "color: $value,";
3179
-				if(!empty($args['disable_alpha'])){
3180
-					$extra .= "disableAlpha: true,";
3181
-				}
3182
-				$onchangecomplete = "onChangeComplete: function($key) {
3175
+            elseif ( $args['type'] == 'color' ) {
3176
+                $type = 'ColorPicker';
3177
+                $onchange = "";
3178
+                $extra = "color: $value,";
3179
+                if(!empty($args['disable_alpha'])){
3180
+                    $extra .= "disableAlpha: true,";
3181
+                }
3182
+                $onchangecomplete = "onChangeComplete: function($key) {
3183 3183
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3184 3184
                         props.setAttributes({
3185 3185
                             $key: value
3186 3186
                         });
3187 3187
                     },";
3188
-			}elseif ( $args['type'] == 'gradient' ) {
3189
-				$type = 'GradientPicker';
3188
+            }elseif ( $args['type'] == 'gradient' ) {
3189
+                $type = 'GradientPicker';
3190 3190
 
3191
-			}elseif ( $args['type'] == 'image' ) {
3191
+            }elseif ( $args['type'] == 'image' ) {
3192 3192
 //                print_r($args);
3193 3193
 
3194 3194
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3213,15 +3213,15 @@  discard block
 block discarded – undo
3213 3213
 
3214 3214
 
3215 3215
                 $value = '""';
3216
-				$type = 'MediaUpload';
3216
+                $type = 'MediaUpload';
3217 3217
                 $extra .= "onSelect: function(media){
3218 3218
                       return props.setAttributes({
3219 3219
                           $key: media.url,
3220 3220
                           {$key}_id: media.id
3221 3221
                         });
3222 3222
                       },";
3223
-                   $extra .= "type: 'image',";
3224
-                   $extra .= "render: function (obj) {
3223
+                    $extra .= "type: 'image',";
3224
+                    $extra .= "render: function (obj) {
3225 3225
                         return el( 'div',{},
3226 3226
                         ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3227 3227
                           className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3250,8 +3250,8 @@  discard block
 block discarded – undo
3250 3250
                 $onchange = "";
3251 3251
 
3252 3252
                 //$inside_elements = ",el('div',{},'file upload')";
3253
-			}elseif ( $args['type'] == 'images' ) {
3254
-				//                print_r($args);
3253
+            }elseif ( $args['type'] == 'images' ) {
3254
+                //                print_r($args);
3255 3255
 
3256 3256
                 $img_preview = "props.attributes.$key && (function() {
3257 3257
 
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
 
3281 3281
 
3282 3282
                 $value = '""';
3283
-				$type = 'MediaUpload';
3283
+                $type = 'MediaUpload';
3284 3284
                 $extra .= "onSelect: function(media){
3285 3285
 
3286 3286
                 let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
@@ -3294,9 +3294,9 @@  discard block
 block discarded – undo
3294 3294
                           $key: JSON.stringify(slim_images).replace('[','').replace(']',''),
3295 3295
                         });
3296 3296
                       },";
3297
-                   $extra .= "type: 'image',";
3298
-                   $extra .= "multiple: true,";
3299
-                   $extra .= "render: function (obj) {
3297
+                    $extra .= "type: 'image',";
3298
+                    $extra .= "multiple: true,";
3299
+                    $extra .= "render: function (obj) {
3300 3300
 
3301 3301
                    // init the sort
3302 3302
 				enableDragSort('sd-sortable');
@@ -3335,37 +3335,37 @@  discard block
 block discarded – undo
3335 3335
                 $onchange = "";
3336 3336
 
3337 3337
                 //$inside_elements = ",el('div',{},'file upload')";
3338
-			}
3339
-			elseif ( $args['type'] == 'checkbox' ) {
3340
-				$type = 'CheckboxControl';
3341
-				$extra .= "checked: props.attributes.$key,";
3342
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3343
-			} elseif ( $args['type'] == 'textarea' ) {
3344
-				$type = 'TextareaControl';
3345
-
3346
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3347
-				$type = 'SelectControl';
3348
-
3349
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
-				}else {
3354
-
3355
-					if ( ! empty( $args['options'] ) ) {
3356
-						$options .= "options: [";
3357
-						foreach ( $args['options'] as $option_val => $option_label ) {
3358
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3359
-						}
3360
-						$options .= "],";
3361
-					}
3362
-				}
3363
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3364
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3365
-				}
3338
+            }
3339
+            elseif ( $args['type'] == 'checkbox' ) {
3340
+                $type = 'CheckboxControl';
3341
+                $extra .= "checked: props.attributes.$key,";
3342
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3343
+            } elseif ( $args['type'] == 'textarea' ) {
3344
+                $type = 'TextareaControl';
3345
+
3346
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3347
+                $type = 'SelectControl';
3348
+
3349
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
+                }else {
3354
+
3355
+                    if ( ! empty( $args['options'] ) ) {
3356
+                        $options .= "options: [";
3357
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3358
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3359
+                        }
3360
+                        $options .= "],";
3361
+                    }
3362
+                }
3363
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3364
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3365
+                }
3366 3366
 
3367
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3368
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3367
+                if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3368
+                    $after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3369 3369
                                       className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3370 3370
                                       style: {margin:'-8px 0 8px 0',display: 'block'},
3371 3371
                                       onClick: function(){
@@ -3376,8 +3376,8 @@  discard block
 block discarded – undo
3376 3376
                                     },
3377 3377
                                     'Clear'
3378 3378
                             ),";
3379
-				}
3380
-			} elseif ( $args['type'] == 'tagselect' ) {
3379
+                }
3380
+            } elseif ( $args['type'] == 'tagselect' ) {
3381 3381
 //				$type = 'FormTokenField';
3382 3382
 //
3383 3383
 //				if ( ! empty( $args['options'] ) ) {
@@ -3412,39 +3412,39 @@  discard block
 block discarded – undo
3412 3412
 //				$value     = "[]";
3413 3413
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3414 3414
 
3415
-			} elseif ( $args['type'] == 'alignment' ) {
3416
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
-			}elseif ( $args['type'] == 'margins' ) {
3415
+            } elseif ( $args['type'] == 'alignment' ) {
3416
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
+            }elseif ( $args['type'] == 'margins' ) {
3418 3418
 
3419
-			} else {
3420
-				return;// if we have not implemented the control then don't break the JS.
3421
-			}
3419
+            } else {
3420
+                return;// if we have not implemented the control then don't break the JS.
3421
+            }
3422 3422
 
3423 3423
 
3424 3424
 
3425
-			// color input does not show the labels so we add them
3426
-			if($args['type']=='color'){
3427
-				// add show only if advanced
3428
-				echo $require_advanced;
3429
-				// add setting require if defined
3430
-				echo $element_require;
3431
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3432
-			}
3425
+            // color input does not show the labels so we add them
3426
+            if($args['type']=='color'){
3427
+                // add show only if advanced
3428
+                echo $require_advanced;
3429
+                // add setting require if defined
3430
+                echo $element_require;
3431
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3432
+            }
3433 3433
 
3434
-			// add show only if advanced
3435
-			echo $require_advanced;
3436
-			// add setting require if defined
3437
-			echo $element_require;
3434
+            // add show only if advanced
3435
+            echo $require_advanced;
3436
+            // add setting require if defined
3437
+            echo $element_require;
3438 3438
             echo $device_type_require;
3439 3439
 
3440
-			// icon
3441
-			echo $icon;
3442
-			?>
3440
+            // icon
3441
+            echo $icon;
3442
+            ?>
3443 3443
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
3444 3444
 			label: <?php
3445
-			if(empty($args['title'])){
3445
+            if(empty($args['title'])){
3446 3446
                 echo "''";
3447
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3447
+            }elseif(empty($args['row']) && !empty($args['device_type'])){
3448 3448
                 ?>el('label', {
3449 3449
 									className: 'components-base-control__label',
3450 3450
 									style: {width:"100%"}
@@ -3459,22 +3459,22 @@  discard block
 block discarded – undo
3459 3459
 
3460 3460
 							)<?php
3461 3461
 
3462
-			}else{
3463
-                 ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3462
+            }else{
3463
+                    ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3464 3464
 
3465
-			}
3465
+            }
3466 3466
 
3467
-			?>,
3467
+            ?>,
3468 3468
 			help: <?php if ( isset( $args['desc'] ) ) {
3469
-				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
-			}else{ echo "''"; } ?>,
3469
+                echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
+            }else{ echo "''"; } ?>,
3471 3471
 			value: <?php echo $value; ?>,
3472 3472
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3473
-				echo "type: '" . addslashes( $args['type'] ) . "',";
3474
-			} ?>
3473
+                echo "type: '" . addslashes( $args['type'] ) . "',";
3474
+            } ?>
3475 3475
 			<?php if ( ! empty( $args['placeholder'] ) ) {
3476
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3477
-			} ?>
3476
+                echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3477
+            } ?>
3478 3478
 			<?php echo $options; ?>
3479 3479
 			<?php echo $extra; ?>
3480 3480
 			<?php echo $custom_attributes; ?>
@@ -3487,69 +3487,69 @@  discard block
 block discarded – undo
3487 3487
 			<?php }?>
3488 3488
 			} <?php echo $inside_elements; ?> ),
3489 3489
 			<?php
3490
-			echo $after_elements;
3490
+            echo $after_elements;
3491 3491
 
3492
-		}
3492
+        }
3493 3493
 
3494
-		/**
3495
-		 * Convert an array of attributes to block string.
3496
-		 *
3497
-		 * @param $custom_attributes
3498
-		 *
3499
-		 * @return string
3500
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
3501
-		 *
3502
-		 */
3503
-		public function array_to_attributes( $custom_attributes, $html = false ) {
3504
-			$attributes = '';
3505
-			if ( ! empty( $custom_attributes ) ) {
3506
-
3507
-				foreach ( $custom_attributes as $key => $val ) {
3508
-					if(is_array($val)){
3509
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
-					}else{
3511
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3512
-					}
3513
-				}
3494
+        /**
3495
+         * Convert an array of attributes to block string.
3496
+         *
3497
+         * @param $custom_attributes
3498
+         *
3499
+         * @return string
3500
+         *@todo there is prob a faster way to do this, also we could add some validation here.
3501
+         *
3502
+         */
3503
+        public function array_to_attributes( $custom_attributes, $html = false ) {
3504
+            $attributes = '';
3505
+            if ( ! empty( $custom_attributes ) ) {
3514 3506
 
3515
-			}
3507
+                foreach ( $custom_attributes as $key => $val ) {
3508
+                    if(is_array($val)){
3509
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
+                    }else{
3511
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3512
+                    }
3513
+                }
3516 3514
 
3517
-			return $attributes;
3518
-		}
3515
+            }
3516
+
3517
+            return $attributes;
3518
+        }
3519 3519
 
3520 3520
 
3521 3521
 
3522
-		/**
3523
-		 * A self looping function to create the output for JS block elements.
3524
-		 *
3525
-		 * This is what is output in the WP Editor visual view.
3526
-		 *
3527
-		 * @param $args
3528
-		 */
3529
-		public function block_element( $args, $save = false ) {
3522
+        /**
3523
+         * A self looping function to create the output for JS block elements.
3524
+         *
3525
+         * This is what is output in the WP Editor visual view.
3526
+         *
3527
+         * @param $args
3528
+         */
3529
+        public function block_element( $args, $save = false ) {
3530 3530
 
3531 3531
 
3532
-			if ( ! empty( $args ) ) {
3533
-				foreach ( $args as $element => $new_args ) {
3532
+            if ( ! empty( $args ) ) {
3533
+                foreach ( $args as $element => $new_args ) {
3534 3534
 
3535
-					if ( is_array( $new_args ) ) { // its an element
3535
+                    if ( is_array( $new_args ) ) { // its an element
3536 3536
 
3537 3537
 
3538
-						if ( isset( $new_args['element'] ) ) {
3538
+                        if ( isset( $new_args['element'] ) ) {
3539 3539
 
3540
-							if ( isset( $new_args['element_require'] ) ) {
3541
-								echo str_replace( array(
3542
-										"'+",
3543
-										"+'"
3544
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3545
-								unset( $new_args['element_require'] );
3546
-							}
3540
+                            if ( isset( $new_args['element_require'] ) ) {
3541
+                                echo str_replace( array(
3542
+                                        "'+",
3543
+                                        "+'"
3544
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3545
+                                unset( $new_args['element_require'] );
3546
+                            }
3547 3547
 
3548 3548
                             if($new_args['element']=='InnerBlocks'){
3549 3549
                                 echo "\n el( InnerBlocks, {";
3550 3550
                             }elseif($new_args['element']=='innerBlocksProps'){
3551 3551
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3552
-                              //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3552
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3553 3553
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3554 3554
                                 echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3555 3555
                                 echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
@@ -3559,74 +3559,74 @@  discard block
 block discarded – undo
3559 3559
                                 echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
3560 3560
                             //    echo '###';
3561 3561
 
3562
-                              //  echo '###';
3562
+                                //  echo '###';
3563 3563
                             }elseif($new_args['element']=='BlocksProps'){
3564 3564
 
3565
-								if ( isset($new_args['if_inner_element']) ) {
3566
-									$element = $new_args['if_inner_element'];
3567
-								}else {
3568
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3569
-								}
3565
+                                if ( isset($new_args['if_inner_element']) ) {
3566
+                                    $element = $new_args['if_inner_element'];
3567
+                                }else {
3568
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3569
+                                }
3570 3570
 
3571
-								unset($new_args['inner_element']);
3571
+                                unset($new_args['inner_element']);
3572 3572
                                 echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
3573 3573
                                 echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3574 3574
 
3575 3575
 
3576
-                               // echo "} ),";
3576
+                                // echo "} ),";
3577 3577
 
3578 3578
                             }else{
3579 3579
                                 echo "\n el( '" . $new_args['element'] . "', {";
3580 3580
                             }
3581 3581
 
3582 3582
 
3583
-							// get the attributes
3584
-							foreach ( $new_args as $new_key => $new_value ) {
3583
+                            // get the attributes
3584
+                            foreach ( $new_args as $new_key => $new_value ) {
3585 3585
 
3586 3586
 
3587
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3588
-									// do nothing
3589
-								} else {
3590
-									echo $this->block_element( array( $new_key => $new_value ),$save );
3591
-								}
3592
-							}
3587
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3588
+                                    // do nothing
3589
+                                } else {
3590
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
3591
+                                }
3592
+                            }
3593 3593
 
3594
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3594
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3595 3595
 
3596
-							// get the content
3597
-							$first_item = 0;
3598
-							foreach ( $new_args as $new_key => $new_value ) {
3599
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3596
+                            // get the content
3597
+                            $first_item = 0;
3598
+                            foreach ( $new_args as $new_key => $new_value ) {
3599
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3600 3600
 
3601
-									if ( $new_key === 'content' ) {
3602
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
-									}else if ( $new_key === 'if_content' ) {
3604
-										echo  $this->block_props_replace(  $new_value  );
3605
-									}
3601
+                                    if ( $new_key === 'content' ) {
3602
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
+                                    }else if ( $new_key === 'if_content' ) {
3604
+                                        echo  $this->block_props_replace(  $new_value  );
3605
+                                    }
3606 3606
 
3607
-									if ( is_array( $new_value ) ) {
3607
+                                    if ( is_array( $new_value ) ) {
3608 3608
 
3609
-										if ( isset( $new_value['element_require'] ) ) {
3610
-											echo str_replace( array(
3611
-													"'+",
3612
-													"+'"
3613
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3614
-											unset( $new_value['element_require'] );
3615
-										}
3609
+                                        if ( isset( $new_value['element_require'] ) ) {
3610
+                                            echo str_replace( array(
3611
+                                                    "'+",
3612
+                                                    "+'"
3613
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3614
+                                            unset( $new_value['element_require'] );
3615
+                                        }
3616 3616
 
3617
-										if ( isset( $new_value['element_repeat'] ) ) {
3618
-											$x = 1;
3619
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
3620
-												$this->block_element( array( '' => $new_value ),$save );
3621
-												$x ++;
3622
-											}
3623
-										} else {
3624
-											$this->block_element( array( '' => $new_value ),$save );
3625
-										}
3626
-									}
3627
-									$first_item ++;
3628
-								}
3629
-							}
3617
+                                        if ( isset( $new_value['element_repeat'] ) ) {
3618
+                                            $x = 1;
3619
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
3620
+                                                $this->block_element( array( '' => $new_value ),$save );
3621
+                                                $x ++;
3622
+                                            }
3623
+                                        } else {
3624
+                                            $this->block_element( array( '' => $new_value ),$save );
3625
+                                        }
3626
+                                    }
3627
+                                    $first_item ++;
3628
+                                }
3629
+                            }
3630 3630
 
3631 3631
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3632 3632
                                 echo "))";// end content
@@ -3635,517 +3635,517 @@  discard block
 block discarded – undo
3635 3635
                             }
3636 3636
 
3637 3637
 
3638
-							echo ", \n";
3638
+                            echo ", \n";
3639 3639
 
3640
-						}
3641
-					} else {
3640
+                        }
3641
+                    } else {
3642 3642
 
3643
-						if ( substr( $element, 0, 3 ) === "if_" ) {
3644
-							$extra = '';
3645
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
3646
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3647
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3648
-							}
3649
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3650
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3643
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
3644
+                            $extra = '';
3645
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
3646
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3647
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3648
+                            }
3649
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3650
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3651 3651
                             $new_args = str_replace('[%WrapStyle%]','',$new_args);
3652 3652
                             echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
3653 3653
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3654
-						} elseif ( $element == 'style' ) {
3655
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3656
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3654
+                        } elseif ( $element == 'style' ) {
3655
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3656
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3657 3657
                             $new_args = str_replace('[%WrapClass%]','',$new_args);
3658 3658
                             echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
3659
-						} elseif ( $element == 'template' && $new_args ) {
3660
-							echo $element . ": $new_args,";
3661
-						} else {
3662
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3663
-						}
3659
+                        } elseif ( $element == 'template' && $new_args ) {
3660
+                            echo $element . ": $new_args,";
3661
+                        } else {
3662
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3663
+                        }
3664 3664
 
3665
-					}
3666
-				}
3667
-			}
3668
-		}
3665
+                    }
3666
+                }
3667
+            }
3668
+        }
3669 3669
 
3670
-		/**
3671
-		 * Replace block attributes placeholders with the proper naming.
3672
-		 *
3673
-		 * @param $string
3674
-		 *
3675
-		 * @return mixed
3676
-		 */
3677
-		public function block_props_replace( $string, $no_wrap = false ) {
3678
-
3679
-			if ( $no_wrap ) {
3680
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3681
-			} else {
3682
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3683
-			}
3670
+        /**
3671
+         * Replace block attributes placeholders with the proper naming.
3672
+         *
3673
+         * @param $string
3674
+         *
3675
+         * @return mixed
3676
+         */
3677
+        public function block_props_replace( $string, $no_wrap = false ) {
3684 3678
 
3685
-			return $string;
3686
-		}
3679
+            if ( $no_wrap ) {
3680
+                $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3681
+            } else {
3682
+                $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3683
+            }
3687 3684
 
3688
-		/**
3689
-		 * Outputs the content of the widget
3690
-		 *
3691
-		 * @param array $args
3692
-		 * @param array $instance
3693
-		 */
3694
-		public function widget( $args, $instance ) {
3695
-
3696
-			// get the filtered values
3697
-			$argument_values = $this->argument_values( $instance );
3698
-			$argument_values = $this->string_to_bool( $argument_values );
3699
-			$output          = $this->output( $argument_values, $args );
3700
-
3701
-			$no_wrap = false;
3702
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3703
-				$no_wrap = true;
3704
-			}
3685
+            return $string;
3686
+        }
3705 3687
 
3706
-			ob_start();
3707
-			if ( $output && ! $no_wrap ) {
3688
+        /**
3689
+         * Outputs the content of the widget
3690
+         *
3691
+         * @param array $args
3692
+         * @param array $instance
3693
+         */
3694
+        public function widget( $args, $instance ) {
3708 3695
 
3709
-				$class_original = $this->options['widget_ops']['classname'];
3710
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3696
+            // get the filtered values
3697
+            $argument_values = $this->argument_values( $instance );
3698
+            $argument_values = $this->string_to_bool( $argument_values );
3699
+            $output          = $this->output( $argument_values, $args );
3711 3700
 
3712
-				// Before widget
3713
-				$before_widget = $args['before_widget'];
3714
-				$before_widget = str_replace($class_original,$class,$before_widget);
3715
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3716
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3701
+            $no_wrap = false;
3702
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3703
+                $no_wrap = true;
3704
+            }
3717 3705
 
3718
-				// After widget
3719
-				$after_widget = $args['after_widget'];
3720
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3721
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3706
+            ob_start();
3707
+            if ( $output && ! $no_wrap ) {
3722 3708
 
3723
-				echo $before_widget;
3724
-				// elementor strips the widget wrapping div so we check for and add it back if needed
3725
-				if ( $this->is_elementor_widget_output() ) {
3726
-					// Filter class & attrs for elementor widget output.
3727
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3728
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3709
+                $class_original = $this->options['widget_ops']['classname'];
3710
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3729 3711
 
3730
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3731
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3712
+                // Before widget
3713
+                $before_widget = $args['before_widget'];
3714
+                $before_widget = str_replace($class_original,$class,$before_widget);
3715
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3716
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3732 3717
 
3733
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3734
-				}
3735
-				echo $this->output_title( $args, $instance );
3736
-				echo $output;
3737
-				if ( $this->is_elementor_widget_output() ) {
3738
-					echo "</span>";
3739
-				}
3740
-				echo $after_widget;
3741
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3742
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3743
-				echo $output;
3744
-			} elseif ( $output && $no_wrap ) {
3745
-				echo $output;
3746
-			}
3747
-			$output = ob_get_clean();
3718
+                // After widget
3719
+                $after_widget = $args['after_widget'];
3720
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3721
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3748 3722
 
3749
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3723
+                echo $before_widget;
3724
+                // elementor strips the widget wrapping div so we check for and add it back if needed
3725
+                if ( $this->is_elementor_widget_output() ) {
3726
+                    // Filter class & attrs for elementor widget output.
3727
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3728
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3750 3729
 
3751
-			echo $output;
3752
-		}
3730
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3731
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3753 3732
 
3754
-		/**
3755
-		 * Tests if the current output is inside a elementor container.
3756
-		 *
3757
-		 * @return bool
3758
-		 *@since 1.0.4
3759
-		 */
3760
-		public function is_elementor_widget_output() {
3761
-			$result = false;
3762
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3763
-				$result = true;
3764
-			}
3733
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3734
+                }
3735
+                echo $this->output_title( $args, $instance );
3736
+                echo $output;
3737
+                if ( $this->is_elementor_widget_output() ) {
3738
+                    echo "</span>";
3739
+                }
3740
+                echo $after_widget;
3741
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3742
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3743
+                echo $output;
3744
+            } elseif ( $output && $no_wrap ) {
3745
+                echo $output;
3746
+            }
3747
+            $output = ob_get_clean();
3765 3748
 
3766
-			return $result;
3767
-		}
3749
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3768 3750
 
3769
-		/**
3770
-		 * Tests if the current output is inside a elementor preview.
3771
-		 *
3772
-		 * @return bool
3773
-		 *@since 1.0.4
3774
-		 */
3775
-		public function is_elementor_preview() {
3776
-			$result = false;
3777
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3778
-				$result = true;
3779
-			}
3751
+            echo $output;
3752
+        }
3780 3753
 
3781
-			return $result;
3782
-		}
3754
+        /**
3755
+         * Tests if the current output is inside a elementor container.
3756
+         *
3757
+         * @return bool
3758
+         *@since 1.0.4
3759
+         */
3760
+        public function is_elementor_widget_output() {
3761
+            $result = false;
3762
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3763
+                $result = true;
3764
+            }
3783 3765
 
3784
-		/**
3785
-		 * Tests if the current output is inside a Divi preview.
3786
-		 *
3787
-		 * @return bool
3788
-		 *@since 1.0.6
3789
-		 */
3790
-		public function is_divi_preview() {
3791
-			$result = false;
3792
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3793
-				$result = true;
3794
-			}
3766
+            return $result;
3767
+        }
3795 3768
 
3796
-			return $result;
3797
-		}
3769
+        /**
3770
+         * Tests if the current output is inside a elementor preview.
3771
+         *
3772
+         * @return bool
3773
+         *@since 1.0.4
3774
+         */
3775
+        public function is_elementor_preview() {
3776
+            $result = false;
3777
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3778
+                $result = true;
3779
+            }
3798 3780
 
3799
-		/**
3800
-		 * Tests if the current output is inside a Beaver builder preview.
3801
-		 *
3802
-		 * @return bool
3803
-		 *@since 1.0.6
3804
-		 */
3805
-		public function is_beaver_preview() {
3806
-			$result = false;
3807
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3808
-				$result = true;
3809
-			}
3781
+            return $result;
3782
+        }
3810 3783
 
3811
-			return $result;
3812
-		}
3784
+        /**
3785
+         * Tests if the current output is inside a Divi preview.
3786
+         *
3787
+         * @return bool
3788
+         *@since 1.0.6
3789
+         */
3790
+        public function is_divi_preview() {
3791
+            $result = false;
3792
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3793
+                $result = true;
3794
+            }
3813 3795
 
3814
-		/**
3815
-		 * Tests if the current output is inside a siteorigin builder preview.
3816
-		 *
3817
-		 * @return bool
3818
-		 *@since 1.0.6
3819
-		 */
3820
-		public function is_siteorigin_preview() {
3821
-			$result = false;
3822
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3823
-				$result = true;
3824
-			}
3796
+            return $result;
3797
+        }
3825 3798
 
3826
-			return $result;
3827
-		}
3799
+        /**
3800
+         * Tests if the current output is inside a Beaver builder preview.
3801
+         *
3802
+         * @return bool
3803
+         *@since 1.0.6
3804
+         */
3805
+        public function is_beaver_preview() {
3806
+            $result = false;
3807
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
3808
+                $result = true;
3809
+            }
3828 3810
 
3829
-		/**
3830
-		 * Tests if the current output is inside a cornerstone builder preview.
3831
-		 *
3832
-		 * @return bool
3833
-		 *@since 1.0.8
3834
-		 */
3835
-		public function is_cornerstone_preview() {
3836
-			$result = false;
3837
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3838
-				$result = true;
3839
-			}
3811
+            return $result;
3812
+        }
3840 3813
 
3841
-			return $result;
3842
-		}
3814
+        /**
3815
+         * Tests if the current output is inside a siteorigin builder preview.
3816
+         *
3817
+         * @return bool
3818
+         *@since 1.0.6
3819
+         */
3820
+        public function is_siteorigin_preview() {
3821
+            $result = false;
3822
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3823
+                $result = true;
3824
+            }
3843 3825
 
3844
-		/**
3845
-		 * Tests if the current output is inside a fusion builder preview.
3846
-		 *
3847
-		 * @return bool
3848
-		 *@since 1.1.0
3849
-		 */
3850
-		public function is_fusion_preview() {
3851
-			$result = false;
3852
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3853
-				$result = true;
3854
-			}
3826
+            return $result;
3827
+        }
3855 3828
 
3856
-			return $result;
3857
-		}
3829
+        /**
3830
+         * Tests if the current output is inside a cornerstone builder preview.
3831
+         *
3832
+         * @return bool
3833
+         *@since 1.0.8
3834
+         */
3835
+        public function is_cornerstone_preview() {
3836
+            $result = false;
3837
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3838
+                $result = true;
3839
+            }
3858 3840
 
3859
-		/**
3860
-		 * Tests if the current output is inside a Oxygen builder preview.
3861
-		 *
3862
-		 * @return bool
3863
-		 *@since 1.0.18
3864
-		 */
3865
-		public function is_oxygen_preview() {
3866
-			$result = false;
3867
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3868
-				$result = true;
3869
-			}
3841
+            return $result;
3842
+        }
3870 3843
 
3871
-			return $result;
3872
-		}
3844
+        /**
3845
+         * Tests if the current output is inside a fusion builder preview.
3846
+         *
3847
+         * @return bool
3848
+         *@since 1.1.0
3849
+         */
3850
+        public function is_fusion_preview() {
3851
+            $result = false;
3852
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3853
+                $result = true;
3854
+            }
3873 3855
 
3874
-		/**
3875
-		 * General function to check if we are in a preview situation.
3876
-		 *
3877
-		 * @return bool
3878
-		 *@since 1.0.6
3879
-		 */
3880
-		public function is_preview() {
3881
-			$preview = false;
3882
-			if ( $this->is_divi_preview() ) {
3883
-				$preview = true;
3884
-			} elseif ( $this->is_elementor_preview() ) {
3885
-				$preview = true;
3886
-			} elseif ( $this->is_beaver_preview() ) {
3887
-				$preview = true;
3888
-			} elseif ( $this->is_siteorigin_preview() ) {
3889
-				$preview = true;
3890
-			} elseif ( $this->is_cornerstone_preview() ) {
3891
-				$preview = true;
3892
-			} elseif ( $this->is_fusion_preview() ) {
3893
-				$preview = true;
3894
-			} elseif ( $this->is_oxygen_preview() ) {
3895
-				$preview = true;
3896
-			} elseif( $this->is_block_content_call() ) {
3897
-				$preview = true;
3898
-			}
3856
+            return $result;
3857
+        }
3899 3858
 
3900
-			return $preview;
3901
-		}
3859
+        /**
3860
+         * Tests if the current output is inside a Oxygen builder preview.
3861
+         *
3862
+         * @return bool
3863
+         *@since 1.0.18
3864
+         */
3865
+        public function is_oxygen_preview() {
3866
+            $result = false;
3867
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3868
+                $result = true;
3869
+            }
3902 3870
 
3903
-		/**
3904
-		 * Output the super title.
3905
-		 *
3906
-		 * @param $args
3907
-		 * @param array $instance
3908
-		 *
3909
-		 * @return string
3910
-		 */
3911
-		public function output_title( $args, $instance = array() ) {
3912
-			$output = '';
3913
-			if ( ! empty( $instance['title'] ) ) {
3914
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3915
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3916
-
3917
-				if(empty($instance['widget_title_tag'])){
3918
-					$output = $args['before_title'] . $title . $args['after_title'];
3919
-				}else{
3920
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
3921
-
3922
-					// classes
3923
-					$title_classes = array();
3924
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3925
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3926
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3927
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3928
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3929
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3930
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3931
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3932
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3933
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3934
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3935
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3936
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3937
-
3938
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3939
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
3940
-				}
3871
+            return $result;
3872
+        }
3941 3873
 
3942
-			}
3874
+        /**
3875
+         * General function to check if we are in a preview situation.
3876
+         *
3877
+         * @return bool
3878
+         *@since 1.0.6
3879
+         */
3880
+        public function is_preview() {
3881
+            $preview = false;
3882
+            if ( $this->is_divi_preview() ) {
3883
+                $preview = true;
3884
+            } elseif ( $this->is_elementor_preview() ) {
3885
+                $preview = true;
3886
+            } elseif ( $this->is_beaver_preview() ) {
3887
+                $preview = true;
3888
+            } elseif ( $this->is_siteorigin_preview() ) {
3889
+                $preview = true;
3890
+            } elseif ( $this->is_cornerstone_preview() ) {
3891
+                $preview = true;
3892
+            } elseif ( $this->is_fusion_preview() ) {
3893
+                $preview = true;
3894
+            } elseif ( $this->is_oxygen_preview() ) {
3895
+                $preview = true;
3896
+            } elseif( $this->is_block_content_call() ) {
3897
+                $preview = true;
3898
+            }
3943 3899
 
3944
-			return $output;
3945
-		}
3900
+            return $preview;
3901
+        }
3902
+
3903
+        /**
3904
+         * Output the super title.
3905
+         *
3906
+         * @param $args
3907
+         * @param array $instance
3908
+         *
3909
+         * @return string
3910
+         */
3911
+        public function output_title( $args, $instance = array() ) {
3912
+            $output = '';
3913
+            if ( ! empty( $instance['title'] ) ) {
3914
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3915
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3916
+
3917
+                if(empty($instance['widget_title_tag'])){
3918
+                    $output = $args['before_title'] . $title . $args['after_title'];
3919
+                }else{
3920
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
3921
+
3922
+                    // classes
3923
+                    $title_classes = array();
3924
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3925
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3926
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3927
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3928
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3929
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3930
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3931
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3932
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3933
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3934
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3935
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3936
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3937
+
3938
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3939
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
3940
+                }
3941
+
3942
+            }
3946 3943
 
3947
-		/**
3948
-		 * Outputs the options form inputs for the widget.
3949
-		 *
3950
-		 * @param array $instance The widget options.
3951
-		 */
3952
-		public function form( $instance ) {
3944
+            return $output;
3945
+        }
3946
+
3947
+        /**
3948
+         * Outputs the options form inputs for the widget.
3949
+         *
3950
+         * @param array $instance The widget options.
3951
+         */
3952
+        public function form( $instance ) {
3953 3953
 
3954
-			// set widget instance
3955
-			$this->instance = $instance;
3954
+            // set widget instance
3955
+            $this->instance = $instance;
3956 3956
 
3957
-			// set it as a SD widget
3958
-			echo $this->widget_advanced_toggle();
3957
+            // set it as a SD widget
3958
+            echo $this->widget_advanced_toggle();
3959 3959
 
3960
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3961
-			$arguments_raw = $this->get_arguments();
3960
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3961
+            $arguments_raw = $this->get_arguments();
3962 3962
 
3963
-			if ( is_array( $arguments_raw ) ) {
3963
+            if ( is_array( $arguments_raw ) ) {
3964 3964
 
3965
-				$arguments = $this->group_arguments( $arguments_raw );
3965
+                $arguments = $this->group_arguments( $arguments_raw );
3966 3966
 
3967
-				// Do we have sections?
3968
-				$has_sections = $arguments == $arguments_raw ? false : true;
3967
+                // Do we have sections?
3968
+                $has_sections = $arguments == $arguments_raw ? false : true;
3969 3969
 
3970 3970
 
3971
-				if ( $has_sections ) {
3972
-					$panel_count = 0;
3973
-					foreach ( $arguments as $key => $args ) {
3971
+                if ( $has_sections ) {
3972
+                    $panel_count = 0;
3973
+                    foreach ( $arguments as $key => $args ) {
3974 3974
 
3975
-						?>
3975
+                        ?>
3976 3976
 						<script>
3977 3977
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
3978 3978
 						</script>
3979 3979
 						<?php
3980 3980
 
3981
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
3982
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3983
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3984
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3981
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
3982
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3983
+                        echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3984
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3985 3985
 
3986
-						foreach ( $args as $k => $a ) {
3986
+                        foreach ( $args as $k => $a ) {
3987 3987
 
3988
-							$this->widget_inputs_row_start($k, $a);
3989
-							$this->widget_inputs( $a, $instance );
3990
-							$this->widget_inputs_row_end($k, $a);
3988
+                            $this->widget_inputs_row_start($k, $a);
3989
+                            $this->widget_inputs( $a, $instance );
3990
+                            $this->widget_inputs_row_end($k, $a);
3991 3991
 
3992
-						}
3992
+                        }
3993 3993
 
3994
-						echo "</div>";
3994
+                        echo "</div>";
3995 3995
 
3996
-						$panel_count ++;
3996
+                        $panel_count ++;
3997 3997
 
3998
-					}
3999
-				} else {
4000
-					foreach ( $arguments as $key => $args ) {
4001
-						$this->widget_inputs_row_start($key, $args);
4002
-						$this->widget_inputs( $args, $instance );
4003
-						$this->widget_inputs_row_end($key, $args);
4004
-					}
4005
-				}
3998
+                    }
3999
+                } else {
4000
+                    foreach ( $arguments as $key => $args ) {
4001
+                        $this->widget_inputs_row_start($key, $args);
4002
+                        $this->widget_inputs( $args, $instance );
4003
+                        $this->widget_inputs_row_end($key, $args);
4004
+                    }
4005
+                }
4006 4006
 
4007
-			}
4008
-		}
4007
+            }
4008
+        }
4009 4009
 
4010
-		public function widget_inputs_row_start($key, $args){
4011
-			if(!empty($args['row'])){
4012
-				// maybe open
4013
-				if(!empty($args['row']['open'])){
4014
-					?>
4010
+        public function widget_inputs_row_start($key, $args){
4011
+            if(!empty($args['row'])){
4012
+                // maybe open
4013
+                if(!empty($args['row']['open'])){
4014
+                    ?>
4015 4015
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
4016
-						echo $this->convert_element_require( $args['row']['element_require'] );
4017
-					} ?>'>
4016
+                        echo $this->convert_element_require( $args['row']['element_require'] );
4017
+                    } ?>'>
4018 4018
 					<?php if(!empty($args['row']['title'])){ ?>
4019 4019
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4020 4020
 					<?php }?>
4021 4021
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4022 4022
 					<div class='col pr-2'>
4023 4023
 					<?php
4024
-				}elseif(!empty($args['row']['close'])){
4025
-					echo "<div class='col pl-0'>";
4026
-				}else{
4027
-					echo "<div class='col pl-0 pr-2'>";
4028
-				}
4029
-			}
4030
-		}
4024
+                }elseif(!empty($args['row']['close'])){
4025
+                    echo "<div class='col pl-0'>";
4026
+                }else{
4027
+                    echo "<div class='col pl-0 pr-2'>";
4028
+                }
4029
+            }
4030
+        }
4031 4031
 
4032
-		public function widget_inputs_row_end($key, $args){
4032
+        public function widget_inputs_row_end($key, $args){
4033 4033
 
4034
-			if(!empty($args['row'])){
4035
-				// maybe close
4036
-				if(!empty($args['row']['close'])){
4037
-					echo "</div></div>";
4038
-				}
4034
+            if(!empty($args['row'])){
4035
+                // maybe close
4036
+                if(!empty($args['row']['close'])){
4037
+                    echo "</div></div>";
4038
+                }
4039 4039
 
4040
-				echo "</div>";
4041
-			}
4042
-		}
4040
+                echo "</div>";
4041
+            }
4042
+        }
4043 4043
 
4044
-		/**
4045
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
4046
-		 *
4047
-		 * @return string
4048
-		 */
4049
-		public function widget_advanced_toggle() {
4050
-
4051
-			$output = '';
4052
-			if ( $this->block_show_advanced() ) {
4053
-				$val = 1;
4054
-			} else {
4055
-				$val = 0;
4056
-			}
4044
+        /**
4045
+         * Get the hidden input that when added makes the advanced button show on widget settings.
4046
+         *
4047
+         * @return string
4048
+         */
4049
+        public function widget_advanced_toggle() {
4057 4050
 
4058
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4051
+            $output = '';
4052
+            if ( $this->block_show_advanced() ) {
4053
+                $val = 1;
4054
+            } else {
4055
+                $val = 0;
4056
+            }
4059 4057
 
4060
-			return $output;
4061
-		}
4058
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4062 4059
 
4063
-		/**
4064
-		 * Convert require element.
4065
-		 *
4066
-		 * @param string $input Input element.
4067
-		 *
4068
-		 * @return string $output
4069
-		 *@since 1.0.0
4070
-		 *
4071
-		 */
4072
-		public function convert_element_require( $input ) {
4073
-
4074
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4075
-
4076
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
4077
-				"jQuery(form).find('[data-argument=\"",
4078
-				"\"]').find('input,select,textarea').val()"
4079
-			), $input ) );
4080
-
4081
-			return $output;
4082
-		}
4060
+            return $output;
4061
+        }
4083 4062
 
4084
-		/**
4085
-		 * Builds the inputs for the widget options.
4086
-		 *
4087
-		 * @param $args
4088
-		 * @param $instance
4089
-		 */
4090
-		public function widget_inputs( $args, $instance ) {
4091
-
4092
-			$class             = "";
4093
-			$element_require   = "";
4094
-			$custom_attributes = "";
4095
-
4096
-			// get value
4097
-			if ( isset( $instance[ $args['name'] ] ) ) {
4098
-				$value = $instance[ $args['name'] ];
4099
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4100
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4101
-			} else {
4102
-				$value = '';
4103
-			}
4063
+        /**
4064
+         * Convert require element.
4065
+         *
4066
+         * @param string $input Input element.
4067
+         *
4068
+         * @return string $output
4069
+         *@since 1.0.0
4070
+         *
4071
+         */
4072
+        public function convert_element_require( $input ) {
4104 4073
 
4105
-			// get placeholder
4106
-			if ( ! empty( $args['placeholder'] ) ) {
4107
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4108
-			} else {
4109
-				$placeholder = '';
4110
-			}
4074
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4111 4075
 
4112
-			// get if advanced
4113
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4114
-				$class .= " sd-advanced-setting ";
4115
-			}
4076
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
4077
+                "jQuery(form).find('[data-argument=\"",
4078
+                "\"]').find('input,select,textarea').val()"
4079
+            ), $input ) );
4116 4080
 
4117
-			// element_require
4118
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4119
-				$element_require = $args['element_require'];
4120
-			}
4081
+            return $output;
4082
+        }
4121 4083
 
4122
-			// custom_attributes
4123
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4124
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4125
-			}
4084
+        /**
4085
+         * Builds the inputs for the widget options.
4086
+         *
4087
+         * @param $args
4088
+         * @param $instance
4089
+         */
4090
+        public function widget_inputs( $args, $instance ) {
4091
+
4092
+            $class             = "";
4093
+            $element_require   = "";
4094
+            $custom_attributes = "";
4095
+
4096
+            // get value
4097
+            if ( isset( $instance[ $args['name'] ] ) ) {
4098
+                $value = $instance[ $args['name'] ];
4099
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4100
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4101
+            } else {
4102
+                $value = '';
4103
+            }
4104
+
4105
+            // get placeholder
4106
+            if ( ! empty( $args['placeholder'] ) ) {
4107
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4108
+            } else {
4109
+                $placeholder = '';
4110
+            }
4126 4111
 
4112
+            // get if advanced
4113
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4114
+                $class .= " sd-advanced-setting ";
4115
+            }
4127 4116
 
4128
-			// before wrapper
4129
-			?>
4117
+            // element_require
4118
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4119
+                $element_require = $args['element_require'];
4120
+            }
4121
+
4122
+            // custom_attributes
4123
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4124
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4125
+            }
4126
+
4127
+
4128
+            // before wrapper
4129
+            ?>
4130 4130
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
4131 4131
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
4132 4132
 			data-element_require='<?php if ( $element_require ) {
4133
-				echo $this->convert_element_require( $element_require );
4134
-			} ?>'
4133
+                echo $this->convert_element_require( $element_require );
4134
+            } ?>'
4135 4135
 			>
4136 4136
 			<?php
4137 4137
 
4138 4138
 
4139
-			switch ( $args['type'] ) {
4140
-				//array('text','password','number','email','tel','url','color')
4141
-				case "text":
4142
-				case "password":
4143
-				case "number":
4144
-				case "email":
4145
-				case "tel":
4146
-				case "url":
4147
-				case "color":
4148
-					?>
4139
+            switch ( $args['type'] ) {
4140
+                //array('text','password','number','email','tel','url','color')
4141
+                case "text":
4142
+                case "password":
4143
+                case "number":
4144
+                case "email":
4145
+                case "tel":
4146
+                case "url":
4147
+                case "color":
4148
+                    ?>
4149 4149
 					<label
4150 4150
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4151 4151
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -4156,47 +4156,47 @@  discard block
 block discarded – undo
4156 4156
 						                               value="<?php echo esc_attr( $value ); ?>">
4157 4157
 					<?php
4158 4158
 
4159
-					break;
4160
-				case "select":
4161
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4162
-					if ( $multiple ) {
4163
-						if ( empty( $value ) ) {
4164
-							$value = array();
4165
-						}
4166
-					}
4167
-					?>
4159
+                    break;
4160
+                case "select":
4161
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4162
+                    if ( $multiple ) {
4163
+                        if ( empty( $value ) ) {
4164
+                            $value = array();
4165
+                        }
4166
+                    }
4167
+                    ?>
4168 4168
 					<label
4169 4169
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4170 4170
 					<select <?php echo $placeholder; ?> class="widefat"
4171 4171
 						<?php echo $custom_attributes; ?>
4172 4172
 						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4173 4173
 						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
4174
-						                                if ( $multiple ) {
4175
-							                                echo "[]";
4176
-						                                } ?>"
4174
+                                                        if ( $multiple ) {
4175
+                                                            echo "[]";
4176
+                                                        } ?>"
4177 4177
 						<?php if ( $multiple ) {
4178
-							echo "multiple";
4179
-						} //@todo not implemented yet due to gutenberg not supporting it
4180
-						?>
4178
+                            echo "multiple";
4179
+                        } //@todo not implemented yet due to gutenberg not supporting it
4180
+                        ?>
4181 4181
 					>
4182 4182
 						<?php
4183 4183
 
4184
-						if ( ! empty( $args['options'] ) ) {
4185
-							foreach ( $args['options'] as $val => $label ) {
4186
-								if ( $multiple ) {
4187
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4188
-								} else {
4189
-									$selected = selected( $value, $val, false );
4190
-								}
4191
-								echo "<option value='$val' " . $selected . ">$label</option>";
4192
-							}
4193
-						}
4194
-						?>
4184
+                        if ( ! empty( $args['options'] ) ) {
4185
+                            foreach ( $args['options'] as $val => $label ) {
4186
+                                if ( $multiple ) {
4187
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4188
+                                } else {
4189
+                                    $selected = selected( $value, $val, false );
4190
+                                }
4191
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4192
+                            }
4193
+                        }
4194
+                        ?>
4195 4195
 					</select>
4196 4196
 					<?php
4197
-					break;
4198
-				case "checkbox":
4199
-					?>
4197
+                    break;
4198
+                case "checkbox":
4199
+                    ?>
4200 4200
 					<input <?php echo $placeholder; ?>
4201 4201
 						<?php checked( 1, $value, true ) ?>
4202 4202
 						<?php echo $custom_attributes; ?>
@@ -4206,9 +4206,9 @@  discard block
 block discarded – undo
4206 4206
 					<label
4207 4207
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4208 4208
 					<?php
4209
-					break;
4210
-				case "textarea":
4211
-					?>
4209
+                    break;
4210
+                case "textarea":
4211
+                    ?>
4212 4212
 					<label
4213 4213
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4214 4214
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -4218,282 +4218,282 @@  discard block
 block discarded – undo
4218 4218
 					><?php echo esc_attr( $value ); ?></textarea>
4219 4219
 					<?php
4220 4220
 
4221
-					break;
4222
-				case "hidden":
4223
-					?>
4221
+                    break;
4222
+                case "hidden":
4223
+                    ?>
4224 4224
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4225 4225
 					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
4226 4226
 					       value="<?php echo esc_attr( $value ); ?>">
4227 4227
 					<?php
4228
-					break;
4229
-				default:
4230
-					echo "No input type found!"; // @todo we need to add more input types.
4231
-			}
4228
+                    break;
4229
+                default:
4230
+                    echo "No input type found!"; // @todo we need to add more input types.
4231
+            }
4232 4232
 
4233
-			// after wrapper
4234
-			?>
4233
+            // after wrapper
4234
+            ?>
4235 4235
 			</p>
4236 4236
 			<?php
4237 4237
 
4238 4238
 
4239
-		}
4239
+        }
4240 4240
 
4241
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4242
-			if($icon=='box-top'){
4243
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4244
-			}elseif($icon=='box-right'){
4245
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4246
-			}elseif($icon=='box-bottom'){
4247
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4248
-			}elseif($icon=='box-left'){
4249
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4250
-			}
4251
-		}
4241
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4242
+            if($icon=='box-top'){
4243
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4244
+            }elseif($icon=='box-right'){
4245
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4246
+            }elseif($icon=='box-bottom'){
4247
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4248
+            }elseif($icon=='box-left'){
4249
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4250
+            }
4251
+        }
4252 4252
 
4253
-		/**
4254
-		 * Get the widget input description html.
4255
-		 *
4256
-		 * @param $args
4257
-		 *
4258
-		 * @return string
4259
-		 * @todo, need to make its own tooltip script
4260
-		 */
4261
-		public function widget_field_desc( $args ) {
4262
-
4263
-			$description = '';
4264
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4265
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4266
-					$description = $this->desc_tip( $args['desc'] );
4267
-				} else {
4268
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4269
-				}
4270
-			}
4253
+        /**
4254
+         * Get the widget input description html.
4255
+         *
4256
+         * @param $args
4257
+         *
4258
+         * @return string
4259
+         * @todo, need to make its own tooltip script
4260
+         */
4261
+        public function widget_field_desc( $args ) {
4262
+
4263
+            $description = '';
4264
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4265
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4266
+                    $description = $this->desc_tip( $args['desc'] );
4267
+                } else {
4268
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4269
+                }
4270
+            }
4271 4271
 
4272
-			return $description;
4273
-		}
4272
+            return $description;
4273
+        }
4274 4274
 
4275
-		/**
4276
-		 * Get the widget input title html.
4277
-		 *
4278
-		 * @param $args
4279
-		 *
4280
-		 * @return string
4281
-		 */
4282
-		public function widget_field_title( $args ) {
4283
-
4284
-			$title = '';
4285
-			if ( isset( $args['title'] ) && $args['title'] ) {
4286
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4287
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4288
-				} else {
4289
-					$title = esc_attr($args['title']);
4290
-				}
4291
-			}
4275
+        /**
4276
+         * Get the widget input title html.
4277
+         *
4278
+         * @param $args
4279
+         *
4280
+         * @return string
4281
+         */
4282
+        public function widget_field_title( $args ) {
4283
+
4284
+            $title = '';
4285
+            if ( isset( $args['title'] ) && $args['title'] ) {
4286
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4287
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4288
+                } else {
4289
+                    $title = esc_attr($args['title']);
4290
+                }
4291
+            }
4292 4292
 
4293
-			return $title;
4294
-		}
4293
+            return $title;
4294
+        }
4295 4295
 
4296
-		/**
4297
-		 * Get the tool tip html.
4298
-		 *
4299
-		 * @param $tip
4300
-		 * @param bool $allow_html
4301
-		 *
4302
-		 * @return string
4303
-		 */
4304
-		function desc_tip( $tip, $allow_html = false ) {
4305
-			if ( $allow_html ) {
4306
-				$tip = $this->sanitize_tooltip( $tip );
4307
-			} else {
4308
-				$tip = esc_attr( $tip );
4309
-			}
4296
+        /**
4297
+         * Get the tool tip html.
4298
+         *
4299
+         * @param $tip
4300
+         * @param bool $allow_html
4301
+         *
4302
+         * @return string
4303
+         */
4304
+        function desc_tip( $tip, $allow_html = false ) {
4305
+            if ( $allow_html ) {
4306
+                $tip = $this->sanitize_tooltip( $tip );
4307
+            } else {
4308
+                $tip = esc_attr( $tip );
4309
+            }
4310 4310
 
4311
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4312
-		}
4311
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4312
+        }
4313 4313
 
4314
-		/**
4315
-		 * Sanitize a string destined to be a tooltip.
4316
-		 *
4317
-		 * @param string $var
4318
-		 *
4319
-		 * @return string
4320
-		 */
4321
-		public function sanitize_tooltip( $var ) {
4322
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4323
-				'br'     => array(),
4324
-				'em'     => array(),
4325
-				'strong' => array(),
4326
-				'small'  => array(),
4327
-				'span'   => array(),
4328
-				'ul'     => array(),
4329
-				'li'     => array(),
4330
-				'ol'     => array(),
4331
-				'p'      => array(),
4332
-			) ) );
4333
-		}
4314
+        /**
4315
+         * Sanitize a string destined to be a tooltip.
4316
+         *
4317
+         * @param string $var
4318
+         *
4319
+         * @return string
4320
+         */
4321
+        public function sanitize_tooltip( $var ) {
4322
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4323
+                'br'     => array(),
4324
+                'em'     => array(),
4325
+                'strong' => array(),
4326
+                'small'  => array(),
4327
+                'span'   => array(),
4328
+                'ul'     => array(),
4329
+                'li'     => array(),
4330
+                'ol'     => array(),
4331
+                'p'      => array(),
4332
+            ) ) );
4333
+        }
4334 4334
 
4335
-		/**
4336
-		 * Processing widget options on save
4337
-		 *
4338
-		 * @param array $new_instance The new options
4339
-		 * @param array $old_instance The previous options
4340
-		 *
4341
-		 * @return array
4342
-		 * @todo we should add some sanitation here.
4343
-		 */
4344
-		public function update( $new_instance, $old_instance ) {
4345
-
4346
-			//save the widget
4347
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4348
-
4349
-			// set widget instance
4350
-			$this->instance = $instance;
4351
-
4352
-			if ( empty( $this->arguments ) ) {
4353
-				$this->get_arguments();
4354
-			}
4335
+        /**
4336
+         * Processing widget options on save
4337
+         *
4338
+         * @param array $new_instance The new options
4339
+         * @param array $old_instance The previous options
4340
+         *
4341
+         * @return array
4342
+         * @todo we should add some sanitation here.
4343
+         */
4344
+        public function update( $new_instance, $old_instance ) {
4355 4345
 
4356
-			// check for checkboxes
4357
-			if ( ! empty( $this->arguments ) ) {
4358
-				foreach ( $this->arguments as $argument ) {
4359
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4360
-						$instance[ $argument['name'] ] = '0';
4361
-					}
4362
-				}
4363
-			}
4346
+            //save the widget
4347
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4364 4348
 
4365
-			return $instance;
4366
-		}
4349
+            // set widget instance
4350
+            $this->instance = $instance;
4367 4351
 
4368
-		/**
4369
-		 * Checks if the current call is a ajax call to get the block content.
4370
-		 *
4371
-		 * This can be used in your widget to return different content as the block content.
4372
-		 *
4373
-		 * @return bool
4374
-		 *@since 1.0.3
4375
-		 */
4376
-		public function is_block_content_call() {
4377
-			$result = false;
4378
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4379
-				$result = true;
4380
-			}
4352
+            if ( empty( $this->arguments ) ) {
4353
+                $this->get_arguments();
4354
+            }
4381 4355
 
4382
-			return $result;
4383
-		}
4356
+            // check for checkboxes
4357
+            if ( ! empty( $this->arguments ) ) {
4358
+                foreach ( $this->arguments as $argument ) {
4359
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4360
+                        $instance[ $argument['name'] ] = '0';
4361
+                    }
4362
+                }
4363
+            }
4384 4364
 
4385
-		/**
4386
-		 * Get an instance hash that will be unique to the type and settings.
4387
-		 *
4388
-		 * @return string
4389
-		 *@since 1.0.20
4390
-		 */
4391
-		public function get_instance_hash(){
4392
-			$instance_string = $this->base_id.serialize($this->instance);
4393
-			return hash('crc32b',$instance_string);
4394
-		}
4365
+            return $instance;
4366
+        }
4395 4367
 
4396
-		/**
4397
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4398
-		 *
4399
-		 * @param array $rules
4400
-		 *
4401
-		 * @return string
4402
-		 *@since 1.0.20
4403
-		 */
4404
-		public function get_instance_style($rules = array()){
4405
-			$css = '';
4406
-
4407
-			if(!empty($rules)){
4408
-				$rules = array_unique($rules);
4409
-				$instance_hash = $this->get_instance_hash();
4410
-				$css .= "<style>";
4411
-				foreach($rules as $rule){
4412
-					$css .= ".sdel-$instance_hash $rule";
4413
-				}
4414
-				$css .= "</style>";
4415
-			}
4368
+        /**
4369
+         * Checks if the current call is a ajax call to get the block content.
4370
+         *
4371
+         * This can be used in your widget to return different content as the block content.
4372
+         *
4373
+         * @return bool
4374
+         *@since 1.0.3
4375
+         */
4376
+        public function is_block_content_call() {
4377
+            $result = false;
4378
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4379
+                $result = true;
4380
+            }
4416 4381
 
4417
-			return $css;
4418
-		}
4382
+            return $result;
4383
+        }
4384
+
4385
+        /**
4386
+         * Get an instance hash that will be unique to the type and settings.
4387
+         *
4388
+         * @return string
4389
+         *@since 1.0.20
4390
+         */
4391
+        public function get_instance_hash(){
4392
+            $instance_string = $this->base_id.serialize($this->instance);
4393
+            return hash('crc32b',$instance_string);
4394
+        }
4395
+
4396
+        /**
4397
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4398
+         *
4399
+         * @param array $rules
4400
+         *
4401
+         * @return string
4402
+         *@since 1.0.20
4403
+         */
4404
+        public function get_instance_style($rules = array()){
4405
+            $css = '';
4406
+
4407
+            if(!empty($rules)){
4408
+                $rules = array_unique($rules);
4409
+                $instance_hash = $this->get_instance_hash();
4410
+                $css .= "<style>";
4411
+                foreach($rules as $rule){
4412
+                    $css .= ".sdel-$instance_hash $rule";
4413
+                }
4414
+                $css .= "</style>";
4415
+            }
4416
+
4417
+            return $css;
4418
+        }
4419 4419
 
4420
-		/**
4421
-		 * Encode shortcodes tags.
4422
-		 *
4423
-		 * @param string $content Content to search for shortcode tags.
4424
-		 *
4420
+        /**
4421
+         * Encode shortcodes tags.
4422
+         *
4423
+         * @param string $content Content to search for shortcode tags.
4424
+         *
4425 4425
 *@return string Content with shortcode tags removed.
4426
-		 *@since 1.0.28
4427
-		 *
4428
-		 */
4429
-		public function encode_shortcodes( $content ) {
4430
-			// Avoids existing encoded tags.
4431
-			$trans   = array(
4432
-				'&#91;' => '&#091;',
4433
-				'&#93;' => '&#093;',
4434
-				'&amp;#91;' => '&#091;',
4435
-				'&amp;#93;' => '&#093;',
4436
-				'&lt;' => '&0lt;',
4437
-				'&gt;' => '&0gt;',
4438
-				'&amp;lt;' => '&0lt;',
4439
-				'&amp;gt;' => '&0gt;',
4440
-			);
4441
-
4442
-			$content = strtr( $content, $trans );
4443
-
4444
-			$trans   = array(
4445
-				'[' => '&#91;',
4446
-				']' => '&#93;',
4447
-				'<' => '&lt;',
4448
-				'>' => '&gt;',
4449
-				'"' => '&quot;',
4450
-				"'" => '&apos;',
4451
-			);
4452
-
4453
-			$content = strtr( $content, $trans );
4454
-
4455
-			return $content;
4456
-		}
4426
+         *@since 1.0.28
4427
+         *
4428
+         */
4429
+        public function encode_shortcodes( $content ) {
4430
+            // Avoids existing encoded tags.
4431
+            $trans   = array(
4432
+                '&#91;' => '&#091;',
4433
+                '&#93;' => '&#093;',
4434
+                '&amp;#91;' => '&#091;',
4435
+                '&amp;#93;' => '&#093;',
4436
+                '&lt;' => '&0lt;',
4437
+                '&gt;' => '&0gt;',
4438
+                '&amp;lt;' => '&0lt;',
4439
+                '&amp;gt;' => '&0gt;',
4440
+            );
4441
+
4442
+            $content = strtr( $content, $trans );
4443
+
4444
+            $trans   = array(
4445
+                '[' => '&#91;',
4446
+                ']' => '&#93;',
4447
+                '<' => '&lt;',
4448
+                '>' => '&gt;',
4449
+                '"' => '&quot;',
4450
+                "'" => '&apos;',
4451
+            );
4452
+
4453
+            $content = strtr( $content, $trans );
4454
+
4455
+            return $content;
4456
+        }
4457 4457
 
4458
-		/**
4459
-		 * Remove encoded shortcod tags.
4460
-		 *
4461
-		 * @param string $content Content to search for shortcode tags.
4462
-		 *
4458
+        /**
4459
+         * Remove encoded shortcod tags.
4460
+         *
4461
+         * @param string $content Content to search for shortcode tags.
4462
+         *
4463 4463
 *@return string Content with decoded shortcode tags.
4464
-		 *@since 1.0.28
4465
-		 *
4466
-		 */
4467
-		public function decode_shortcodes( $content ) {
4468
-			$trans   = array(
4469
-				'&#91;' => '[',
4470
-				'&#93;' => ']',
4471
-				'&amp;#91;' => '[',
4472
-				'&amp;#93;' => ']',
4473
-				'&lt;' => '<',
4474
-				'&gt;' => '>',
4475
-				'&amp;lt;' => '<',
4476
-				'&amp;gt;' => '>',
4477
-				'&quot;' => '"',
4478
-				'&apos;' => "'",
4479
-			);
4480
-
4481
-			$content = strtr( $content, $trans );
4482
-
4483
-			$trans   = array(
4484
-				'&#091;' => '&#91;',
4485
-				'&#093;' => '&#93;',
4486
-				'&amp;#091;' => '&#91;',
4487
-				'&amp;#093;' => '&#93;',
4488
-				'&0lt;' => '&lt;',
4489
-				'&0gt;' => '&gt;',
4490
-				'&amp;0lt;' => '&lt;',
4491
-				'&amp;0gt;' => '&gt;',
4492
-			);
4493
-
4494
-			$content = strtr( $content, $trans );
4495
-
4496
-			return $content;
4497
-		}
4498
-	}
4464
+         *@since 1.0.28
4465
+         *
4466
+         */
4467
+        public function decode_shortcodes( $content ) {
4468
+            $trans   = array(
4469
+                '&#91;' => '[',
4470
+                '&#93;' => ']',
4471
+                '&amp;#91;' => '[',
4472
+                '&amp;#93;' => ']',
4473
+                '&lt;' => '<',
4474
+                '&gt;' => '>',
4475
+                '&amp;lt;' => '<',
4476
+                '&amp;gt;' => '>',
4477
+                '&quot;' => '"',
4478
+                '&apos;' => "'",
4479
+            );
4480
+
4481
+            $content = strtr( $content, $trans );
4482
+
4483
+            $trans   = array(
4484
+                '&#091;' => '&#91;',
4485
+                '&#093;' => '&#93;',
4486
+                '&amp;#091;' => '&#91;',
4487
+                '&amp;#093;' => '&#93;',
4488
+                '&0lt;' => '&lt;',
4489
+                '&0gt;' => '&gt;',
4490
+                '&amp;0lt;' => '&lt;',
4491
+                '&amp;0gt;' => '&gt;',
4492
+            );
4493
+
4494
+            $content = strtr( $content, $trans );
4495
+
4496
+            return $content;
4497
+        }
4498
+    }
4499 4499
 }
Please login to merge, or discard this patch.
Spacing   +721 added lines, -721 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
6
+if (!class_exists('WP_Super_Duper')) {
7 7
 
8
-	define( 'SUPER_DUPER_VER', '1.1.10' );
8
+	define('SUPER_DUPER_VER', '1.1.10');
9 9
 
10 10
 	/**
11 11
 	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
@@ -38,40 +38,40 @@  discard block
 block discarded – undo
38 38
 		/**
39 39
 		 * Take the array options and use them to build.
40 40
 		 */
41
-		public function __construct( $options ) {
41
+		public function __construct($options) {
42 42
 			global $sd_widgets;
43 43
 
44
-			$sd_widgets[ $options['base_id'] ] = array(
44
+			$sd_widgets[$options['base_id']] = array(
45 45
 				'name'       => $options['name'],
46 46
 				'class_name' => $options['class_name'],
47 47
 				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48 48
 			);
49
-			$this->base_id                     = $options['base_id'];
49
+			$this->base_id = $options['base_id'];
50 50
 			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
51
+			$options       = apply_filters("wp_super_duper_options", $options);
52
+			$options       = apply_filters("wp_super_duper_options_{$this->base_id}", $options);
53
+			$options       = $this->add_name_from_key($options);
54 54
 			$this->options = $options;
55 55
 
56 56
 			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
57
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
58 58
 
59 59
             // nested blocks can't work as a widget
60
-            if(!empty($this->options['nested-block'])){
61
-                if(empty($this->options['output_types'])){
62
-                    $this->options['output_types'] = array('shortcode','block');
60
+            if (!empty($this->options['nested-block'])) {
61
+                if (empty($this->options['output_types'])) {
62
+                    $this->options['output_types'] = array('shortcode', 'block');
63 63
                 }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64 64
                     unset($this->options['output_types'][$key]);
65 65
                 }
66 66
             }
67 67
 
68 68
 			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
-                parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
69
+			if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) {
70
+                parent::__construct($options['base_id'], $options['name'], $options['widget_ops']);
71 71
 			}
72 72
 
73 73
 
74
-			if ( isset( $options['class_name'] ) ) {
74
+			if (isset($options['class_name'])) {
75 75
 				// register widget
76 76
 				$this->class_name = $options['class_name'];
77 77
 
@@ -80,60 +80,60 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
 				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
83
+				if (function_exists('fusion_builder_map')) {
84
+					add_action('init', array($this, 'register_fusion_element'));
85 85
 				}
86 86
 
87 87
 				// register block
88
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
89
-				    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
88
+				if (empty($this->options['output_types']) || in_array('block', $this->options['output_types'])) {
89
+				    add_action('admin_enqueue_scripts', array($this, 'register_block'));
90 90
                 }
91 91
 			}
92 92
 
93 93
 			// add the CSS and JS we need ONCE
94 94
 			global $sd_widget_scripts;
95 95
 
96
-			if ( ! $sd_widget_scripts ) {
97
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
98
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
99
-				wp_add_inline_style( 'widgets', $this->widget_css() );
96
+			if (!$sd_widget_scripts) {
97
+				wp_add_inline_script('admin-widgets', $this->widget_js());
98
+				wp_add_inline_script('customize-controls', $this->widget_js());
99
+				wp_add_inline_style('widgets', $this->widget_css());
100 100
 
101 101
 				// maybe add elementor editor styles
102
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
102
+				add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles'));
103 103
 
104 104
 				$sd_widget_scripts = true;
105 105
 
106 106
 				// add shortcode insert button once
107
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
107
+				add_action('media_buttons', array($this, 'shortcode_insert_button'));
108 108
 				// generatepress theme sections compatibility
109
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
110
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
109
+				if (function_exists('generate_sections_sections_metabox')) {
110
+					add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script'));
111 111
 				}
112 112
 				/* Load script on Divi theme builder page */
113
-				if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
113
+				if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) {
114 114
 					add_thickbox();
115
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
115
+					add_action('admin_footer', array($this, 'shortcode_insert_button_script'));
116 116
 				}
117 117
 
118
-				if ( $this->is_preview() ) {
119
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
118
+				if ($this->is_preview()) {
119
+					add_action('wp_footer', array($this, 'shortcode_insert_button_script'));
120 120
 					// this makes the insert button work for elementor
121
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
121
+					add_action('elementor/editor/after_enqueue_scripts', array(
122 122
 						$this,
123 123
 						'shortcode_insert_button_script'
124
-					) ); // for elementor
124
+					)); // for elementor
125 125
 				}
126 126
 				// this makes the insert button work for cornerstone
127
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
127
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder'));
128 128
 
129
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
130
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
129
+				add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings'));
130
+				add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker'));
131 131
 
132 132
 				// add generator text to admin head
133
-				add_action( 'admin_head', array( $this, 'generator' ) );
133
+				add_action('admin_head', array($this, 'generator'));
134 134
 			}
135 135
 
136
-			do_action( 'wp_super_duper_widget_init', $options, $this );
136
+			do_action('wp_super_duper_widget_init', $options, $this);
137 137
 		}
138 138
 
139 139
         /**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
          * @return void
142 142
          */
143 143
 		public function _register() {
144
-            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
144
+            if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) {
145 145
                 parent::_register();
146 146
 			}
147 147
 		}
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		 * Add our widget CSS to elementor editor.
151 151
 		 */
152 152
 		public function elementor_editor_styles() {
153
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
153
+			wp_add_inline_style('elementor-editor', $this->widget_css(false));
154 154
 		}
155 155
 
156 156
 		public function register_fusion_element() {
157 157
 
158 158
 			$options = $this->options;
159 159
 
160
-			if ( $this->base_id ) {
160
+			if ($this->base_id) {
161 161
 
162 162
 				$params = $this->get_fusion_params();
163 163
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 					'allow_generator' => true,
169 169
 				);
170 170
 
171
-				if ( ! empty( $params ) ) {
171
+				if (!empty($params)) {
172 172
 					$args['params'] = $params;
173 173
 				}
174 174
 
175
-				fusion_builder_map( $args );
175
+				fusion_builder_map($args);
176 176
 			}
177 177
 
178 178
 		}
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 			$params    = array();
182 182
 			$arguments = $this->get_arguments();
183 183
 
184
-			if ( ! empty( $arguments ) ) {
185
-				foreach ( $arguments as $key => $val ) {
184
+			if (!empty($arguments)) {
185
+				foreach ($arguments as $key => $val) {
186 186
 					$param = array();
187 187
 					// type
188 188
 					$param['type'] = str_replace(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 						$val['type'] );
205 205
 
206 206
 					// multiselect
207
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
207
+					if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) {
208 208
 						$param['type']     = 'multiple_select';
209 209
 						$param['multiple'] = true;
210 210
 					}
@@ -213,29 +213,29 @@  discard block
 block discarded – undo
213 213
 					$param['heading'] = $val['title'];
214 214
 
215 215
 					// description
216
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
216
+					$param['description'] = isset($val['desc']) ? $val['desc'] : '';
217 217
 
218 218
 					// param_name
219 219
 					$param['param_name'] = $key;
220 220
 
221 221
 					// Default
222
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
222
+					$param['default'] = isset($val['default']) ? $val['default'] : '';
223 223
 
224 224
 					// Group
225
-					if ( isset( $val['group'] ) ) {
225
+					if (isset($val['group'])) {
226 226
 						$param['group'] = $val['group'];
227 227
 					}
228 228
 
229 229
 					// value
230
-					if ( $val['type'] == 'checkbox' ) {
231
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
232
-							unset( $param['default'] );
230
+					if ($val['type'] == 'checkbox') {
231
+						if (isset($val['default']) && $val['default'] == '0') {
232
+							unset($param['default']);
233 233
 						}
234
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
235
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
236
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
234
+						$param['value'] = array('' => __("No"), '1' => __("Yes"));
235
+					} elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') {
236
+						$param['value'] = isset($val['options']) ? $val['options'] : array();
237 237
 					} else {
238
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
238
+						$param['value'] = isset($val['default']) ? $val['default'] : '';
239 239
 					}
240 240
 
241 241
 					// setup the param
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
253 253
 		 */
254 254
 		public static function maybe_cornerstone_builder() {
255
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
255
+			if (did_action('cornerstone_before_boot_app')) {
256 256
 				self::shortcode_insert_button_script();
257 257
 			}
258 258
 		}
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		 *
265 265
 		 * @return string
266 266
 		 */
267
-		public static function get_picker( $editor_id = '' ) {
267
+		public static function get_picker($editor_id = '') {
268 268
 
269 269
 			ob_start();
270
-			if ( isset( $_POST['editor_id'] ) ) {
271
-				$editor_id = esc_attr( $_POST['editor_id'] );
272
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
270
+			if (isset($_POST['editor_id'])) {
271
+				$editor_id = esc_attr($_POST['editor_id']);
272
+			} elseif (isset($_REQUEST['et_fb'])) {
273 273
 				$editor_id = 'main_content_content_vb_tiny_mce';
274 274
 			}
275 275
 
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 
281 281
 			<div class="sd-shortcode-left-wrap">
282 282
 				<?php
283
-				ksort( $sd_widgets );
283
+				ksort($sd_widgets);
284 284
 				//				print_r($sd_widgets);exit;
285
-				if ( ! empty( $sd_widgets ) ) {
285
+				if (!empty($sd_widgets)) {
286 286
 					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
287
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
288
-					foreach ( $sd_widgets as $shortcode => $class ) {
289
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
290
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
287
+					echo "<option>" . __('Select shortcode') . "</option>";
288
+					foreach ($sd_widgets as $shortcode => $class) {
289
+						if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; }
290
+						echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
291 291
 					}
292 292
 					echo "</select>";
293 293
 
@@ -300,37 +300,37 @@  discard block
 block discarded – undo
300 300
 			<div class="sd-shortcode-right-wrap">
301 301
 				<textarea id='sd-shortcode-output' disabled></textarea>
302 302
 				<div id='sd-shortcode-output-actions'>
303
-					<?php if ( $editor_id != '' ) { ?>
303
+					<?php if ($editor_id != '') { ?>
304 304
 						<button class="button sd-insert-shortcode-button"
305
-						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
305
+						        onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) {
306 306
 							        echo "'" . $editor_id . "'";
307
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
307
+						        } ?>)"><?php _e('Insert shortcode'); ?></button>
308 308
 					<?php } ?>
309 309
 					<button class="button"
310
-					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
310
+					        onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button>
311 311
 				</div>
312 312
 			</div>
313 313
 			<?php
314 314
 
315 315
 			$html = ob_get_clean();
316 316
 
317
-			if ( wp_doing_ajax() ) {
317
+			if (wp_doing_ajax()) {
318 318
 				echo $html;
319 319
 				$should_die = true;
320 320
 
321 321
 				// some builder get the editor via ajax so we should not die on those occasions
322 322
 				$dont_die = array(
323
-					'parent_tag',// WP Bakery
323
+					'parent_tag', // WP Bakery
324 324
 					'avia_request' // enfold
325 325
 				);
326 326
 
327
-				foreach ( $dont_die as $request ) {
328
-					if ( isset( $_REQUEST[ $request ] ) ) {
327
+				foreach ($dont_die as $request) {
328
+					if (isset($_REQUEST[$request])) {
329 329
 						$should_die = false;
330 330
 					}
331 331
 				}
332 332
 
333
-				if ( $should_die ) {
333
+				if ($should_die) {
334 334
 					wp_die();
335 335
 				}
336 336
 
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 		public static function get_widget_settings() {
358 358
 			global $sd_widgets;
359 359
 
360
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
361
-			if ( ! $shortcode ) {
360
+			$shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : '';
361
+			if (!$shortcode) {
362 362
 				wp_die();
363 363
 			}
364
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
365
-			if ( ! $widget_args ) {
364
+			$widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : '';
365
+			if (!$widget_args) {
366 366
 				wp_die();
367 367
 			}
368
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
-			if ( ! $class_name ) {
368
+			$class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
+			if (!$class_name) {
370 370
 				wp_die();
371 371
 			}
372 372
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 			$widget = new $class_name;
375 375
 
376 376
 			ob_start();
377
-			$widget->form( array() );
377
+			$widget->form(array());
378 378
 			$form = ob_get_clean();
379 379
 			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
380 380
 			echo "<style>" . $widget->widget_css() . "</style>";
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
 		 *@since 1.0.0
394 394
 		 *
395 395
 		 */
396
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
396
+		public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
397 397
 			global $sd_widgets, $shortcode_insert_button_once;
398
-			if ( $shortcode_insert_button_once ) {
398
+			if ($shortcode_insert_button_once) {
399 399
 				return;
400 400
 			}
401 401
 			add_thickbox();
@@ -405,21 +405,21 @@  discard block
 block discarded – undo
405 405
 			 * Cornerstone makes us play dirty tricks :/
406 406
 			 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
407 407
 			 */
408
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
408
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
409 409
 				echo '<span id="insert-media-button">';
410 410
 			}
411 411
 
412
-			echo self::shortcode_button( 'this', 'true' );
412
+			echo self::shortcode_button('this', 'true');
413 413
 
414 414
 			// see opening note
415
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
415
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
416 416
 				echo '</span>'; // end #insert-media-button
417 417
 			}
418 418
 
419 419
 			// Add separate script for generatepress theme sections
420
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
420
+			if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) {
421 421
 			} else {
422
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
422
+				self::shortcode_insert_button_script($editor_id, $insert_shortcode_function);
423 423
 			}
424 424
 
425 425
 			$shortcode_insert_button_once = true;
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 		 *
434 434
 		 * @return mixed
435 435
 		 */
436
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
436
+		public static function shortcode_button($id = '', $search_for_id = '') {
437 437
 			ob_start();
438 438
 			?>
439 439
 			<span class="sd-lable-shortcode-inserter">
440 440
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
441
-				if ( $search_for_id ) {
441
+				if ($search_for_id) {
442 442
 					echo "," . $search_for_id;
443 443
 				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
444 444
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			$html = ob_get_clean();
455 455
 
456 456
 			// remove line breaks so we can use it in js
457
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
457
+			return preg_replace("/\r|\n/", "", trim($html));
458 458
 		}
459 459
 
460 460
 		/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 						jQuery($this).data('sd-widget-enabled', true);
513 513
 					}
514 514
 
515
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
515
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
516 516
 					var form = jQuery($this).parents('' + $selector + '');
517 517
 
518 518
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -547,10 +547,10 @@  discard block
 block discarded – undo
547 547
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
548 548
 			 */
549 549
 
550
-			return str_replace( array(
550
+			return str_replace(array(
551 551
 				'<script>',
552 552
 				'</script>'
553
-			), '', $output );
553
+			), '', $output);
554 554
 		}
555 555
 
556 556
 		/**
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		 *@since 1.0.6
563 563
 		 *
564 564
 		 */
565
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
565
+		public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') {
566 566
 			?>
567 567
 			<style>
568 568
 				.sd-shortcode-left-wrap {
@@ -681,25 +681,25 @@  discard block
 block discarded – undo
681 681
 					width: 100%;
682 682
 				}
683 683
 
684
-				<?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?>
684
+				<?php if (function_exists('generate_sections_sections_metabox')) { ?>
685 685
 				.generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter {
686 686
 					display: inline;
687 687
 				}
688 688
 				<?php } ?>
689
-				<?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?>
689
+				<?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?>
690 690
 				body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999}
691 691
 				<?php } ?>
692 692
 			</style>
693 693
 			<?php
694
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
694
+			if (class_exists('SiteOrigin_Panels')) {
695 695
 				echo "<script>" . self::siteorigin_js() . "</script>";
696 696
 			}
697 697
 			?>
698 698
 			<script>
699 699
 				<?php
700
-				if(! empty( $insert_shortcode_function )){
700
+				if (!empty($insert_shortcode_function)) {
701 701
 					echo $insert_shortcode_function;
702
-				}else{
702
+				} else {
703 703
 
704 704
 				/**
705 705
 				 * Function for super duper insert shortcode.
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 					if ($shortcode) {
713 713
 						if (!$editor_id) {
714 714
 							<?php
715
-							if ( isset( $_REQUEST['et_fb'] ) ) {
715
+							if (isset($_REQUEST['et_fb'])) {
716 716
 								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
717
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
717
+							} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') {
718 718
 								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
719 719
 							} else {
720 720
 								echo '$editor_id = "#wp-content-editor-container textarea";';
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
 							'shortcode': $short_code,
800 800
 							'attributes': 123,
801 801
 							'post_id': 321,
802
-							'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
802
+							'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
803 803
 						};
804 804
 
805 805
 						if (typeof ajaxurl === 'undefined') {
806
-							var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>";
806
+							var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
807 807
 						}
808 808
 
809 809
 						jQuery.post(ajaxurl, data, function (response) {
@@ -1012,11 +1012,11 @@  discard block
 block discarded – undo
1012 1012
 					var data = {
1013 1013
 						'action': 'super_duper_get_picker',
1014 1014
 						'editor_id': $id,
1015
-						'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>'
1015
+						'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>'
1016 1016
 					};
1017 1017
 
1018 1018
 					if (!ajaxurl) {
1019
-						var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
1019
+						var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
1020 1020
 					}
1021 1021
 
1022 1022
 					jQuery.post(ajaxurl, data, function (response) {
@@ -1038,9 +1038,9 @@  discard block
 block discarded – undo
1038 1038
 				 */
1039 1039
 				function sd_shortcode_button($id) {
1040 1040
 					if ($id) {
1041
-						return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>';
1041
+						return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>';
1042 1042
 					} else {
1043
-						return '<?php echo self::shortcode_button();?>';
1043
+						return '<?php echo self::shortcode_button(); ?>';
1044 1044
 					}
1045 1045
 				}
1046 1046
 
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
 		 *
1056 1056
 		 * @return mixed
1057 1057
 		 */
1058
-		public function widget_css( $advanced = true ) {
1058
+		public function widget_css($advanced = true) {
1059 1059
 			ob_start();
1060 1060
 			?>
1061 1061
 			<style>
1062
-				<?php if( $advanced ){ ?>
1062
+				<?php if ($advanced) { ?>
1063 1063
 				.sd-advanced-setting {
1064 1064
 					display: none;
1065 1065
 				}
@@ -1101,10 +1101,10 @@  discard block
 block discarded – undo
1101 1101
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1102 1102
 			 */
1103 1103
 
1104
-			return str_replace( array(
1104
+			return str_replace(array(
1105 1105
 				'<style>',
1106 1106
 				'</style>'
1107
-			), '', $output );
1107
+			), '', $output);
1108 1108
 		}
1109 1109
 
1110 1110
 		/**
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 						jQuery($this).data('sd-widget-enabled', true);
1172 1172
 					}
1173 1173
 
1174
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
1174
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
1175 1175
 					var form = $form ? $form : jQuery($this).parents('' + $selector + '');
1176 1176
 
1177 1177
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 					});
1263 1263
 
1264 1264
 				}
1265
-				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1265
+				<?php do_action('wp_super_duper_widget_js', $this); ?>
1266 1266
 			</script>
1267 1267
 			<?php
1268 1268
 			$output = ob_get_clean();
@@ -1271,10 +1271,10 @@  discard block
 block discarded – undo
1271 1271
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1272 1272
 			 */
1273 1273
 
1274
-			return str_replace( array(
1274
+			return str_replace(array(
1275 1275
 				'<script>',
1276 1276
 				'</script>'
1277
-			), '', $output );
1277
+			), '', $output);
1278 1278
 		}
1279 1279
 
1280 1280
 
@@ -1285,14 +1285,14 @@  discard block
 block discarded – undo
1285 1285
 		 *
1286 1286
 		 * @return mixed
1287 1287
 		 */
1288
-		private function add_name_from_key( $options, $arguments = false ) {
1289
-			if ( ! empty( $options['arguments'] ) ) {
1290
-				foreach ( $options['arguments'] as $key => $val ) {
1291
-					$options['arguments'][ $key ]['name'] = $key;
1288
+		private function add_name_from_key($options, $arguments = false) {
1289
+			if (!empty($options['arguments'])) {
1290
+				foreach ($options['arguments'] as $key => $val) {
1291
+					$options['arguments'][$key]['name'] = $key;
1292 1292
 				}
1293
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1294
-				foreach ( $options as $key => $val ) {
1295
-					$options[ $key ]['name'] = $key;
1293
+			} elseif ($arguments && is_array($options) && !empty($options)) {
1294
+				foreach ($options as $key => $val) {
1295
+					$options[$key]['name'] = $key;
1296 1296
 				}
1297 1297
 			}
1298 1298
 
@@ -1305,8 +1305,8 @@  discard block
 block discarded – undo
1305 1305
 		 * @since 1.0.0
1306 1306
 		 */
1307 1307
 		public function register_shortcode() {
1308
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1309
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1308
+			add_shortcode($this->base_id, array($this, 'shortcode_output'));
1309
+			add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode'));
1310 1310
 		}
1311 1311
 
1312 1312
 		/**
@@ -1315,50 +1315,50 @@  discard block
 block discarded – undo
1315 1315
 		 * @since 1.0.0
1316 1316
 		 */
1317 1317
 		public function render_shortcode() {
1318
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1319
-			if ( ! current_user_can( 'manage_options' ) ) {
1318
+			check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
1319
+			if (!current_user_can('manage_options')) {
1320 1320
 				wp_die();
1321 1321
 			}
1322 1322
 
1323 1323
 			// we might need the $post value here so lets set it.
1324
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1325
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1326
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1324
+			if (isset($_POST['post_id']) && $_POST['post_id']) {
1325
+				$post_obj = get_post(absint($_POST['post_id']));
1326
+				if (!empty($post_obj) && empty($post)) {
1327 1327
 					global $post;
1328 1328
 					$post = $post_obj;
1329 1329
 				}
1330 1330
 			}
1331 1331
 
1332
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1332
+			if (isset($_POST['shortcode']) && $_POST['shortcode']) {
1333 1333
 				$is_preview = $this->is_preview();
1334
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1335
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1334
+				$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
1335
+				$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
1336 1336
 				$attributes       = '';
1337
-				if ( ! empty( $attributes_array ) ) {
1338
-					foreach ( $attributes_array as $key => $value ) {
1339
-						if ( is_array( $value ) ) {
1340
-							$value = implode( ",", $value );
1337
+				if (!empty($attributes_array)) {
1338
+					foreach ($attributes_array as $key => $value) {
1339
+						if (is_array($value)) {
1340
+							$value = implode(",", $value);
1341 1341
 						}
1342 1342
 
1343
-						if ( ! empty( $value ) ) {
1344
-							$value = wp_unslash( $value );
1343
+						if (!empty($value)) {
1344
+							$value = wp_unslash($value);
1345 1345
 
1346 1346
 							// Encode [ and ].
1347
-							if ( $is_preview ) {
1348
-								$value = $this->encode_shortcodes( $value );
1347
+							if ($is_preview) {
1348
+								$value = $this->encode_shortcodes($value);
1349 1349
 							}
1350 1350
 						}
1351
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1351
+						$attributes .= " " . sanitize_title_with_dashes($key) . "='" . esc_attr($value) . "' ";
1352 1352
 					}
1353 1353
 				}
1354 1354
 
1355 1355
 				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1356 1356
 
1357
-				$content = do_shortcode( $shortcode );
1357
+				$content = do_shortcode($shortcode);
1358 1358
 
1359 1359
 				// Decode [ and ].
1360
-				if ( ! empty( $content ) && $is_preview ) {
1361
-					$content = $this->decode_shortcodes( $content );
1360
+				if (!empty($content) && $is_preview) {
1361
+					$content = $this->decode_shortcodes($content);
1362 1362
 				}
1363 1363
 
1364 1364
 				echo $content;
@@ -1374,21 +1374,21 @@  discard block
 block discarded – undo
1374 1374
 		 *
1375 1375
 		 * @return string
1376 1376
 		 */
1377
-		public function shortcode_output( $args = array(), $content = '' ) {
1377
+		public function shortcode_output($args = array(), $content = '') {
1378 1378
 			$_instance = $args;
1379 1379
 
1380
-			$args = $this->argument_values( $args );
1380
+			$args = $this->argument_values($args);
1381 1381
 
1382 1382
 			// add extra argument so we know its a output to gutenberg
1383 1383
 			//$args
1384
-			$args = $this->string_to_bool( $args );
1384
+			$args = $this->string_to_bool($args);
1385 1385
 
1386 1386
 			// if we have a enclosed shortcode we add it to the special `html` argument
1387
-			if ( ! empty( $content ) ) {
1387
+			if (!empty($content)) {
1388 1388
 				$args['html'] = $content;
1389 1389
 			}
1390 1390
 
1391
-			if ( ! $this->is_preview() ) {
1391
+			if (!$this->is_preview()) {
1392 1392
 				/**
1393 1393
 				 * Filters the settings for a particular widget args.
1394 1394
 				 *
@@ -1399,40 +1399,40 @@  discard block
 block discarded – undo
1399 1399
 				 *@since 1.0.28
1400 1400
 				 *
1401 1401
 				 */
1402
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1402
+				$args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance);
1403 1403
 
1404
-				if ( ! is_array( $args ) ) {
1404
+				if (!is_array($args)) {
1405 1405
 					return $args;
1406 1406
 				}
1407 1407
 			}
1408 1408
 
1409
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1410
-			$class .= " sdel-".$this->get_instance_hash();
1409
+			$class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : '';
1410
+			$class .= " sdel-" . $this->get_instance_hash();
1411 1411
 
1412
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1413
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1412
+			$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
1413
+			$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
1414 1414
 
1415
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1416
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1415
+			$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
1416
+			$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
1417 1417
 
1418 1418
 			$shortcode_args = array();
1419 1419
 			$output         = '';
1420
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1421
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1420
+			$no_wrap        = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1421
+			if (isset($args['no_wrap']) && $args['no_wrap']) {
1422 1422
 				$no_wrap = true;
1423 1423
 			}
1424
-			$main_content = $this->output( $args, $shortcode_args, $content );
1425
-			if ( $main_content && ! $no_wrap ) {
1424
+			$main_content = $this->output($args, $shortcode_args, $content);
1425
+			if ($main_content && !$no_wrap) {
1426 1426
 				// wrap the shortcode in a div with the same class as the widget
1427 1427
 				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1428
-				if ( ! empty( $args['title'] ) ) {
1428
+				if (!empty($args['title'])) {
1429 1429
 					// if its a shortcode and there is a title try to grab the title wrappers
1430
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1431
-					if ( empty( $instance ) ) {
1430
+					$shortcode_args = array('before_title' => '', 'after_title' => '');
1431
+					if (empty($instance)) {
1432 1432
 						global $wp_registered_sidebars;
1433
-						if ( ! empty( $wp_registered_sidebars ) ) {
1434
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1435
-								if ( ! empty( $sidebar['before_title'] ) ) {
1433
+						if (!empty($wp_registered_sidebars)) {
1434
+							foreach ($wp_registered_sidebars as $sidebar) {
1435
+								if (!empty($sidebar['before_title'])) {
1436 1436
 									$shortcode_args['before_title'] = $sidebar['before_title'];
1437 1437
 									$shortcode_args['after_title']  = $sidebar['after_title'];
1438 1438
 									break;
@@ -1440,20 +1440,20 @@  discard block
 block discarded – undo
1440 1440
 							}
1441 1441
 						}
1442 1442
 					}
1443
-					$output .= $this->output_title( $shortcode_args, $args );
1443
+					$output .= $this->output_title($shortcode_args, $args);
1444 1444
 				}
1445 1445
 				$output .= $main_content;
1446 1446
 				$output .= '</div>';
1447
-			} elseif ( $main_content && $no_wrap ) {
1447
+			} elseif ($main_content && $no_wrap) {
1448 1448
 				$output .= $main_content;
1449 1449
 			}
1450 1450
 
1451 1451
 			// if preview show a placeholder if empty
1452
-			if ( $this->is_preview() && $output == '' ) {
1453
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1452
+			if ($this->is_preview() && $output == '') {
1453
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
1454 1454
 			}
1455 1455
 
1456
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1456
+			return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this);
1457 1457
 		}
1458 1458
 
1459 1459
 		/**
@@ -1463,8 +1463,8 @@  discard block
 block discarded – undo
1463 1463
 		 *
1464 1464
 		 * @return string
1465 1465
 		 */
1466
-		public function preview_placeholder_text( $name = '' ) {
1467
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1466
+		public function preview_placeholder_text($name = '') {
1467
+			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>";
1468 1468
 		}
1469 1469
 
1470 1470
 		/**
@@ -1474,13 +1474,13 @@  discard block
 block discarded – undo
1474 1474
 		 *
1475 1475
 		 * @return mixed
1476 1476
 		 */
1477
-		public function string_to_bool( $options ) {
1477
+		public function string_to_bool($options) {
1478 1478
 			// convert bool strings to booleans
1479
-			foreach ( $options as $key => $val ) {
1480
-				if ( $val == 'false' ) {
1481
-					$options[ $key ] = false;
1482
-				} elseif ( $val == 'true' ) {
1483
-					$options[ $key ] = true;
1479
+			foreach ($options as $key => $val) {
1480
+				if ($val == 'false') {
1481
+					$options[$key] = false;
1482
+				} elseif ($val == 'true') {
1483
+					$options[$key] = true;
1484 1484
 				}
1485 1485
 			}
1486 1486
 
@@ -1496,26 +1496,26 @@  discard block
 block discarded – undo
1496 1496
 		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1497 1497
 		 *
1498 1498
 		 */
1499
-		public function argument_values( $instance ) {
1499
+		public function argument_values($instance) {
1500 1500
 			$argument_values = array();
1501 1501
 
1502 1502
 			// set widget instance
1503 1503
 			$this->instance = $instance;
1504 1504
 
1505
-			if ( empty( $this->arguments ) ) {
1505
+			if (empty($this->arguments)) {
1506 1506
 				$this->arguments = $this->get_arguments();
1507 1507
 			}
1508 1508
 
1509
-			if ( ! empty( $this->arguments ) ) {
1510
-				foreach ( $this->arguments as $key => $args ) {
1509
+			if (!empty($this->arguments)) {
1510
+				foreach ($this->arguments as $key => $args) {
1511 1511
 					// set the input name from the key
1512 1512
 					$args['name'] = $key;
1513 1513
 					//
1514
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1515
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1514
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
1515
+					if ($args['type'] == 'checkbox' && $argument_values[$key] == '') {
1516 1516
 						// don't set default for an empty checkbox
1517
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1518
-						$argument_values[ $key ] = $args['default'];
1517
+					} elseif ($argument_values[$key] == '' && isset($args['default'])) {
1518
+						$argument_values[$key] = $args['default'];
1519 1519
 					}
1520 1520
 				}
1521 1521
 			}
@@ -1542,12 +1542,12 @@  discard block
 block discarded – undo
1542 1542
 		 *
1543 1543
 		 */
1544 1544
 		public function get_arguments() {
1545
-			if ( empty( $this->arguments ) ) {
1545
+			if (empty($this->arguments)) {
1546 1546
 				$this->arguments = $this->set_arguments();
1547 1547
 			}
1548 1548
 
1549
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1550
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1549
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
1550
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
1551 1551
 
1552 1552
 			return $this->arguments;
1553 1553
 		}
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 		 * @param array $widget_args
1560 1560
 		 * @param string $content
1561 1561
 		 */
1562
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1562
+		public function output($args = array(), $widget_args = array(), $content = '') {
1563 1563
 
1564 1564
 		}
1565 1565
 
@@ -1567,9 +1567,9 @@  discard block
 block discarded – undo
1567 1567
 		 * Add the dynamic block code inline when the wp-block in enqueued.
1568 1568
 		 */
1569 1569
 		public function register_block() {
1570
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1571
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1572
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1570
+			wp_add_inline_script('wp-blocks', $this->block());
1571
+			if (class_exists('SiteOrigin_Panels')) {
1572
+				wp_add_inline_script('wp-blocks', $this->siteorigin_js());
1573 1573
 			}
1574 1574
 		}
1575 1575
 
@@ -1583,9 +1583,9 @@  discard block
 block discarded – undo
1583 1583
 			$show      = false;
1584 1584
 			$arguments = $this->get_arguments();
1585 1585
 
1586
-			if ( ! empty( $arguments ) ) {
1587
-				foreach ( $arguments as $argument ) {
1588
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1586
+			if (!empty($arguments)) {
1587
+				foreach ($arguments as $argument) {
1588
+					if (isset($argument['advanced']) && $argument['advanced']) {
1589 1589
 						$show = true;
1590 1590
 						break; // no need to continue if we know we have it
1591 1591
 					}
@@ -1603,19 +1603,19 @@  discard block
 block discarded – undo
1603 1603
 		public function get_url() {
1604 1604
 			$url = $this->url;
1605 1605
 
1606
-			if ( ! $url ) {
1607
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1608
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1606
+			if (!$url) {
1607
+				$content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR));
1608
+				$content_url = untrailingslashit(WP_CONTENT_URL);
1609 1609
 
1610 1610
 				// Replace http:// to https://.
1611
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1612
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1611
+				if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) {
1612
+					$content_url = str_replace('http://', 'https://', $content_url);
1613 1613
 				}
1614 1614
 
1615 1615
 				// Check if we are inside a plugin
1616
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1617
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1618
-				$url = trailingslashit( $url );
1616
+				$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
1617
+				$url = str_replace($content_dir, $content_url, $file_dir);
1618
+				$url = trailingslashit($url);
1619 1619
 				$this->url = $url;
1620 1620
 			}
1621 1621
 
@@ -1631,15 +1631,15 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
 			$url = $this->url;
1633 1633
 
1634
-			if ( ! $url ) {
1634
+			if (!$url) {
1635 1635
 				// check if we are inside a plugin
1636
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1636
+				$file_dir = str_replace("/includes", "", dirname(__FILE__));
1637 1637
 
1638
-				$dir_parts = explode( "/wp-content/", $file_dir );
1639
-				$url_parts = explode( "/wp-content/", plugins_url() );
1638
+				$dir_parts = explode("/wp-content/", $file_dir);
1639
+				$url_parts = explode("/wp-content/", plugins_url());
1640 1640
 
1641
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1642
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1641
+				if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1642
+					$url       = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]);
1643 1643
 					$this->url = $url;
1644 1644
 				}
1645 1645
 			}
@@ -1660,46 +1660,46 @@  discard block
 block discarded – undo
1660 1660
 		 * @return string
1661 1661
 		 *@since 1.1.0
1662 1662
 		 */
1663
-		public function get_block_icon( $icon ) {
1663
+		public function get_block_icon($icon) {
1664 1664
 
1665 1665
 			// check if we have a Font Awesome icon
1666 1666
 			$fa_type = '';
1667
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1667
+			if (substr($icon, 0, 7) === "fas fa-") {
1668 1668
 				$fa_type = 'solid';
1669
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1669
+			} elseif (substr($icon, 0, 7) === "far fa-") {
1670 1670
 				$fa_type = 'regular';
1671
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1671
+			} elseif (substr($icon, 0, 7) === "fab fa-") {
1672 1672
 				$fa_type = 'brands';
1673 1673
 			} else {
1674 1674
 				$icon = "'" . $icon . "'";
1675 1675
 			}
1676 1676
 
1677 1677
 			// set the icon if we found one
1678
-			if ( $fa_type ) {
1679
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1678
+			if ($fa_type) {
1679
+				$fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon);
1680 1680
 				$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1681 1681
 			}
1682 1682
 
1683 1683
 			return $icon;
1684 1684
 		}
1685 1685
 
1686
-		public function group_arguments( $arguments ) {
1686
+		public function group_arguments($arguments) {
1687 1687
 //			echo '###';print_r($arguments);
1688
-			if ( ! empty( $arguments ) ) {
1688
+			if (!empty($arguments)) {
1689 1689
 				$temp_arguments = array();
1690
-				$general        = __( "General" );
1690
+				$general        = __("General");
1691 1691
 				$add_sections   = false;
1692
-				foreach ( $arguments as $key => $args ) {
1693
-					if ( isset( $args['group'] ) ) {
1694
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1692
+				foreach ($arguments as $key => $args) {
1693
+					if (isset($args['group'])) {
1694
+						$temp_arguments[$args['group']][$key] = $args;
1695 1695
 						$add_sections                             = true;
1696 1696
 					} else {
1697
-						$temp_arguments[ $general ][ $key ] = $args;
1697
+						$temp_arguments[$general][$key] = $args;
1698 1698
 					}
1699 1699
 				}
1700 1700
 
1701 1701
 				// only add sections if more than one
1702
-				if ( $add_sections ) {
1702
+				if ($add_sections) {
1703 1703
 					$arguments = $temp_arguments;
1704 1704
 				}
1705 1705
 			}
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
 			<script>
1730 1730
 
1731 1731
 			<?php
1732
-			if(!$sd_is_js_functions_loaded){
1732
+			if (!$sd_is_js_functions_loaded) {
1733 1733
                 $sd_is_js_functions_loaded = true;
1734 1734
             ?>
1735 1735
 
@@ -1909,7 +1909,7 @@  discard block
 block discarded – undo
1909 1909
 
1910 1910
 				// maybe use featured image.
1911 1911
 				if( $args['bg_image_use_featured'] !== undefined && $args['bg_image_use_featured'] ){
1912
-					$bg_image = '<?php echo $this->get_url();?>icons/placeholder.png';
1912
+					$bg_image = '<?php echo $this->get_url(); ?>icons/placeholder.png';
1913 1913
 				}
1914 1914
 
1915 1915
                 if( $bg_image !== undefined && $bg_image !== '' ){
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
             }
2096 2096
 
2097 2097
 			function sd_get_class_build_keys(){
2098
-				return <?php echo json_encode(sd_get_class_build_keys());?>;
2098
+				return <?php echo json_encode(sd_get_class_build_keys()); ?>;
2099 2099
 			}
2100 2100
 
2101 2101
             <?php
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
             }
2105 2105
 
2106
-			if(method_exists($this,'block_global_js')){
2106
+			if (method_exists($this, 'block_global_js')) {
2107 2107
 					echo $this->block_global_js();
2108 2108
 			}
2109 2109
 			?>
@@ -2132,9 +2132,9 @@  discard block
 block discarded – undo
2132 2132
                     var InnerBlocks = blockEditor.InnerBlocks;
2133 2133
 
2134 2134
 					var term_query_type = '';
2135
-					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>;
2136
-					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2137
-					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2135
+					var post_type_rest_slugs = <?php if (!empty($this->arguments) && isset($this->arguments['post_type']['onchange_rest']['values'])) {echo "[" . json_encode($this->arguments['post_type']['onchange_rest']['values']) . "]"; } else {echo "[]"; } ?>;
2136
+					const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
2137
+					const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
2138 2138
                     const MediaUpload = wp.blockEditor.MediaUpload;
2139 2139
 
2140 2140
 					/**
@@ -2149,20 +2149,20 @@  discard block
 block discarded – undo
2149 2149
 					 * @return {?WPBlock}          The block, if it has been successfully
2150 2150
 					 *                             registered; otherwise `undefined`.
2151 2151
 					 */
2152
-					registerBlockType('<?php echo str_replace( "_", "-", sanitize_title_with_dashes( $this->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->options['class_name'] ) );  ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
2153
-						apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>,
2154
-                        title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title.
2155
-						description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title.
2156
-						icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
2152
+					registerBlockType('<?php echo str_replace("_", "-", sanitize_title_with_dashes($this->options['textdomain']) . '/' . sanitize_title_with_dashes($this->options['class_name'])); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
2153
+						apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>,
2154
+                        title: '<?php echo addslashes($this->options['name']); ?>', // Block title.
2155
+						description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title.
2156
+						icon: <?php echo $this->get_block_icon($this->options['block-icon']); ?>,//'<?php echo isset($this->options['block-icon']) ? esc_attr($this->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
2157 2157
 						supports: {
2158 2158
 							<?php
2159
-							if ( isset( $this->options['block-supports'] ) ) {
2160
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2159
+							if (isset($this->options['block-supports'])) {
2160
+								echo $this->array_to_attributes($this->options['block-supports']);
2161 2161
 							}
2162 2162
 							?>
2163 2163
 						},
2164 2164
 						<?php
2165
-						if ( isset( $this->options['block-label'] ) ) {
2165
+						if (isset($this->options['block-label'])) {
2166 2166
 						?>
2167 2167
 						__experimentalLabel( attributes, { context } ) {
2168 2168
                             return <?php echo $this->options['block-label']; ?>;
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
                         <?php
2171 2171
                         }
2172 2172
                         ?>
2173
-						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
2174
-						<?php if ( isset( $this->options['block-keywords'] ) ) {
2173
+						category: '<?php echo isset($this->options['block-category']) ? esc_attr($this->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
2174
+						<?php if (isset($this->options['block-keywords'])) {
2175 2175
 						echo "keywords : " . $this->options['block-keywords'] . ",";
2176 2176
 
2177 2177
 //						// block hover preview.
@@ -2198,11 +2198,11 @@  discard block
 block discarded – undo
2198 2198
                         }
2199 2199
 
2200 2200
 						// maybe set no_wrap
2201
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2202
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2201
+						$no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
2202
+						if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) {
2203 2203
 							$no_wrap = true;
2204 2204
 						}
2205
-						if ( $no_wrap ) {
2205
+						if ($no_wrap) {
2206 2206
 							$this->options['block-wrap'] = '';
2207 2207
 						}
2208 2208
 
@@ -2216,10 +2216,10 @@  discard block
 block discarded – undo
2216 2216
 						echo "  html: false";
2217 2217
 						echo "},";*/
2218 2218
 
2219
-						if ( ! empty( $this->arguments ) ) {
2219
+						if (!empty($this->arguments)) {
2220 2220
 							echo "attributes : {";
2221 2221
 
2222
-							if ( $show_advanced ) {
2222
+							if ($show_advanced) {
2223 2223
 								echo "show_advanced: {";
2224 2224
 								echo "	type: 'boolean',";
2225 2225
 								echo "  default: false,";
@@ -2227,56 +2227,56 @@  discard block
 block discarded – undo
2227 2227
 							}
2228 2228
 
2229 2229
 							// block wrap element
2230
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2230
+							if (!empty($this->options['block-wrap'])) { //@todo we should validate this?
2231 2231
 								echo "block_wrap: {";
2232 2232
 								echo "	type: 'string',";
2233
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2233
+								echo "  default: '" . esc_attr($this->options['block-wrap']) . "',";
2234 2234
 								echo "},";
2235 2235
 							}
2236 2236
 
2237 2237
 
2238 2238
 
2239
-							foreach ( $this->arguments as $key => $args ) {
2239
+							foreach ($this->arguments as $key => $args) {
2240 2240
 
2241
-								if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2241
+								if ($args['type'] == 'image' || $args['type'] == 'images') {
2242 2242
 									$img_drag_drop = true;
2243 2243
 								}
2244 2244
 
2245 2245
 								// set if we should show alignment
2246
-								if ( $key == 'alignment' ) {
2246
+								if ($key == 'alignment') {
2247 2247
 									$show_alignment = true;
2248 2248
 								}
2249 2249
 
2250 2250
 								$extra = '';
2251 2251
 
2252
-								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2252
+								if ($args['type'] == 'notice' || $args['type'] == 'tab') {
2253 2253
 									continue;
2254 2254
 								}
2255
-								elseif ( $args['type'] == 'checkbox' ) {
2255
+								elseif ($args['type'] == 'checkbox') {
2256 2256
 									$type    = 'boolean';
2257
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258
-								} elseif ( $args['type'] == 'number' ) {
2257
+									$default = isset($args['default']) && $args['default'] ? 'true' : 'false';
2258
+								} elseif ($args['type'] == 'number') {
2259 2259
 									$type    = 'number';
2260
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2261
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2260
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2261
+								} elseif ($args['type'] == 'select' && !empty($args['multiple'])) {
2262 2262
 									$type = 'array';
2263
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2264
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2263
+									if (isset($args['default']) && is_array($args['default'])) {
2264
+										$default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]";
2265 2265
 									} else {
2266
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2266
+										$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2267 2267
 									}
2268
-								} elseif ( $args['type'] == 'tagselect' ) {
2268
+								} elseif ($args['type'] == 'tagselect') {
2269 2269
 									$type    = 'array';
2270
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2271
-								} elseif ( $args['type'] == 'multiselect' ) {
2270
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2271
+								} elseif ($args['type'] == 'multiselect') {
2272 2272
 									$type    = 'array';
2273
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2274
-								} elseif ( $args['type'] == 'image_xy' ) {
2273
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2274
+								} elseif ($args['type'] == 'image_xy') {
2275 2275
 									$type    = 'object';
2276
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2277
-								} elseif ( $args['type'] == 'image' ) {
2276
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2277
+								} elseif ($args['type'] == 'image') {
2278 2278
 									$type    = 'string';
2279
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2279
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2280 2280
 
2281 2281
                                     // add a field for ID
2282 2282
 //                                    echo $key . "_id : {";
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
 
2289 2289
 								} else {
2290 2290
 									$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2291
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2291
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
2292 2292
 
2293 2293
 								}
2294 2294
 								echo $key . " : {";
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 
2313 2313
 <?php
2314 2314
 // only include the drag/drop functions if required.
2315
-if( $img_drag_drop ){
2315
+if ($img_drag_drop) {
2316 2316
 
2317 2317
 ?>
2318 2318
 
@@ -2378,9 +2378,9 @@  discard block
 block discarded – undo
2378 2378
 							}
2379 2379
 
2380 2380
                             <?php
2381
-                            if(!empty($this->options['block-edit-raw'])) {
2381
+                            if (!empty($this->options['block-edit-raw'])) {
2382 2382
                                 echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2383
-                            }else{
2383
+                            } else {
2384 2384
                             ?>
2385 2385
 
2386 2386
 function hasSelectedInnerBlock(props) {
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
 							var $value = '';
2406 2406
 							<?php
2407 2407
 							// if we have a post_type and a category then link them
2408
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2408
+							if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) {
2409 2409
 							?>
2410 2410
 							if(typeof(prev_attributes[props.clientId]) != 'undefined' ){
2411 2411
 								$pt = props.attributes.post_type;
@@ -2421,13 +2421,13 @@  discard block
 block discarded – undo
2421 2421
 
2422 2422
 								// taxonomies
2423 2423
 								if( $value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run ){
2424
-									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];}else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
2425
-										while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
2426
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
2424
+									wp.apiFetch({path: "<?php if (isset($this->arguments['post_type']['onchange_rest']['path'])) {echo $this->arguments['post_type']['onchange_rest']['path']; } else {'/wp/v2/"+$value+"/categories/?per_page=100'; } ?>"}).then(terms => {
2425
+										while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2426
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2427 2427
 									}
2428
-									taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0});
2428
+									taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0});
2429 2429
 									jQuery.each( terms, function( key, val ) {
2430
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id});
2430
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id});
2431 2431
 									});
2432 2432
 
2433 2433
 									// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 									props.setAttributes({category: [0] });
2436 2436
 									props.setAttributes({category: $old_cat_value });
2437 2437
 
2438
-									return taxonomies_<?php echo str_replace("-","_", $this->id);?>;
2438
+									return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>;
2439 2439
 								});
2440 2440
 								}
2441 2441
 
@@ -2447,12 +2447,12 @@  discard block
 block discarded – undo
2447 2447
 									};
2448 2448
 									jQuery.post(ajaxurl, data, function(response) {
2449 2449
 										response = JSON.parse(response);
2450
-										while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) {
2451
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.pop();
2450
+										while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2451
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2452 2452
 										}
2453 2453
 
2454 2454
 										jQuery.each( response, function( key, val ) {
2455
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key});
2455
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key});
2456 2456
 										});
2457 2457
 
2458 2458
 										// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 										props.setAttributes({sort_by: [0] });
2461 2461
 										props.setAttributes({sort_by: $old_sort_by_value });
2462 2462
 
2463
-										return sort_by_<?php echo str_replace("-","_", $this->id);?>;
2463
+										return sort_by_<?php echo str_replace("-", "_", $this->id); ?>;
2464 2464
 									});
2465 2465
 
2466 2466
 								}
@@ -2468,9 +2468,9 @@  discard block
 block discarded – undo
2468 2468
 							<?php } ?>
2469 2469
 <?php
2470 2470
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2471
-if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2471
+if (!empty($current_screen->base) && $current_screen->base === 'widgets') {
2472 2472
 	echo 'const { deviceType } = "";';
2473
-}else{
2473
+} else {
2474 2474
 ?>
2475 2475
 /** Get device type const. */
2476 2476
 const { deviceType } = wp.data.useSelect != 'undefined' ?  wp.data.useSelect(select => {
@@ -2499,13 +2499,13 @@  discard block
 block discarded – undo
2499 2499
 
2500 2500
 									var data = {
2501 2501
 										'action': 'super_duper_output_shortcode',
2502
-										'shortcode': '<?php echo $this->options['base_id'];?>',
2502
+										'shortcode': '<?php echo $this->options['base_id']; ?>',
2503 2503
 										'attributes': props.attributes,
2504 2504
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2505
-										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2505
+										'post_id': <?php global $post; if (isset($post->ID)) {
2506 2506
 										echo $post->ID;
2507
-									}else{echo '0';}?>,
2508
-										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2507
+									} else {echo '0'; }?>,
2508
+										'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
2509 2509
 									};
2510 2510
 
2511 2511
 									jQuery.post(ajaxurl, data, function (response) {
@@ -2514,17 +2514,17 @@  discard block
 block discarded – undo
2514 2514
 
2515 2515
 										// if the content is empty then we place some placeholder text
2516 2516
 										if (env == '') {
2517
-											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>";
2517
+											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>";
2518 2518
 										}
2519 2519
 
2520 2520
                                          <?php
2521
-                                        if(!empty($this->options['nested-block'])){
2521
+                                        if (!empty($this->options['nested-block'])) {
2522 2522
                                             ?>
2523 2523
                                             // props.setAttributes({content: env});
2524 2524
 										is_fetching = false;
2525 2525
 										prev_attributes[props.clientId] = props.attributes;
2526 2526
                                              <?php
2527
-                                        }else{
2527
+                                        } else {
2528 2528
                                         ?>
2529 2529
                                        props.setAttributes({content: env});
2530 2530
 										is_fetching = false;
@@ -2549,8 +2549,8 @@  discard block
 block discarded – undo
2549 2549
 							}
2550 2550
 
2551 2551
                             <?php
2552
-                            if(!empty($this->options['block-edit-js'])) {
2553
-                                echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
2552
+                            if (!empty($this->options['block-edit-js'])) {
2553
+                                echo  $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues
2554 2554
                             }
2555 2555
 
2556 2556
 
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 
2564 2564
 								el(wp.blockEditor.BlockControls, {key: 'controls'},
2565 2565
 
2566
-									<?php if($show_alignment){?>
2566
+									<?php if ($show_alignment) {?>
2567 2567
 									el(
2568 2568
 										wp.blockEditor.AlignmentToolbar,
2569 2569
 										{
@@ -2581,9 +2581,9 @@  discard block
 block discarded – undo
2581 2581
 
2582 2582
 									<?php
2583 2583
 
2584
-									if(! empty( $this->arguments )){
2584
+									if (!empty($this->arguments)) {
2585 2585
 
2586
-									if ( $show_advanced ) {
2586
+									if ($show_advanced) {
2587 2587
 									?>
2588 2588
 									el('div', {
2589 2589
 											style: {'padding-left': '16px','padding-right': '16px'}
@@ -2608,46 +2608,46 @@  discard block
 block discarded – undo
2608 2608
 
2609 2609
 									//echo '####';
2610 2610
 
2611
-									$arguments = $this->group_arguments( $this->arguments );
2611
+									$arguments = $this->group_arguments($this->arguments);
2612 2612
 //print_r($arguments ); exit;
2613 2613
 									// Do we have sections?
2614 2614
 									$has_sections = $arguments == $this->arguments ? false : true;
2615 2615
 
2616 2616
 
2617
-									if($has_sections){
2617
+									if ($has_sections) {
2618 2618
 									$panel_count = 0;
2619 2619
 									$open_tab = '';
2620 2620
 
2621 2621
 									$open_tab_groups = array();
2622 2622
 									$used_tabs = array();
2623
-									foreach($arguments as $key => $args){
2623
+									foreach ($arguments as $key => $args) {
2624 2624
 
2625 2625
 										$close_tab = false;
2626 2626
 										$close_tabs = false;
2627 2627
 
2628
-										 if(!empty($this->options['block_group_tabs'])) {
2629
-											foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2630
-												if(in_array($key,$tab_args['groups'])){
2628
+										 if (!empty($this->options['block_group_tabs'])) {
2629
+											foreach ($this->options['block_group_tabs'] as $tab_name => $tab_args) {
2630
+												if (in_array($key, $tab_args['groups'])) {
2631 2631
 
2632 2632
 													$open_tab_groups[] = $key;
2633 2633
 
2634
-													if($open_tab != $tab_name){
2634
+													if ($open_tab != $tab_name) {
2635 2635
 														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2636 2636
 														$tab_args['tab']['open'] = true;
2637 2637
 
2638
-														$this->block_tab_start( '', $tab_args );
2638
+														$this->block_tab_start('', $tab_args);
2639 2639
 //														echo '###open'.$tab_name;print_r($tab_args);
2640 2640
 														$open_tab = $tab_name;
2641 2641
 														$used_tabs[] = $tab_name;
2642 2642
 													}
2643 2643
 
2644
-													if($open_tab_groups == $tab_args['groups']){
2644
+													if ($open_tab_groups == $tab_args['groups']) {
2645 2645
 														//$open_tab = '';
2646 2646
 														$close_tab = true;
2647 2647
 														$open_tab_groups = array();
2648 2648
 
2649 2649
 //													print_r(array_keys($this->options['block_group_tabs']));echo '####';print_r($used_tabs);
2650
-													if($used_tabs == array_keys($this->options['block_group_tabs'])){
2650
+													if ($used_tabs == array_keys($this->options['block_group_tabs'])) {
2651 2651
 //														echo '@@@';
2652 2652
 															$close_tabs = true;
2653 2653
 														}
@@ -2663,8 +2663,8 @@  discard block
 block discarded – undo
2663 2663
 
2664 2664
 										?>
2665 2665
 										el(wp.components.PanelBody, {
2666
-												title: '<?php esc_attr_e( $key ); ?>',
2667
-												initialOpen: <?php if ( $panel_count ) {
2666
+												title: '<?php esc_attr_e($key); ?>',
2667
+												initialOpen: <?php if ($panel_count) {
2668 2668
 												echo "false";
2669 2669
 											} else {
2670 2670
 												echo "true";
@@ -2674,21 +2674,21 @@  discard block
 block discarded – undo
2674 2674
 
2675 2675
 
2676 2676
 
2677
-											foreach ( $args as $k => $a ) {
2677
+											foreach ($args as $k => $a) {
2678 2678
 
2679
-												$this->block_tab_start( $k, $a );
2680
-												$this->block_row_start( $k, $a );
2681
-												$this->build_block_arguments( $k, $a );
2682
-												$this->block_row_end( $k, $a );
2683
-												$this->block_tab_end( $k, $a );
2679
+												$this->block_tab_start($k, $a);
2680
+												$this->block_row_start($k, $a);
2681
+												$this->build_block_arguments($k, $a);
2682
+												$this->block_row_end($k, $a);
2683
+												$this->block_tab_end($k, $a);
2684 2684
 											}
2685 2685
 											?>
2686 2686
 										),
2687 2687
 										<?php
2688
-										$panel_count ++;
2688
+										$panel_count++;
2689 2689
 
2690 2690
 
2691
-										if($close_tab || $close_tabs){
2691
+										if ($close_tab || $close_tabs) {
2692 2692
 											$tab_args = array(
2693 2693
 												'tab'	=> array(
2694 2694
 													'tabs_close' => $close_tabs,
@@ -2696,24 +2696,24 @@  discard block
 block discarded – undo
2696 2696
 												)
2697 2697
 
2698 2698
 											);
2699
-											$this->block_tab_end( '', $tab_args );
2699
+											$this->block_tab_end('', $tab_args);
2700 2700
 //											echo '###close'; print_r($tab_args);
2701 2701
 											$panel_count = 0;
2702 2702
 										}
2703 2703
 //
2704 2704
 
2705 2705
 									}
2706
-									}else {
2706
+									} else {
2707 2707
 									?>
2708 2708
 									el(wp.components.PanelBody, {
2709
-											title: '<?php esc_attr_e( "Settings" ); ?>',
2709
+											title: '<?php esc_attr_e("Settings"); ?>',
2710 2710
 											initialOpen: true
2711 2711
 										},
2712 2712
 										<?php
2713
-										foreach ( $this->arguments as $key => $args ) {
2714
-											$this->block_row_start( $key, $args );
2715
-											$this->build_block_arguments( $key, $args );
2716
-											$this->block_row_end( $key, $args );
2713
+										foreach ($this->arguments as $key => $args) {
2714
+											$this->block_row_start($key, $args);
2715
+											$this->build_block_arguments($key, $args);
2716
+											$this->block_row_end($key, $args);
2717 2717
 										}
2718 2718
 										?>
2719 2719
 									),
@@ -2727,11 +2727,11 @@  discard block
 block discarded – undo
2727 2727
 
2728 2728
 								<?php
2729 2729
 								// If the user sets block-output array then build it
2730
-								if ( ! empty( $this->options['block-output'] ) ) {
2731
-								$this->block_element( $this->options['block-output'] );
2732
-							}elseif(!empty($this->options['block-edit-return'])){
2730
+								if (!empty($this->options['block-output'])) {
2731
+								$this->block_element($this->options['block-output']);
2732
+							}elseif (!empty($this->options['block-edit-return'])) {
2733 2733
                                    echo $this->options['block-edit-return'];
2734
-							}else{
2734
+							} else {
2735 2735
 								// if no block-output is set then we try and get the shortcode html output via ajax.
2736 2736
 								?>
2737 2737
 								el('div', wp.blockEditor.useBlockProps({
@@ -2756,22 +2756,22 @@  discard block
 block discarded – undo
2756 2756
 							var align = '';
2757 2757
 
2758 2758
 							// build the shortcode.
2759
-							var content = "[<?php echo $this->options['base_id'];?>";
2759
+							var content = "[<?php echo $this->options['base_id']; ?>";
2760 2760
 							$html = '';
2761 2761
 							<?php
2762 2762
 
2763
-							if(! empty( $this->arguments )){
2763
+							if (!empty($this->arguments)) {
2764 2764
 
2765
-							foreach($this->arguments as $key => $args){
2765
+							foreach ($this->arguments as $key => $args) {
2766 2766
                                // if($args['type']=='tabs'){continue;}
2767 2767
 							?>
2768
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2769
-								if ('<?php echo esc_attr( $key );?>' == 'html') {
2770
-									$html = attr.<?php echo esc_attr( $key );?>;
2771
-								} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
2772
-									content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' ";
2768
+							if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
2769
+								if ('<?php echo esc_attr($key); ?>' == 'html') {
2770
+									$html = attr.<?php echo esc_attr($key); ?>;
2771
+								} else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') {
2772
+									content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' ";
2773 2773
 								} else {
2774
-									content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' ";
2774
+									content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' ";
2775 2775
 								}
2776 2776
 							}
2777 2777
 							<?php
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
                             ?>
2791 2791
 							// if has html element
2792 2792
 							if ($html) {
2793
-								content += $html + "[/<?php echo $this->options['base_id'];?>]";
2793
+								content += $html + "[/<?php echo $this->options['base_id']; ?>]";
2794 2794
 							}
2795 2795
 
2796 2796
 							// @todo should we add inline style here or just css classes?
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
 //                                <x?php
2821 2821
 //							}else
2822 2822
 
2823
-                            if(!empty($this->options['block-output'])){
2823
+                            if (!empty($this->options['block-output'])) {
2824 2824
 //                               echo "return";
2825 2825
 //                               $this->block_element( $this->options['block-output'], true );
2826 2826
 //                               echo ";";
@@ -2830,30 +2830,30 @@  discard block
 block discarded – undo
2830 2830
                                    '',
2831 2831
                                    {},
2832 2832
                                    el('', {dangerouslySetInnerHTML: {__html: content}}),
2833
-                                   <?php $this->block_element( $this->options['block-output'], true ); ?>
2834
-                                   el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2833
+                                   <?php $this->block_element($this->options['block-output'], true); ?>
2834
+                                   el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}})
2835 2835
                                );
2836 2836
                                 <?php
2837 2837
 
2838
-							}elseif(!empty($this->options['block-save-return'])){
2838
+							}elseif (!empty($this->options['block-save-return'])) {
2839 2839
                                    echo 'return ' . $this->options['block-save-return'];
2840
-							}elseif(!empty($this->options['nested-block'])){
2840
+							}elseif (!empty($this->options['nested-block'])) {
2841 2841
                                 ?>
2842 2842
                               return el(
2843 2843
                                    '',
2844 2844
                                    {},
2845 2845
                                    el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}),
2846 2846
                                    InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here
2847
-                                   el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2847
+                                   el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}})
2848 2848
                                );
2849 2849
                                 <?php
2850
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2851
-                                echo "return ". $this->options['block-edit-return'].";";
2852
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2850
+							}elseif (!empty($this->options['block-save-return'])) {
2851
+                                echo "return " . $this->options['block-edit-return'] . ";";
2852
+							}elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') {
2853 2853
 							?>
2854 2854
 							return content;
2855 2855
 							<?php
2856
-							}else{
2856
+							} else {
2857 2857
 							?>
2858 2858
 							var block_wrap = 'div';
2859 2859
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -2882,48 +2882,48 @@  discard block
 block discarded – undo
2882 2882
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2883 2883
 			 */
2884 2884
 
2885
-			return str_replace( array(
2885
+			return str_replace(array(
2886 2886
 				'<script>',
2887 2887
 				'</script>'
2888
-			), '', $output );
2888
+			), '', $output);
2889 2889
 		}
2890 2890
 
2891 2891
 
2892 2892
 
2893
-		public function block_row_start($key, $args){
2893
+		public function block_row_start($key, $args) {
2894 2894
 
2895 2895
 			// check for row
2896
-			if(!empty($args['row'])){
2896
+			if (!empty($args['row'])) {
2897 2897
 
2898
-				if(!empty($args['row']['open'])){
2898
+				if (!empty($args['row']['open'])) {
2899 2899
 
2900 2900
 				// element require
2901
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2902
-                $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
2903
-                $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
2901
+				$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
2902
+                $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : '';
2903
+                $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
2904 2904
                 $device_type_icon = '';
2905
-                if($device_type=='Desktop'){
2905
+                if ($device_type == 'Desktop') {
2906 2906
                     $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2907
-                }elseif($device_type=='Tablet'){
2907
+                }elseif ($device_type == 'Tablet') {
2908 2908
                     $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2909
-                }elseif($device_type=='Mobile'){
2909
+                }elseif ($device_type == 'Mobile') {
2910 2910
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
2911 2911
                 }
2912 2912
 				echo $element_require;
2913 2913
                 echo $device_type_require;
2914 2914
 
2915
-					if(false){?><script><?php }?>
2915
+					if (false) {?><script><?php }?>
2916 2916
 						el('div', {
2917 2917
 								className: 'bsui components-base-control',
2918 2918
 							},
2919
-							<?php if(!empty($args['row']['title'])){ ?>
2919
+							<?php if (!empty($args['row']['title'])) { ?>
2920 2920
 							el('label', {
2921 2921
 									className: 'components-base-control__label position-relative',
2922 2922
 									style: {width:"100%"}
2923 2923
 								},
2924
-								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}),
2925
-								<?php if($device_type_icon){ ?>
2926
-                                    deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
2924
+								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}),
2925
+								<?php if ($device_type_icon) { ?>
2926
+                                    deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
2927 2927
 								<?php
2928 2928
                                 }
2929 2929
                                 ?>
@@ -2931,17 +2931,17 @@  discard block
 block discarded – undo
2931 2931
 
2932 2932
 							),
2933 2933
 							<?php }?>
2934
-							<?php if(!empty($args['row']['desc'])){ ?>
2934
+							<?php if (!empty($args['row']['desc'])) { ?>
2935 2935
 							el('p', {
2936 2936
 									className: 'components-base-control__help mb-0',
2937 2937
 								},
2938
-								'<?php echo addslashes( $args['row']['desc'] ); ?>'
2938
+								'<?php echo addslashes($args['row']['desc']); ?>'
2939 2939
 							),
2940 2940
 							<?php }?>
2941 2941
 							el(
2942 2942
 								'div',
2943 2943
 								{
2944
-									className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>',
2944
+									className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>',
2945 2945
 								},
2946 2946
 								el(
2947 2947
 									'div',
@@ -2950,36 +2950,36 @@  discard block
 block discarded – undo
2950 2950
 									},
2951 2951
 
2952 2952
 					<?php
2953
-					if(false){?></script><?php }
2954
-				}elseif(!empty($args['row']['close'])){
2955
-					if(false){?><script><?php }?>
2953
+					if (false) {?></script><?php }
2954
+				}elseif (!empty($args['row']['close'])) {
2955
+					if (false) {?><script><?php }?>
2956 2956
 						el(
2957 2957
 							'div',
2958 2958
 							{
2959 2959
 								className: 'col pl-0',
2960 2960
 							},
2961 2961
 					<?php
2962
-					if(false){?></script><?php }
2963
-				}else{
2964
-					if(false){?><script><?php }?>
2962
+					if (false) {?></script><?php }
2963
+				} else {
2964
+					if (false) {?><script><?php }?>
2965 2965
 						el(
2966 2966
 							'div',
2967 2967
 							{
2968 2968
 								className: 'col pl-0 pr-2',
2969 2969
 							},
2970 2970
 					<?php
2971
-					if(false){?></script><?php }
2971
+					if (false) {?></script><?php }
2972 2972
 				}
2973 2973
 
2974 2974
 			}
2975 2975
 
2976 2976
 		}
2977 2977
 
2978
-		public function block_row_end($key, $args){
2978
+		public function block_row_end($key, $args) {
2979 2979
 
2980
-			if(!empty($args['row'])){
2980
+			if (!empty($args['row'])) {
2981 2981
 				// maybe close
2982
-				if(!empty($args['row']['close'])){
2982
+				if (!empty($args['row']['close'])) {
2983 2983
 					echo "))";
2984 2984
 				}
2985 2985
 
@@ -2987,14 +2987,14 @@  discard block
 block discarded – undo
2987 2987
 			}
2988 2988
 		}
2989 2989
 
2990
-		public function block_tab_start($key, $args){
2990
+		public function block_tab_start($key, $args) {
2991 2991
 
2992 2992
 			// check for row
2993
-			if(!empty($args['tab'])){
2993
+			if (!empty($args['tab'])) {
2994 2994
 
2995
-				if(!empty($args['tab']['tabs_open'])){
2995
+				if (!empty($args['tab']['tabs_open'])) {
2996 2996
 
2997
-					if(false){?><script><?php }?>
2997
+					if (false) {?><script><?php }?>
2998 2998
 
2999 2999
 el('div',{className: 'bsui'},
3000 3000
 
@@ -3003,41 +3003,41 @@  discard block
 block discarded – undo
3003 3003
 									{
3004 3004
                                         activeClass: 'is-active',
3005 3005
                                         className: 'btn-groupx',
3006
-                                        initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3006
+                                        initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>',
3007 3007
 										tabs: [
3008 3008
 
3009 3009
 					<?php
3010
-					if(false){?></script><?php }
3010
+					if (false) {?></script><?php }
3011 3011
 				}
3012 3012
 
3013
-				if(!empty($args['tab']['open'])){
3013
+				if (!empty($args['tab']['open'])) {
3014 3014
 
3015
-					if(false){?><script><?php }?>
3015
+					if (false) {?><script><?php }?>
3016 3016
 							{
3017
-												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3018
-												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
3019
-												className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>',
3020
-												content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', {
3017
+												name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>',
3018
+												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}),
3019
+												className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>',
3020
+												content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', {
3021 3021
 									className: 'components-base-control__help mb-0',
3022
-									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3022
+									dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'}
3023 3023
 								}),<?php }
3024
-					if(false){?></script><?php }
3024
+					if (false) {?></script><?php }
3025 3025
 				}
3026 3026
 
3027 3027
 			}
3028 3028
 
3029 3029
 		}
3030 3030
 
3031
-		public function block_tab_end($key, $args){
3031
+		public function block_tab_end($key, $args) {
3032 3032
 
3033
-			if(!empty($args['tab'])){
3033
+			if (!empty($args['tab'])) {
3034 3034
 				// maybe close
3035
-				if(!empty($args['tab']['close'])){
3035
+				if (!empty($args['tab']['close'])) {
3036 3036
 					echo ")}, /* tab close */";
3037 3037
 				}
3038 3038
 
3039
-				if(!empty($args['tab']['tabs_close'])){
3040
-					if(false){?><script><?php }?>
3039
+				if (!empty($args['tab']['tabs_close'])) {
3040
+					if (false) {?><script><?php }?>
3041 3041
 							],
3042 3042
 									},
3043 3043
 									( tab ) => {
@@ -3046,42 +3046,42 @@  discard block
 block discarded – undo
3046 3046
 
3047 3047
 								}
3048 3048
 								)), /* tabs close */
3049
-					<?php if(false){ ?></script><?php }
3049
+					<?php if (false) { ?></script><?php }
3050 3050
 				}
3051 3051
 			}
3052 3052
 		}
3053 3053
 
3054
-		public function build_block_arguments( $key, $args ) {
3055
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3054
+		public function build_block_arguments($key, $args) {
3055
+			$custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : '';
3056 3056
 			$options           = '';
3057 3057
 			$extra             = '';
3058 3058
 			$require           = '';
3059
-            $inside_elements   = '';
3059
+            $inside_elements = '';
3060 3060
 			$after_elements	   = '';
3061 3061
 
3062 3062
 			// `content` is a protected and special argument
3063
-			if ( $key == 'content' ) {
3063
+			if ($key == 'content') {
3064 3064
 				return;
3065 3065
 			}
3066 3066
 
3067
-            $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3068
-            $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3067
+            $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : '';
3068
+            $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3069 3069
             $device_type_icon = '';
3070
-            if($device_type=='Desktop'){
3070
+            if ($device_type == 'Desktop') {
3071 3071
                 $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3072
-            }elseif($device_type=='Tablet'){
3072
+            }elseif ($device_type == 'Tablet') {
3073 3073
                 $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3074
-            }elseif($device_type=='Mobile'){
3074
+            }elseif ($device_type == 'Mobile') {
3075 3075
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3076 3076
             }
3077 3077
 
3078 3078
 			// icon
3079 3079
 			$icon = '';
3080
-			if( !empty( $args['icon'] ) ){
3080
+			if (!empty($args['icon'])) {
3081 3081
 				$icon .= "el('div', {";
3082
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3082
+									$icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},";
3083 3083
 									$icon .= "className: 'text-center',";
3084
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3084
+									$icon .= "title: '" . addslashes($args['title']) . "',";
3085 3085
 								$icon .= "}),";
3086 3086
 
3087 3087
 				// blank title as its added to the icon.
@@ -3089,28 +3089,28 @@  discard block
 block discarded – undo
3089 3089
 			}
3090 3090
 
3091 3091
 			// require advanced
3092
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3092
+			$require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : "";
3093 3093
 
3094 3094
 			// element require
3095
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3095
+			$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
3096 3096
 
3097 3097
 
3098 3098
 			$onchange  = "props.setAttributes({ $key: $key } )";
3099
-			$onchangecomplete  = "";
3099
+			$onchangecomplete = "";
3100 3100
 			$value     = "props.attributes.$key";
3101
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3102
-			if ( in_array( $args['type'], $text_type ) ) {
3101
+			$text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range');
3102
+			if (in_array($args['type'], $text_type)) {
3103 3103
 				$type = 'TextControl';
3104 3104
 				// Save numbers as numbers and not strings
3105
-				if ( $args['type'] == 'number' ) {
3105
+				if ($args['type'] == 'number') {
3106 3106
 					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107 3107
 				}
3108
-			}else if ( $args['type'] == 'styleid' ) {
3108
+			} else if ($args['type'] == 'styleid') {
3109 3109
 				$type = 'TextControl';
3110 3110
 				$args['type'] == 'text';
3111 3111
 				// Save numbers as numbers and not strings
3112
-				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
-			}else if ( $args['type'] == 'notice' ) {
3112
+				$value = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
+			} else if ($args['type'] == 'notice') {
3114 3114
 
3115 3115
 				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116 3116
 				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
@@ -3172,11 +3172,11 @@  discard block
 block discarded – undo
3172 3172
 							return;
3173 3173
 						}
3174 3174
 */
3175
-			elseif ( $args['type'] == 'color' ) {
3175
+			elseif ($args['type'] == 'color') {
3176 3176
 				$type = 'ColorPicker';
3177 3177
 				$onchange = "";
3178 3178
 				$extra = "color: $value,";
3179
-				if(!empty($args['disable_alpha'])){
3179
+				if (!empty($args['disable_alpha'])) {
3180 3180
 					$extra .= "disableAlpha: true,";
3181 3181
 				}
3182 3182
 				$onchangecomplete = "onChangeComplete: function($key) {
@@ -3185,14 +3185,14 @@  discard block
 block discarded – undo
3185 3185
                             $key: value
3186 3186
                         });
3187 3187
                     },";
3188
-			}elseif ( $args['type'] == 'gradient' ) {
3188
+			}elseif ($args['type'] == 'gradient') {
3189 3189
 				$type = 'GradientPicker';
3190 3190
 
3191
-			}elseif ( $args['type'] == 'image' ) {
3191
+			}elseif ($args['type'] == 'image') {
3192 3192
 //                print_r($args);
3193 3193
 
3194 3194
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
3195
-                            url:  props.attributes.{$key}_use_featured === true ? '".$this->get_url()."icons/placeholder.png'  : props.attributes.$key,
3195
+                            url:  props.attributes.{$key}_use_featured === true ? '" . $this->get_url() . "icons/placeholder.png'  : props.attributes.$key,
3196 3196
                             value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy  : {x: 0.5,y: 0.5,},
3197 3197
 //                            value: props.attributes.{$key}_xy,
3198 3198
                             onChange: function(focalPoint){
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
                 $onchange = "";
3251 3251
 
3252 3252
                 //$inside_elements = ",el('div',{},'file upload')";
3253
-			}elseif ( $args['type'] == 'images' ) {
3253
+			}elseif ($args['type'] == 'images') {
3254 3254
 				//                print_r($args);
3255 3255
 
3256 3256
                 $img_preview = "props.attributes.$key && (function() {
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
 							images.push( el('div',{className: 'col p-2',draggable: 'true','data-index': index}, el('img', { src: upload.sizes.thumbnail.url,style: {maxWidth:'100%',background: '#ccc',pointerEvents:'none'}}),el('i',{
3263 3263
 							className: 'fas fa-times-circle text-danger position-absolute  ml-n2 mt-n1 bg-white rounded-circle c-pointer',
3264 3264
 							onClick: function(){
3265
-							    aui_confirm('".__('Are you sure?')."', '".__('Delete')."', '".__('Cancel')."', true).then(function(confirmed) {
3265
+							    aui_confirm('" . __('Are you sure?') . "', '" . __('Delete') . "', '" . __('Cancel') . "', true).then(function(confirmed) {
3266 3266
 if (confirmed) {
3267 3267
 											let new_uploads = JSON.parse(props.attributes.$key);
3268 3268
 											new_uploads.splice(index, 1); //remove
@@ -3336,36 +3336,36 @@  discard block
 block discarded – undo
3336 3336
 
3337 3337
                 //$inside_elements = ",el('div',{},'file upload')";
3338 3338
 			}
3339
-			elseif ( $args['type'] == 'checkbox' ) {
3339
+			elseif ($args['type'] == 'checkbox') {
3340 3340
 				$type = 'CheckboxControl';
3341 3341
 				$extra .= "checked: props.attributes.$key,";
3342 3342
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3343
-			} elseif ( $args['type'] == 'textarea' ) {
3343
+			} elseif ($args['type'] == 'textarea') {
3344 3344
 				$type = 'TextareaControl';
3345 3345
 
3346
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3346
+			} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
3347 3347
 				$type = 'SelectControl';
3348 3348
 
3349
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
-				}else {
3349
+				if ($args['name'] == 'category' && !empty($args['post_type_linked'])) {
3350
+					$options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ",";
3351
+				}elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) {
3352
+					$options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ",";
3353
+				} else {
3354 3354
 
3355
-					if ( ! empty( $args['options'] ) ) {
3355
+					if (!empty($args['options'])) {
3356 3356
 						$options .= "options: [";
3357
-						foreach ( $args['options'] as $option_val => $option_label ) {
3358
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3357
+						foreach ($args['options'] as $option_val => $option_label) {
3358
+							$options .= "{ value: '" . esc_attr($option_val) . "', label: '" . addslashes($option_label) . "' },";
3359 3359
 						}
3360 3360
 						$options .= "],";
3361 3361
 					}
3362 3362
 				}
3363
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3363
+				if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3364 3364
 					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3365 3365
 				}
3366 3366
 
3367
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3368
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3367
+				if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) {
3368
+					$after_elements .= "props.attributes.$key && el( wp.components.Button, {
3369 3369
                                       className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3370 3370
                                       style: {margin:'-8px 0 8px 0',display: 'block'},
3371 3371
                                       onClick: function(){
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
                                     'Clear'
3378 3378
                             ),";
3379 3379
 				}
3380
-			} elseif ( $args['type'] == 'tagselect' ) {
3380
+			} elseif ($args['type'] == 'tagselect') {
3381 3381
 //				$type = 'FormTokenField';
3382 3382
 //
3383 3383
 //				if ( ! empty( $args['options'] ) ) {
@@ -3412,23 +3412,23 @@  discard block
 block discarded – undo
3412 3412
 //				$value     = "[]";
3413 3413
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3414 3414
 
3415
-			} elseif ( $args['type'] == 'alignment' ) {
3415
+			} elseif ($args['type'] == 'alignment') {
3416 3416
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
-			}elseif ( $args['type'] == 'margins' ) {
3417
+			}elseif ($args['type'] == 'margins') {
3418 3418
 
3419 3419
 			} else {
3420
-				return;// if we have not implemented the control then don't break the JS.
3420
+				return; // if we have not implemented the control then don't break the JS.
3421 3421
 			}
3422 3422
 
3423 3423
 
3424 3424
 
3425 3425
 			// color input does not show the labels so we add them
3426
-			if($args['type']=='color'){
3426
+			if ($args['type'] == 'color') {
3427 3427
 				// add show only if advanced
3428 3428
 				echo $require_advanced;
3429 3429
 				// add setting require if defined
3430 3430
 				echo $element_require;
3431
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3431
+				echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),";
3432 3432
 			}
3433 3433
 
3434 3434
 			// add show only if advanced
@@ -3440,18 +3440,18 @@  discard block
 block discarded – undo
3440 3440
 			// icon
3441 3441
 			echo $icon;
3442 3442
 			?>
3443
-			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
3443
+			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, {
3444 3444
 			label: <?php
3445
-			if(empty($args['title'])){
3445
+			if (empty($args['title'])) {
3446 3446
                 echo "''";
3447
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3447
+			}elseif (empty($args['row']) && !empty($args['device_type'])) {
3448 3448
                 ?>el('label', {
3449 3449
 									className: 'components-base-control__label',
3450 3450
 									style: {width:"100%"}
3451 3451
 								},
3452
-								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),
3453
-								<?php if($device_type_icon){ ?>
3454
-                                    deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3452
+								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['title']) ?>'}}),
3453
+								<?php if ($device_type_icon) { ?>
3454
+                                    deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3455 3455
 								<?php
3456 3456
                                 }
3457 3457
                                 ?>
@@ -3459,27 +3459,27 @@  discard block
 block discarded – undo
3459 3459
 
3460 3460
 							)<?php
3461 3461
 
3462
-			}else{
3463
-                 ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3462
+			} else {
3463
+                 ?>'<?php echo addslashes($args['title']); ?>'<?php
3464 3464
 
3465 3465
 			}
3466 3466
 
3467 3467
 			?>,
3468
-			help: <?php if ( isset( $args['desc'] ) ) {
3469
-				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
-			}else{ echo "''"; } ?>,
3468
+			help: <?php if (isset($args['desc'])) {
3469
+				echo "el('span',{dangerouslySetInnerHTML: {__html: '" . wp_kses_post(addslashes($args['desc'])) . "'}})";
3470
+			} else { echo "''"; } ?>,
3471 3471
 			value: <?php echo $value; ?>,
3472
-			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3473
-				echo "type: '" . addslashes( $args['type'] ) . "',";
3472
+			<?php if ($type == 'TextControl' && $args['type'] != 'text') {
3473
+				echo "type: '" . addslashes($args['type']) . "',";
3474 3474
 			} ?>
3475
-			<?php if ( ! empty( $args['placeholder'] ) ) {
3476
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3475
+			<?php if (!empty($args['placeholder'])) {
3476
+				echo "placeholder: '" . addslashes($args['placeholder']) . "',";
3477 3477
 			} ?>
3478 3478
 			<?php echo $options; ?>
3479 3479
 			<?php echo $extra; ?>
3480 3480
 			<?php echo $custom_attributes; ?>
3481 3481
 			<?php echo $onchangecomplete;
3482
-            if($onchange){
3482
+            if ($onchange) {
3483 3483
             ?>
3484 3484
 			onChange: function ( <?php echo $key; ?> ) {
3485 3485
 			<?php echo $onchange; ?>
@@ -3500,15 +3500,15 @@  discard block
 block discarded – undo
3500 3500
 		 *@todo there is prob a faster way to do this, also we could add some validation here.
3501 3501
 		 *
3502 3502
 		 */
3503
-		public function array_to_attributes( $custom_attributes, $html = false ) {
3503
+		public function array_to_attributes($custom_attributes, $html = false) {
3504 3504
 			$attributes = '';
3505
-			if ( ! empty( $custom_attributes ) ) {
3505
+			if (!empty($custom_attributes)) {
3506 3506
 
3507
-				foreach ( $custom_attributes as $key => $val ) {
3508
-					if(is_array($val)){
3509
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
-					}else{
3511
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3507
+				foreach ($custom_attributes as $key => $val) {
3508
+					if (is_array($val)) {
3509
+						$attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},';
3510
+					} else {
3511
+						$attributes .= $html ? " $key='$val' " : "'$key': '$val',";
3512 3512
 					}
3513 3513
 				}
3514 3514
 
@@ -3526,112 +3526,112 @@  discard block
 block discarded – undo
3526 3526
 		 *
3527 3527
 		 * @param $args
3528 3528
 		 */
3529
-		public function block_element( $args, $save = false ) {
3529
+		public function block_element($args, $save = false) {
3530 3530
 
3531 3531
 
3532
-			if ( ! empty( $args ) ) {
3533
-				foreach ( $args as $element => $new_args ) {
3532
+			if (!empty($args)) {
3533
+				foreach ($args as $element => $new_args) {
3534 3534
 
3535
-					if ( is_array( $new_args ) ) { // its an element
3535
+					if (is_array($new_args)) { // its an element
3536 3536
 
3537 3537
 
3538
-						if ( isset( $new_args['element'] ) ) {
3538
+						if (isset($new_args['element'])) {
3539 3539
 
3540
-							if ( isset( $new_args['element_require'] ) ) {
3541
-								echo str_replace( array(
3540
+							if (isset($new_args['element_require'])) {
3541
+								echo str_replace(array(
3542 3542
 										"'+",
3543 3543
 										"+'"
3544
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3545
-								unset( $new_args['element_require'] );
3544
+									), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
3545
+								unset($new_args['element_require']);
3546 3546
 							}
3547 3547
 
3548
-                            if($new_args['element']=='InnerBlocks'){
3548
+                            if ($new_args['element'] == 'InnerBlocks') {
3549 3549
                                 echo "\n el( InnerBlocks, {";
3550
-                            }elseif($new_args['element']=='innerBlocksProps'){
3550
+                            }elseif ($new_args['element'] == 'innerBlocksProps') {
3551 3551
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3552 3552
                               //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3553 3553
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3554 3554
                                 echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3555 3555
                                 echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
3556
-                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3556
+                                echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : '';
3557 3557
 
3558 3558
                                 echo "} ), {";
3559
-                                echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
3559
+                                echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : '';
3560 3560
                             //    echo '###';
3561 3561
 
3562 3562
                               //  echo '###';
3563
-                            }elseif($new_args['element']=='BlocksProps'){
3563
+                            }elseif ($new_args['element'] == 'BlocksProps') {
3564 3564
 
3565
-								if ( isset($new_args['if_inner_element']) ) {
3565
+								if (isset($new_args['if_inner_element'])) {
3566 3566
 									$element = $new_args['if_inner_element'];
3567
-								}else {
3568
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3567
+								} else {
3568
+									$element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'";
3569 3569
 								}
3570 3570
 
3571 3571
 								unset($new_args['inner_element']);
3572 3572
                                 echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
3573
-                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3573
+                                echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : '';
3574 3574
 
3575 3575
 
3576 3576
                                // echo "} ),";
3577 3577
 
3578
-                            }else{
3578
+                            } else {
3579 3579
                                 echo "\n el( '" . $new_args['element'] . "', {";
3580 3580
                             }
3581 3581
 
3582 3582
 
3583 3583
 							// get the attributes
3584
-							foreach ( $new_args as $new_key => $new_value ) {
3584
+							foreach ($new_args as $new_key => $new_value) {
3585 3585
 
3586 3586
 
3587
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3587
+								if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
3588 3588
 									// do nothing
3589 3589
 								} else {
3590
-									echo $this->block_element( array( $new_key => $new_value ),$save );
3590
+									echo $this->block_element(array($new_key => $new_value), $save);
3591 3591
 								}
3592 3592
 							}
3593 3593
 
3594
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3594
+							echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes
3595 3595
 
3596 3596
 							// get the content
3597 3597
 							$first_item = 0;
3598
-							foreach ( $new_args as $new_key => $new_value ) {
3599
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3598
+							foreach ($new_args as $new_key => $new_value) {
3599
+								if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) {
3600 3600
 
3601
-									if ( $new_key === 'content' ) {
3602
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
-									}else if ( $new_key === 'if_content' ) {
3604
-										echo  $this->block_props_replace(  $new_value  );
3601
+									if ($new_key === 'content') {
3602
+										echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'";
3603
+									} else if ($new_key === 'if_content') {
3604
+										echo  $this->block_props_replace($new_value);
3605 3605
 									}
3606 3606
 
3607
-									if ( is_array( $new_value ) ) {
3607
+									if (is_array($new_value)) {
3608 3608
 
3609
-										if ( isset( $new_value['element_require'] ) ) {
3610
-											echo str_replace( array(
3609
+										if (isset($new_value['element_require'])) {
3610
+											echo str_replace(array(
3611 3611
 													"'+",
3612 3612
 													"+'"
3613
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3614
-											unset( $new_value['element_require'] );
3613
+												), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
3614
+											unset($new_value['element_require']);
3615 3615
 										}
3616 3616
 
3617
-										if ( isset( $new_value['element_repeat'] ) ) {
3617
+										if (isset($new_value['element_repeat'])) {
3618 3618
 											$x = 1;
3619
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
3620
-												$this->block_element( array( '' => $new_value ),$save );
3621
-												$x ++;
3619
+											while ($x <= absint($new_value['element_repeat'])) {
3620
+												$this->block_element(array('' => $new_value), $save);
3621
+												$x++;
3622 3622
 											}
3623 3623
 										} else {
3624
-											$this->block_element( array( '' => $new_value ),$save );
3624
+											$this->block_element(array('' => $new_value), $save);
3625 3625
 										}
3626 3626
 									}
3627
-									$first_item ++;
3627
+									$first_item++;
3628 3628
 								}
3629 3629
 							}
3630 3630
 
3631
-                            if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3632
-                                echo "))";// end content
3633
-                            }else{
3634
-                                echo ")";// end content
3631
+                            if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') {
3632
+                                echo "))"; // end content
3633
+                            } else {
3634
+                                echo ")"; // end content
3635 3635
                             }
3636 3636
 
3637 3637
 
@@ -3640,26 +3640,26 @@  discard block
 block discarded – undo
3640 3640
 						}
3641 3641
 					} else {
3642 3642
 
3643
-						if ( substr( $element, 0, 3 ) === "if_" ) {
3643
+						if (substr($element, 0, 3) === "if_") {
3644 3644
 							$extra = '';
3645
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
3646
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3647
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3645
+							if (strpos($new_args, '[%WrapClass%]') !== false) {
3646
+								$new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args);
3647
+								$new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args);
3648 3648
 							}
3649
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3650
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3651
-                            $new_args = str_replace('[%WrapStyle%]','',$new_args);
3652
-                            echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
3649
+							echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ",";
3650
+						} elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) {
3651
+                            $new_args = str_replace('[%WrapStyle%]', '', $new_args);
3652
+                            echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },";
3653 3653
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3654
-						} elseif ( $element == 'style' ) {
3655
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3656
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3657
-                            $new_args = str_replace('[%WrapClass%]','',$new_args);
3658
-                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
3659
-						} elseif ( $element == 'template' && $new_args ) {
3654
+						} elseif ($element == 'style') {
3655
+							echo $element . ": " . $this->block_props_replace($new_args) . ",";
3656
+						} elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) {
3657
+                            $new_args = str_replace('[%WrapClass%]', '', $new_args);
3658
+                            echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),";
3659
+						} elseif ($element == 'template' && $new_args) {
3660 3660
 							echo $element . ": $new_args,";
3661 3661
 						} else {
3662
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3662
+							echo $element . ": '" . $this->block_props_replace($new_args) . "',";
3663 3663
 						}
3664 3664
 
3665 3665
 					}
@@ -3674,12 +3674,12 @@  discard block
 block discarded – undo
3674 3674
 		 *
3675 3675
 		 * @return mixed
3676 3676
 		 */
3677
-		public function block_props_replace( $string, $no_wrap = false ) {
3677
+		public function block_props_replace($string, $no_wrap = false) {
3678 3678
 
3679
-			if ( $no_wrap ) {
3680
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3679
+			if ($no_wrap) {
3680
+				$string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string);
3681 3681
 			} else {
3682
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3682
+				$string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string);
3683 3683
 			}
3684 3684
 
3685 3685
 			return $string;
@@ -3691,62 +3691,62 @@  discard block
 block discarded – undo
3691 3691
 		 * @param array $args
3692 3692
 		 * @param array $instance
3693 3693
 		 */
3694
-		public function widget( $args, $instance ) {
3694
+		public function widget($args, $instance) {
3695 3695
 
3696 3696
 			// get the filtered values
3697
-			$argument_values = $this->argument_values( $instance );
3698
-			$argument_values = $this->string_to_bool( $argument_values );
3699
-			$output          = $this->output( $argument_values, $args );
3697
+			$argument_values = $this->argument_values($instance);
3698
+			$argument_values = $this->string_to_bool($argument_values);
3699
+			$output          = $this->output($argument_values, $args);
3700 3700
 
3701 3701
 			$no_wrap = false;
3702
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3702
+			if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) {
3703 3703
 				$no_wrap = true;
3704 3704
 			}
3705 3705
 
3706 3706
 			ob_start();
3707
-			if ( $output && ! $no_wrap ) {
3707
+			if ($output && !$no_wrap) {
3708 3708
 
3709 3709
 				$class_original = $this->options['widget_ops']['classname'];
3710
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3710
+				$class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash();
3711 3711
 
3712 3712
 				// Before widget
3713 3713
 				$before_widget = $args['before_widget'];
3714
-				$before_widget = str_replace($class_original,$class,$before_widget);
3715
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3716
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3714
+				$before_widget = str_replace($class_original, $class, $before_widget);
3715
+				$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
3716
+				$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this);
3717 3717
 
3718 3718
 				// After widget
3719 3719
 				$after_widget = $args['after_widget'];
3720
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3721
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3720
+				$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
3721
+				$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this);
3722 3722
 
3723 3723
 				echo $before_widget;
3724 3724
 				// elementor strips the widget wrapping div so we check for and add it back if needed
3725
-				if ( $this->is_elementor_widget_output() ) {
3725
+				if ($this->is_elementor_widget_output()) {
3726 3726
 					// Filter class & attrs for elementor widget output.
3727
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3728
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3727
+					$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
3728
+					$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
3729 3729
 
3730
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3731
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3730
+					$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
3731
+					$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
3732 3732
 
3733
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3733
+					echo "<span class='" . esc_attr($class) . "' " . $attrs . ">";
3734 3734
 				}
3735
-				echo $this->output_title( $args, $instance );
3735
+				echo $this->output_title($args, $instance);
3736 3736
 				echo $output;
3737
-				if ( $this->is_elementor_widget_output() ) {
3737
+				if ($this->is_elementor_widget_output()) {
3738 3738
 					echo "</span>";
3739 3739
 				}
3740 3740
 				echo $after_widget;
3741
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3742
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3741
+			} elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty
3742
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
3743 3743
 				echo $output;
3744
-			} elseif ( $output && $no_wrap ) {
3744
+			} elseif ($output && $no_wrap) {
3745 3745
 				echo $output;
3746 3746
 			}
3747 3747
 			$output = ob_get_clean();
3748 3748
 
3749
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3749
+			$output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this);
3750 3750
 
3751 3751
 			echo $output;
3752 3752
 		}
@@ -3759,7 +3759,7 @@  discard block
 block discarded – undo
3759 3759
 		 */
3760 3760
 		public function is_elementor_widget_output() {
3761 3761
 			$result = false;
3762
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3762
+			if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') {
3763 3763
 				$result = true;
3764 3764
 			}
3765 3765
 
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 		 */
3775 3775
 		public function is_elementor_preview() {
3776 3776
 			$result = false;
3777
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3777
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
3778 3778
 				$result = true;
3779 3779
 			}
3780 3780
 
@@ -3789,7 +3789,7 @@  discard block
 block discarded – undo
3789 3789
 		 */
3790 3790
 		public function is_divi_preview() {
3791 3791
 			$result = false;
3792
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3792
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
3793 3793
 				$result = true;
3794 3794
 			}
3795 3795
 
@@ -3804,7 +3804,7 @@  discard block
 block discarded – undo
3804 3804
 		 */
3805 3805
 		public function is_beaver_preview() {
3806 3806
 			$result = false;
3807
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3807
+			if (isset($_REQUEST['fl_builder'])) {
3808 3808
 				$result = true;
3809 3809
 			}
3810 3810
 
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
 		 */
3820 3820
 		public function is_siteorigin_preview() {
3821 3821
 			$result = false;
3822
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3822
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
3823 3823
 				$result = true;
3824 3824
 			}
3825 3825
 
@@ -3834,7 +3834,7 @@  discard block
 block discarded – undo
3834 3834
 		 */
3835 3835
 		public function is_cornerstone_preview() {
3836 3836
 			$result = false;
3837
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3837
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
3838 3838
 				$result = true;
3839 3839
 			}
3840 3840
 
@@ -3849,7 +3849,7 @@  discard block
 block discarded – undo
3849 3849
 		 */
3850 3850
 		public function is_fusion_preview() {
3851 3851
 			$result = false;
3852
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3852
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
3853 3853
 				$result = true;
3854 3854
 			}
3855 3855
 
@@ -3864,7 +3864,7 @@  discard block
 block discarded – undo
3864 3864
 		 */
3865 3865
 		public function is_oxygen_preview() {
3866 3866
 			$result = false;
3867
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3867
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
3868 3868
 				$result = true;
3869 3869
 			}
3870 3870
 
@@ -3879,21 +3879,21 @@  discard block
 block discarded – undo
3879 3879
 		 */
3880 3880
 		public function is_preview() {
3881 3881
 			$preview = false;
3882
-			if ( $this->is_divi_preview() ) {
3882
+			if ($this->is_divi_preview()) {
3883 3883
 				$preview = true;
3884
-			} elseif ( $this->is_elementor_preview() ) {
3884
+			} elseif ($this->is_elementor_preview()) {
3885 3885
 				$preview = true;
3886
-			} elseif ( $this->is_beaver_preview() ) {
3886
+			} elseif ($this->is_beaver_preview()) {
3887 3887
 				$preview = true;
3888
-			} elseif ( $this->is_siteorigin_preview() ) {
3888
+			} elseif ($this->is_siteorigin_preview()) {
3889 3889
 				$preview = true;
3890
-			} elseif ( $this->is_cornerstone_preview() ) {
3890
+			} elseif ($this->is_cornerstone_preview()) {
3891 3891
 				$preview = true;
3892
-			} elseif ( $this->is_fusion_preview() ) {
3892
+			} elseif ($this->is_fusion_preview()) {
3893 3893
 				$preview = true;
3894
-			} elseif ( $this->is_oxygen_preview() ) {
3894
+			} elseif ($this->is_oxygen_preview()) {
3895 3895
 				$preview = true;
3896
-			} elseif( $this->is_block_content_call() ) {
3896
+			} elseif ($this->is_block_content_call()) {
3897 3897
 				$preview = true;
3898 3898
 			}
3899 3899
 
@@ -3908,34 +3908,34 @@  discard block
 block discarded – undo
3908 3908
 		 *
3909 3909
 		 * @return string
3910 3910
 		 */
3911
-		public function output_title( $args, $instance = array() ) {
3911
+		public function output_title($args, $instance = array()) {
3912 3912
 			$output = '';
3913
-			if ( ! empty( $instance['title'] ) ) {
3913
+			if (!empty($instance['title'])) {
3914 3914
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3915
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3915
+				$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
3916 3916
 
3917
-				if(empty($instance['widget_title_tag'])){
3917
+				if (empty($instance['widget_title_tag'])) {
3918 3918
 					$output = $args['before_title'] . $title . $args['after_title'];
3919
-				}else{
3920
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
3919
+				} else {
3920
+					$title_tag = esc_attr($instance['widget_title_tag']);
3921 3921
 
3922 3922
 					// classes
3923 3923
 					$title_classes = array();
3924
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3925
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3926
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3927
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3928
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3929
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3930
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3931
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3932
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3933
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3934
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3935
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3936
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3937
-
3938
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3924
+					$title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : '';
3925
+					$title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : '';
3926
+					$title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : '';
3927
+					$title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : '';
3928
+					$title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : '';
3929
+					$title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : '';
3930
+					$title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : '';
3931
+					$title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : '';
3932
+					$title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : '';
3933
+					$title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : '';
3934
+					$title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : '';
3935
+					$title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : '';
3936
+					$title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : '';
3937
+
3938
+					$class = !empty($title_classes) ? implode(" ", $title_classes) : '';
3939 3939
 					$output = "<$title_tag class='$class' >$title</$title_tag>";
3940 3940
 				}
3941 3941
 
@@ -3949,7 +3949,7 @@  discard block
 block discarded – undo
3949 3949
 		 *
3950 3950
 		 * @param array $instance The widget options.
3951 3951
 		 */
3952
-		public function form( $instance ) {
3952
+		public function form($instance) {
3953 3953
 
3954 3954
 			// set widget instance
3955 3955
 			$this->instance = $instance;
@@ -3957,20 +3957,20 @@  discard block
 block discarded – undo
3957 3957
 			// set it as a SD widget
3958 3958
 			echo $this->widget_advanced_toggle();
3959 3959
 
3960
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3960
+			echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>";
3961 3961
 			$arguments_raw = $this->get_arguments();
3962 3962
 
3963
-			if ( is_array( $arguments_raw ) ) {
3963
+			if (is_array($arguments_raw)) {
3964 3964
 
3965
-				$arguments = $this->group_arguments( $arguments_raw );
3965
+				$arguments = $this->group_arguments($arguments_raw);
3966 3966
 
3967 3967
 				// Do we have sections?
3968 3968
 				$has_sections = $arguments == $arguments_raw ? false : true;
3969 3969
 
3970 3970
 
3971
-				if ( $has_sections ) {
3971
+				if ($has_sections) {
3972 3972
 					$panel_count = 0;
3973
-					foreach ( $arguments as $key => $args ) {
3973
+					foreach ($arguments as $key => $args) {
3974 3974
 
3975 3975
 						?>
3976 3976
 						<script>
@@ -3980,26 +3980,26 @@  discard block
 block discarded – undo
3980 3980
 
3981 3981
 						$hide       = $panel_count ? ' style="display:none;" ' : '';
3982 3982
 						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3983
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3984
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3983
+						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes($key) . "'>" . esc_attr($key) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3984
+						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>";
3985 3985
 
3986
-						foreach ( $args as $k => $a ) {
3986
+						foreach ($args as $k => $a) {
3987 3987
 
3988 3988
 							$this->widget_inputs_row_start($k, $a);
3989
-							$this->widget_inputs( $a, $instance );
3989
+							$this->widget_inputs($a, $instance);
3990 3990
 							$this->widget_inputs_row_end($k, $a);
3991 3991
 
3992 3992
 						}
3993 3993
 
3994 3994
 						echo "</div>";
3995 3995
 
3996
-						$panel_count ++;
3996
+						$panel_count++;
3997 3997
 
3998 3998
 					}
3999 3999
 				} else {
4000
-					foreach ( $arguments as $key => $args ) {
4000
+					foreach ($arguments as $key => $args) {
4001 4001
 						$this->widget_inputs_row_start($key, $args);
4002
-						$this->widget_inputs( $args, $instance );
4002
+						$this->widget_inputs($args, $instance);
4003 4003
 						$this->widget_inputs_row_end($key, $args);
4004 4004
 					}
4005 4005
 				}
@@ -4007,33 +4007,33 @@  discard block
 block discarded – undo
4007 4007
 			}
4008 4008
 		}
4009 4009
 
4010
-		public function widget_inputs_row_start($key, $args){
4011
-			if(!empty($args['row'])){
4010
+		public function widget_inputs_row_start($key, $args) {
4011
+			if (!empty($args['row'])) {
4012 4012
 				// maybe open
4013
-				if(!empty($args['row']['open'])){
4013
+				if (!empty($args['row']['open'])) {
4014 4014
 					?>
4015
-					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
4016
-						echo $this->convert_element_require( $args['row']['element_require'] );
4015
+					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php if (!empty($args['row']['element_require'])) {
4016
+						echo $this->convert_element_require($args['row']['element_require']);
4017 4017
 					} ?>'>
4018
-					<?php if(!empty($args['row']['title'])){ ?>
4019
-					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4018
+					<?php if (!empty($args['row']['title'])) { ?>
4019
+					<label class="mb-0 "><?php echo esc_attr($args['row']['title']); ?><?php echo $this->widget_field_desc($args['row']); ?></label>
4020 4020
 					<?php }?>
4021
-					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4021
+					<div class='row <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>'>
4022 4022
 					<div class='col pr-2'>
4023 4023
 					<?php
4024
-				}elseif(!empty($args['row']['close'])){
4024
+				}elseif (!empty($args['row']['close'])) {
4025 4025
 					echo "<div class='col pl-0'>";
4026
-				}else{
4026
+				} else {
4027 4027
 					echo "<div class='col pl-0 pr-2'>";
4028 4028
 				}
4029 4029
 			}
4030 4030
 		}
4031 4031
 
4032
-		public function widget_inputs_row_end($key, $args){
4032
+		public function widget_inputs_row_end($key, $args) {
4033 4033
 
4034
-			if(!empty($args['row'])){
4034
+			if (!empty($args['row'])) {
4035 4035
 				// maybe close
4036
-				if(!empty($args['row']['close'])){
4036
+				if (!empty($args['row']['close'])) {
4037 4037
 					echo "</div></div>";
4038 4038
 				}
4039 4039
 
@@ -4049,7 +4049,7 @@  discard block
 block discarded – undo
4049 4049
 		public function widget_advanced_toggle() {
4050 4050
 
4051 4051
 			$output = '';
4052
-			if ( $this->block_show_advanced() ) {
4052
+			if ($this->block_show_advanced()) {
4053 4053
 				$val = 1;
4054 4054
 			} else {
4055 4055
 				$val = 0;
@@ -4069,14 +4069,14 @@  discard block
 block discarded – undo
4069 4069
 		 *@since 1.0.0
4070 4070
 		 *
4071 4071
 		 */
4072
-		public function convert_element_require( $input ) {
4072
+		public function convert_element_require($input) {
4073 4073
 
4074
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4074
+			$input = str_replace("'", '"', $input); // we only want double quotes
4075 4075
 
4076
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
4076
+			$output = esc_attr(str_replace(array("[%", "%]"), array(
4077 4077
 				"jQuery(form).find('[data-argument=\"",
4078 4078
 				"\"]').find('input,select,textarea').val()"
4079
-			), $input ) );
4079
+			), $input));
4080 4080
 
4081 4081
 			return $output;
4082 4082
 		}
@@ -4087,56 +4087,56 @@  discard block
 block discarded – undo
4087 4087
 		 * @param $args
4088 4088
 		 * @param $instance
4089 4089
 		 */
4090
-		public function widget_inputs( $args, $instance ) {
4090
+		public function widget_inputs($args, $instance) {
4091 4091
 
4092 4092
 			$class             = "";
4093 4093
 			$element_require   = "";
4094 4094
 			$custom_attributes = "";
4095 4095
 
4096 4096
 			// get value
4097
-			if ( isset( $instance[ $args['name'] ] ) ) {
4098
-				$value = $instance[ $args['name'] ];
4099
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4100
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4097
+			if (isset($instance[$args['name']])) {
4098
+				$value = $instance[$args['name']];
4099
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
4100
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
4101 4101
 			} else {
4102 4102
 				$value = '';
4103 4103
 			}
4104 4104
 
4105 4105
 			// get placeholder
4106
-			if ( ! empty( $args['placeholder'] ) ) {
4107
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4106
+			if (!empty($args['placeholder'])) {
4107
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
4108 4108
 			} else {
4109 4109
 				$placeholder = '';
4110 4110
 			}
4111 4111
 
4112 4112
 			// get if advanced
4113
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4113
+			if (isset($args['advanced']) && $args['advanced']) {
4114 4114
 				$class .= " sd-advanced-setting ";
4115 4115
 			}
4116 4116
 
4117 4117
 			// element_require
4118
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4118
+			if (isset($args['element_require']) && $args['element_require']) {
4119 4119
 				$element_require = $args['element_require'];
4120 4120
 			}
4121 4121
 
4122 4122
 			// custom_attributes
4123
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4124
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4123
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
4124
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
4125 4125
 			}
4126 4126
 
4127 4127
 
4128 4128
 			// before wrapper
4129 4129
 			?>
4130
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
4131
-			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
4132
-			data-element_require='<?php if ( $element_require ) {
4133
-				echo $this->convert_element_require( $element_require );
4130
+			<p class="sd-argument <?php echo esc_attr($class); ?>"
4131
+			data-argument='<?php echo esc_attr($args['name']); ?>'
4132
+			data-element_require='<?php if ($element_require) {
4133
+				echo $this->convert_element_require($element_require);
4134 4134
 			} ?>'
4135 4135
 			>
4136 4136
 			<?php
4137 4137
 
4138 4138
 
4139
-			switch ( $args['type'] ) {
4139
+			switch ($args['type']) {
4140 4140
 				//array('text','password','number','email','tel','url','color')
4141 4141
 				case "text":
4142 4142
 				case "password":
@@ -4147,46 +4147,46 @@  discard block
 block discarded – undo
4147 4147
 				case "color":
4148 4148
 					?>
4149 4149
 					<label
4150
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4150
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4151 4151
 					<input <?php echo $placeholder; ?> class="widefat"
4152 4152
 						<?php echo $custom_attributes; ?>
4153
-						                               id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4154
-						                               name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
4155
-						                               type="<?php echo esc_attr( $args['type'] ); ?>"
4156
-						                               value="<?php echo esc_attr( $value ); ?>">
4153
+						                               id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
4154
+						                               name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
4155
+						                               type="<?php echo esc_attr($args['type']); ?>"
4156
+						                               value="<?php echo esc_attr($value); ?>">
4157 4157
 					<?php
4158 4158
 
4159 4159
 					break;
4160 4160
 				case "select":
4161
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4162
-					if ( $multiple ) {
4163
-						if ( empty( $value ) ) {
4161
+					$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
4162
+					if ($multiple) {
4163
+						if (empty($value)) {
4164 4164
 							$value = array();
4165 4165
 						}
4166 4166
 					}
4167 4167
 					?>
4168 4168
 					<label
4169
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4169
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4170 4170
 					<select <?php echo $placeholder; ?> class="widefat"
4171 4171
 						<?php echo $custom_attributes; ?>
4172
-						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4173
-						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
4174
-						                                if ( $multiple ) {
4172
+						                                id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
4173
+						                                name="<?php echo esc_attr($this->get_field_name($args['name']));
4174
+						                                if ($multiple) {
4175 4175
 							                                echo "[]";
4176 4176
 						                                } ?>"
4177
-						<?php if ( $multiple ) {
4177
+						<?php if ($multiple) {
4178 4178
 							echo "multiple";
4179 4179
 						} //@todo not implemented yet due to gutenberg not supporting it
4180 4180
 						?>
4181 4181
 					>
4182 4182
 						<?php
4183 4183
 
4184
-						if ( ! empty( $args['options'] ) ) {
4185
-							foreach ( $args['options'] as $val => $label ) {
4186
-								if ( $multiple ) {
4187
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4184
+						if (!empty($args['options'])) {
4185
+							foreach ($args['options'] as $val => $label) {
4186
+								if ($multiple) {
4187
+									$selected = in_array($val, $value) ? 'selected="selected"' : '';
4188 4188
 								} else {
4189
-									$selected = selected( $value, $val, false );
4189
+									$selected = selected($value, $val, false);
4190 4190
 								}
4191 4191
 								echo "<option value='$val' " . $selected . ">$label</option>";
4192 4192
 							}
@@ -4198,32 +4198,32 @@  discard block
 block discarded – undo
4198 4198
 				case "checkbox":
4199 4199
 					?>
4200 4200
 					<input <?php echo $placeholder; ?>
4201
-						<?php checked( 1, $value, true ) ?>
4201
+						<?php checked(1, $value, true) ?>
4202 4202
 						<?php echo $custom_attributes; ?>
4203
-						class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4204
-						name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox"
4203
+						class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
4204
+						name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox"
4205 4205
 						value="1">
4206 4206
 					<label
4207
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4207
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4208 4208
 					<?php
4209 4209
 					break;
4210 4210
 				case "textarea":
4211 4211
 					?>
4212 4212
 					<label
4213
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4213
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4214 4214
 					<textarea <?php echo $placeholder; ?> class="widefat"
4215 4215
 						<?php echo $custom_attributes; ?>
4216
-						                                  id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4217
-						                                  name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
4218
-					><?php echo esc_attr( $value ); ?></textarea>
4216
+						                                  id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
4217
+						                                  name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
4218
+					><?php echo esc_attr($value); ?></textarea>
4219 4219
 					<?php
4220 4220
 
4221 4221
 					break;
4222 4222
 				case "hidden":
4223 4223
 					?>
4224
-					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4225
-					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
4226
-					       value="<?php echo esc_attr( $value ); ?>">
4224
+					<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
4225
+					       name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden"
4226
+					       value="<?php echo esc_attr($value); ?>">
4227 4227
 					<?php
4228 4228
 					break;
4229 4229
 				default:
@@ -4238,15 +4238,15 @@  discard block
 block discarded – undo
4238 4238
 
4239 4239
 		}
4240 4240
 
4241
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4242
-			if($icon=='box-top'){
4243
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4244
-			}elseif($icon=='box-right'){
4245
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4246
-			}elseif($icon=='box-bottom'){
4247
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4248
-			}elseif($icon=='box-left'){
4249
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4241
+		public function get_widget_icon($icon = 'box-top', $title = '') {
4242
+			if ($icon == 'box-top') {
4243
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4244
+			}elseif ($icon == 'box-right') {
4245
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4246
+			}elseif ($icon == 'box-bottom') {
4247
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4248
+			}elseif ($icon == 'box-left') {
4249
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4250 4250
 			}
4251 4251
 		}
4252 4252
 
@@ -4258,14 +4258,14 @@  discard block
 block discarded – undo
4258 4258
 		 * @return string
4259 4259
 		 * @todo, need to make its own tooltip script
4260 4260
 		 */
4261
-		public function widget_field_desc( $args ) {
4261
+		public function widget_field_desc($args) {
4262 4262
 
4263 4263
 			$description = '';
4264
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4265
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4266
-					$description = $this->desc_tip( $args['desc'] );
4264
+			if (isset($args['desc']) && $args['desc']) {
4265
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
4266
+					$description = $this->desc_tip($args['desc']);
4267 4267
 				} else {
4268
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4268
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
4269 4269
 				}
4270 4270
 			}
4271 4271
 
@@ -4279,12 +4279,12 @@  discard block
 block discarded – undo
4279 4279
 		 *
4280 4280
 		 * @return string
4281 4281
 		 */
4282
-		public function widget_field_title( $args ) {
4282
+		public function widget_field_title($args) {
4283 4283
 
4284 4284
 			$title = '';
4285
-			if ( isset( $args['title'] ) && $args['title'] ) {
4286
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4287
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4285
+			if (isset($args['title']) && $args['title']) {
4286
+				if (isset($args['icon']) && $args['icon']) {
4287
+					$title = self::get_widget_icon($args['icon'], $args['title']);
4288 4288
 				} else {
4289 4289
 					$title = esc_attr($args['title']);
4290 4290
 				}
@@ -4301,11 +4301,11 @@  discard block
 block discarded – undo
4301 4301
 		 *
4302 4302
 		 * @return string
4303 4303
 		 */
4304
-		function desc_tip( $tip, $allow_html = false ) {
4305
-			if ( $allow_html ) {
4306
-				$tip = $this->sanitize_tooltip( $tip );
4304
+		function desc_tip($tip, $allow_html = false) {
4305
+			if ($allow_html) {
4306
+				$tip = $this->sanitize_tooltip($tip);
4307 4307
 			} else {
4308
-				$tip = esc_attr( $tip );
4308
+				$tip = esc_attr($tip);
4309 4309
 			}
4310 4310
 
4311 4311
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -4318,8 +4318,8 @@  discard block
 block discarded – undo
4318 4318
 		 *
4319 4319
 		 * @return string
4320 4320
 		 */
4321
-		public function sanitize_tooltip( $var ) {
4322
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4321
+		public function sanitize_tooltip($var) {
4322
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
4323 4323
 				'br'     => array(),
4324 4324
 				'em'     => array(),
4325 4325
 				'strong' => array(),
@@ -4329,7 +4329,7 @@  discard block
 block discarded – undo
4329 4329
 				'li'     => array(),
4330 4330
 				'ol'     => array(),
4331 4331
 				'p'      => array(),
4332
-			) ) );
4332
+			)));
4333 4333
 		}
4334 4334
 
4335 4335
 		/**
@@ -4341,23 +4341,23 @@  discard block
 block discarded – undo
4341 4341
 		 * @return array
4342 4342
 		 * @todo we should add some sanitation here.
4343 4343
 		 */
4344
-		public function update( $new_instance, $old_instance ) {
4344
+		public function update($new_instance, $old_instance) {
4345 4345
 
4346 4346
 			//save the widget
4347
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4347
+			$instance = array_merge((array) $old_instance, (array) $new_instance);
4348 4348
 
4349 4349
 			// set widget instance
4350 4350
 			$this->instance = $instance;
4351 4351
 
4352
-			if ( empty( $this->arguments ) ) {
4352
+			if (empty($this->arguments)) {
4353 4353
 				$this->get_arguments();
4354 4354
 			}
4355 4355
 
4356 4356
 			// check for checkboxes
4357
-			if ( ! empty( $this->arguments ) ) {
4358
-				foreach ( $this->arguments as $argument ) {
4359
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4360
-						$instance[ $argument['name'] ] = '0';
4357
+			if (!empty($this->arguments)) {
4358
+				foreach ($this->arguments as $argument) {
4359
+					if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
4360
+						$instance[$argument['name']] = '0';
4361 4361
 					}
4362 4362
 				}
4363 4363
 			}
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
 		 */
4376 4376
 		public function is_block_content_call() {
4377 4377
 			$result = false;
4378
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4378
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
4379 4379
 				$result = true;
4380 4380
 			}
4381 4381
 
@@ -4388,9 +4388,9 @@  discard block
 block discarded – undo
4388 4388
 		 * @return string
4389 4389
 		 *@since 1.0.20
4390 4390
 		 */
4391
-		public function get_instance_hash(){
4392
-			$instance_string = $this->base_id.serialize($this->instance);
4393
-			return hash('crc32b',$instance_string);
4391
+		public function get_instance_hash() {
4392
+			$instance_string = $this->base_id . serialize($this->instance);
4393
+			return hash('crc32b', $instance_string);
4394 4394
 		}
4395 4395
 
4396 4396
 		/**
@@ -4401,14 +4401,14 @@  discard block
 block discarded – undo
4401 4401
 		 * @return string
4402 4402
 		 *@since 1.0.20
4403 4403
 		 */
4404
-		public function get_instance_style($rules = array()){
4404
+		public function get_instance_style($rules = array()) {
4405 4405
 			$css = '';
4406 4406
 
4407
-			if(!empty($rules)){
4407
+			if (!empty($rules)) {
4408 4408
 				$rules = array_unique($rules);
4409 4409
 				$instance_hash = $this->get_instance_hash();
4410 4410
 				$css .= "<style>";
4411
-				foreach($rules as $rule){
4411
+				foreach ($rules as $rule) {
4412 4412
 					$css .= ".sdel-$instance_hash $rule";
4413 4413
 				}
4414 4414
 				$css .= "</style>";
@@ -4426,9 +4426,9 @@  discard block
 block discarded – undo
4426 4426
 		 *@since 1.0.28
4427 4427
 		 *
4428 4428
 		 */
4429
-		public function encode_shortcodes( $content ) {
4429
+		public function encode_shortcodes($content) {
4430 4430
 			// Avoids existing encoded tags.
4431
-			$trans   = array(
4431
+			$trans = array(
4432 4432
 				'&#91;' => '&#091;',
4433 4433
 				'&#93;' => '&#093;',
4434 4434
 				'&amp;#91;' => '&#091;',
@@ -4439,7 +4439,7 @@  discard block
 block discarded – undo
4439 4439
 				'&amp;gt;' => '&0gt;',
4440 4440
 			);
4441 4441
 
4442
-			$content = strtr( $content, $trans );
4442
+			$content = strtr($content, $trans);
4443 4443
 
4444 4444
 			$trans   = array(
4445 4445
 				'[' => '&#91;',
@@ -4450,7 +4450,7 @@  discard block
 block discarded – undo
4450 4450
 				"'" => '&apos;',
4451 4451
 			);
4452 4452
 
4453
-			$content = strtr( $content, $trans );
4453
+			$content = strtr($content, $trans);
4454 4454
 
4455 4455
 			return $content;
4456 4456
 		}
@@ -4464,8 +4464,8 @@  discard block
 block discarded – undo
4464 4464
 		 *@since 1.0.28
4465 4465
 		 *
4466 4466
 		 */
4467
-		public function decode_shortcodes( $content ) {
4468
-			$trans   = array(
4467
+		public function decode_shortcodes($content) {
4468
+			$trans = array(
4469 4469
 				'&#91;' => '[',
4470 4470
 				'&#93;' => ']',
4471 4471
 				'&amp;#91;' => '[',
@@ -4478,7 +4478,7 @@  discard block
 block discarded – undo
4478 4478
 				'&apos;' => "'",
4479 4479
 			);
4480 4480
 
4481
-			$content = strtr( $content, $trans );
4481
+			$content = strtr($content, $trans);
4482 4482
 
4483 4483
 			$trans   = array(
4484 4484
 				'&#091;' => '&#91;',
@@ -4491,7 +4491,7 @@  discard block
 block discarded – undo
4491 4491
 				'&amp;0gt;' => '&gt;',
4492 4492
 			);
4493 4493
 
4494
-			$content = strtr( $content, $trans );
4494
+			$content = strtr($content, $trans);
4495 4495
 
4496 4496
 			return $content;
4497 4497
 		}
Please login to merge, or discard this patch.
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 2 patches
Indentation   +762 added lines, -762 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,361 +21,361 @@  discard block
 block discarded – undo
21 21
  */
22 22
 if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
23 23
 
24
-	/**
25
-	 * A Class to be able to change settings for Font Awesome.
26
-	 *
27
-	 * Class WP_Font_Awesome_Settings
28
-	 * @since 1.0.10 Now able to pass wp.org theme check.
29
-	 * @since 1.0.11 Font Awesome Pro now supported.
30
-	 * @since 1.0.11 Font Awesome Kits now supported.
31
-	 * @since 1.0.13 RTL language support added.
32
-	 * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed.
33
-	 * @since 1.0.15 Font Awesome will now load in the FSE if enable din the backend.
34
-	 * @since 1.1.0 Option added to load FontAwesome locally.
35
-	 * @since 1.1.1 Requires to re-save settings to load locally when option does not exists - FIXED.
36
-	 * @ver 1.0.15
37
-	 * @todo decide how to implement textdomain
38
-	 */
39
-	class WP_Font_Awesome_Settings {
40
-
41
-		/**
42
-		 * Class version version.
43
-		 *
44
-		 * @var string
45
-		 */
46
-		public $version = '1.1.1';
47
-
48
-		/**
49
-		 * Class textdomain.
50
-		 *
51
-		 * @var string
52
-		 */
53
-		public $textdomain = 'font-awesome-settings';
54
-
55
-		/**
56
-		 * Latest version of Font Awesome at time of publish published.
57
-		 *
58
-		 * @var string
59
-		 */
60
-		public $latest = "5.8.2";
61
-
62
-		/**
63
-		 * The title.
64
-		 *
65
-		 * @var string
66
-		 */
67
-		public $name = 'Font Awesome';
68
-
69
-		/**
70
-		 * Holds the settings values.
71
-		 *
72
-		 * @var array
73
-		 */
74
-		private $settings;
75
-
76
-		/**
77
-		 * WP_Font_Awesome_Settings instance.
78
-		 *
79
-		 * @access private
80
-		 * @since  1.0.0
81
-		 * @var    WP_Font_Awesome_Settings There can be only one!
82
-		 */
83
-		private static $instance = null;
84
-
85
-		/**
86
-		 * Main WP_Font_Awesome_Settings Instance.
87
-		 *
88
-		 * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
89
-		 *
90
-		 * @since 1.0.0
91
-		 * @static
92
-		 * @return WP_Font_Awesome_Settings - Main instance.
93
-		 */
94
-		public static function instance() {
95
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
96
-				self::$instance = new WP_Font_Awesome_Settings;
97
-
98
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
99
-
100
-				if ( is_admin() ) {
101
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
102
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
103
-					add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
104
-				}
105
-
106
-				do_action( 'wp_font_awesome_settings_loaded' );
107
-			}
108
-
109
-			return self::$instance;
110
-		}
111
-
112
-		/**
113
-		 * Initiate the settings and add the required action hooks.
114
-		 *
115
-		 * @since 1.0.8 Settings name wrong - FIXED
116
-		 */
117
-		public function init() {
118
-			// Download fontawesome locally.
119
-			add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 );
120
-			add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
121
-
122
-			$this->settings = $this->get_settings();
123
-
124
-			// check if the official plugin is active and use that instead if so.
125
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
126
-
127
-				if ( $this->settings['type'] == 'CSS' ) {
128
-
129
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
130
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
131
-					}
132
-
133
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
134
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
135
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
136
-					}
137
-
138
-				} else {
139
-
140
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
141
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
142
-					}
143
-
144
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
145
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
146
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
147
-					}
148
-				}
149
-
150
-				// remove font awesome if set to do so
151
-				if ( $this->settings['dequeue'] == '1' ) {
152
-					add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
153
-				}
154
-			}
155
-
156
-		}
157
-
158
-		/**
159
-		 * Add FA to the FSE.
160
-		 *
161
-		 * @param $editor_settings
162
-		 * @param $block_editor_context
163
-		 *
164
-		 * @return array
165
-		 */
166
-		public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
167
-
168
-			if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
169
-				$url = $this->get_url();
170
-				$editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
171
-			}
172
-
173
-			return $editor_settings;
174
-		}
175
-
176
-		/**
177
-		 * Add FA to the FSE.
178
-		 *
179
-		 * @param $editor_settings
180
-		 * @param $block_editor_context
181
-		 *
182
-		 * @return array
183
-		 */
184
-		public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
185
-
186
-			$url = $this->get_url();
187
-			$editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
188
-
189
-			return $editor_settings;
190
-		}
191
-
192
-		/**
193
-		 * Adds the Font Awesome styles.
194
-		 */
195
-		public function enqueue_style() {
196
-			// build url
197
-			$url = $this->get_url();
198
-			$version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
199
-
200
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
201
-			wp_register_style( 'font-awesome', $url, array(), $version );
202
-			wp_enqueue_style( 'font-awesome' );
203
-
204
-			// RTL language support CSS.
205
-			if ( is_rtl() ) {
206
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
207
-			}
208
-
209
-			if ( $this->settings['shims'] ) {
210
-				$url = $this->get_url( true );
211
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
212
-				wp_register_style( 'font-awesome-shims', $url, array(), $version );
213
-				wp_enqueue_style( 'font-awesome-shims' );
214
-			}
215
-		}
216
-
217
-		/**
218
-		 * Adds the Font Awesome JS.
219
-		 */
220
-		public function enqueue_scripts() {
221
-			// build url
222
-			$url = $this->get_url();
223
-
224
-			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
225
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
226
-			wp_register_script( 'font-awesome', $url, array(), null );
227
-			wp_enqueue_script( 'font-awesome' );
228
-
229
-			if ( $this->settings['shims'] ) {
230
-				$url = $this->get_url( true );
231
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
232
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
233
-				wp_enqueue_script( 'font-awesome-shims' );
234
-			}
235
-		}
236
-
237
-		/**
238
-		 * Get the url of the Font Awesome files.
239
-		 *
240
-		 * @param bool $shims If this is a shim file or not.
241
-		 * @param bool $local Load locally if allowed.
242
-		 *
243
-		 * @return string The url to the file.
244
-		 */
245
-		public function get_url( $shims = false, $local = true ) {
246
-			$script  = $shims ? 'v4-shims' : 'all';
247
-			$sub     = $this->settings['pro'] ? 'pro' : 'use';
248
-			$type    = $this->settings['type'];
249
-			$version = $this->settings['version'];
250
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
251
-			$url     = '';
252
-
253
-			if ( $type == 'KIT' && $kit_url ) {
254
-				if ( $shims ) {
255
-					// if its a kit then we don't add shims here
256
-					return '';
257
-				}
258
-				$url .= $kit_url; // CDN
259
-				$url .= "?wpfas=true"; // set our var so our version is not removed
260
-			} else {
261
-				$v = '';
262
-				// Check and load locally.
263
-				if ( $local && $this->has_local() ) {
264
-					$script .= ".min";
265
-					$v .= '&ver=' . strip_tags( $this->settings['local_version'] );
266
-					$url .= $this->get_fonts_url(); // Local fonts url.
267
-				} else {
268
-					$url .= "https://$sub.fontawesome.com/releases/"; // CDN
269
-					$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
270
-				}
271
-				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
272
-				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
273
-				$url .= "?wpfas=true" . $v; // set our var so our version is not removed
274
-			}
275
-
276
-			return $url;
277
-		}
278
-
279
-		/**
280
-		 * Try and remove any other versions of Font Awesome added by other plugins/themes.
281
-		 *
282
-		 * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version.
283
-		 *
284
-		 * @param $url
285
-		 * @param $original_url
286
-		 * @param $_context
287
-		 *
288
-		 * @return string The filtered url.
289
-		 */
290
-		public function remove_font_awesome( $url, $original_url, $_context ) {
291
-
292
-			if ( $_context == 'display'
293
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
294
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
295
-			) {// it's a font-awesome-url (probably)
296
-
297
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
298
-					if ( $this->settings['type'] == 'JS' ) {
299
-						if ( $this->settings['js-pseudo'] ) {
300
-							$url .= "' data-search-pseudo-elements defer='defer";
301
-						} else {
302
-							$url .= "' defer='defer";
303
-						}
304
-					}
305
-				} else {
306
-					$url = ''; // removing the url removes the file
307
-				}
308
-
309
-			}
310
-
311
-			return $url;
312
-		}
313
-
314
-		/**
315
-		 * Register the database settings with WordPress.
316
-		 */
317
-		public function register_settings() {
318
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
319
-		}
320
-
321
-		/**
322
-		 * Add the WordPress settings menu item.
323
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
324
-		 */
325
-		public function menu_item() {
326
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
327
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
328
-				$this,
329
-				'settings_page'
330
-			) );
331
-		}
332
-
333
-		/**
334
-		 * Get the current Font Awesome output settings.
335
-		 *
336
-		 * @return array The array of settings.
337
-		 */
338
-		public function get_settings() {
339
-			$db_settings = get_option( 'wp-font-awesome-settings' );
340
-
341
-			$defaults = array(
342
-				'type'      => 'CSS', // type to use, CSS or JS or KIT
343
-				'version'   => '', // latest
344
-				'enqueue'   => '', // front and backend
345
-				'shims'     => '0', // default OFF now in 2020
346
-				'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
347
-				'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
348
-				'pro'       => '0', // if pro CDN url should be used
349
-				'local'     => '0', // Store fonts locally.
350
-				'local_version' => '', // Local fonts version.
351
-				'kit-url'   => '', // the kit url
352
-			);
353
-
354
-			$settings = wp_parse_args( $db_settings, $defaults );
355
-
356
-			/**
357
-			 * Filter the Font Awesome settings.
358
-			 *
359
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
360
-			 */
361
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
362
-		}
363
-
364
-		/**
365
-		 * The settings page html output.
366
-		 */
367
-		public function settings_page() {
368
-			if ( ! current_user_can( 'manage_options' ) ) {
369
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
370
-			}
371
-
372
-			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
373
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
374
-				$this->get_latest_version( $force_api = true );
375
-			}
376
-
377
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
378
-				?>
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class WP_Font_Awesome_Settings
28
+     * @since 1.0.10 Now able to pass wp.org theme check.
29
+     * @since 1.0.11 Font Awesome Pro now supported.
30
+     * @since 1.0.11 Font Awesome Kits now supported.
31
+     * @since 1.0.13 RTL language support added.
32
+     * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed.
33
+     * @since 1.0.15 Font Awesome will now load in the FSE if enable din the backend.
34
+     * @since 1.1.0 Option added to load FontAwesome locally.
35
+     * @since 1.1.1 Requires to re-save settings to load locally when option does not exists - FIXED.
36
+     * @ver 1.0.15
37
+     * @todo decide how to implement textdomain
38
+     */
39
+    class WP_Font_Awesome_Settings {
40
+
41
+        /**
42
+         * Class version version.
43
+         *
44
+         * @var string
45
+         */
46
+        public $version = '1.1.1';
47
+
48
+        /**
49
+         * Class textdomain.
50
+         *
51
+         * @var string
52
+         */
53
+        public $textdomain = 'font-awesome-settings';
54
+
55
+        /**
56
+         * Latest version of Font Awesome at time of publish published.
57
+         *
58
+         * @var string
59
+         */
60
+        public $latest = "5.8.2";
61
+
62
+        /**
63
+         * The title.
64
+         *
65
+         * @var string
66
+         */
67
+        public $name = 'Font Awesome';
68
+
69
+        /**
70
+         * Holds the settings values.
71
+         *
72
+         * @var array
73
+         */
74
+        private $settings;
75
+
76
+        /**
77
+         * WP_Font_Awesome_Settings instance.
78
+         *
79
+         * @access private
80
+         * @since  1.0.0
81
+         * @var    WP_Font_Awesome_Settings There can be only one!
82
+         */
83
+        private static $instance = null;
84
+
85
+        /**
86
+         * Main WP_Font_Awesome_Settings Instance.
87
+         *
88
+         * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
89
+         *
90
+         * @since 1.0.0
91
+         * @static
92
+         * @return WP_Font_Awesome_Settings - Main instance.
93
+         */
94
+        public static function instance() {
95
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
96
+                self::$instance = new WP_Font_Awesome_Settings;
97
+
98
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
99
+
100
+                if ( is_admin() ) {
101
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
102
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
103
+                    add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
104
+                }
105
+
106
+                do_action( 'wp_font_awesome_settings_loaded' );
107
+            }
108
+
109
+            return self::$instance;
110
+        }
111
+
112
+        /**
113
+         * Initiate the settings and add the required action hooks.
114
+         *
115
+         * @since 1.0.8 Settings name wrong - FIXED
116
+         */
117
+        public function init() {
118
+            // Download fontawesome locally.
119
+            add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 );
120
+            add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
121
+
122
+            $this->settings = $this->get_settings();
123
+
124
+            // check if the official plugin is active and use that instead if so.
125
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
126
+
127
+                if ( $this->settings['type'] == 'CSS' ) {
128
+
129
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
130
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
131
+                    }
132
+
133
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
134
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
135
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
136
+                    }
137
+
138
+                } else {
139
+
140
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
141
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
142
+                    }
143
+
144
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
145
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
146
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
147
+                    }
148
+                }
149
+
150
+                // remove font awesome if set to do so
151
+                if ( $this->settings['dequeue'] == '1' ) {
152
+                    add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
153
+                }
154
+            }
155
+
156
+        }
157
+
158
+        /**
159
+         * Add FA to the FSE.
160
+         *
161
+         * @param $editor_settings
162
+         * @param $block_editor_context
163
+         *
164
+         * @return array
165
+         */
166
+        public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
167
+
168
+            if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
169
+                $url = $this->get_url();
170
+                $editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
171
+            }
172
+
173
+            return $editor_settings;
174
+        }
175
+
176
+        /**
177
+         * Add FA to the FSE.
178
+         *
179
+         * @param $editor_settings
180
+         * @param $block_editor_context
181
+         *
182
+         * @return array
183
+         */
184
+        public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
185
+
186
+            $url = $this->get_url();
187
+            $editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
188
+
189
+            return $editor_settings;
190
+        }
191
+
192
+        /**
193
+         * Adds the Font Awesome styles.
194
+         */
195
+        public function enqueue_style() {
196
+            // build url
197
+            $url = $this->get_url();
198
+            $version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
199
+
200
+            wp_deregister_style( 'font-awesome' ); // deregister in case its already there
201
+            wp_register_style( 'font-awesome', $url, array(), $version );
202
+            wp_enqueue_style( 'font-awesome' );
203
+
204
+            // RTL language support CSS.
205
+            if ( is_rtl() ) {
206
+                wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
207
+            }
208
+
209
+            if ( $this->settings['shims'] ) {
210
+                $url = $this->get_url( true );
211
+                wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
212
+                wp_register_style( 'font-awesome-shims', $url, array(), $version );
213
+                wp_enqueue_style( 'font-awesome-shims' );
214
+            }
215
+        }
216
+
217
+        /**
218
+         * Adds the Font Awesome JS.
219
+         */
220
+        public function enqueue_scripts() {
221
+            // build url
222
+            $url = $this->get_url();
223
+
224
+            $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
225
+            call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
226
+            wp_register_script( 'font-awesome', $url, array(), null );
227
+            wp_enqueue_script( 'font-awesome' );
228
+
229
+            if ( $this->settings['shims'] ) {
230
+                $url = $this->get_url( true );
231
+                call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
232
+                wp_register_script( 'font-awesome-shims', $url, array(), null );
233
+                wp_enqueue_script( 'font-awesome-shims' );
234
+            }
235
+        }
236
+
237
+        /**
238
+         * Get the url of the Font Awesome files.
239
+         *
240
+         * @param bool $shims If this is a shim file or not.
241
+         * @param bool $local Load locally if allowed.
242
+         *
243
+         * @return string The url to the file.
244
+         */
245
+        public function get_url( $shims = false, $local = true ) {
246
+            $script  = $shims ? 'v4-shims' : 'all';
247
+            $sub     = $this->settings['pro'] ? 'pro' : 'use';
248
+            $type    = $this->settings['type'];
249
+            $version = $this->settings['version'];
250
+            $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
251
+            $url     = '';
252
+
253
+            if ( $type == 'KIT' && $kit_url ) {
254
+                if ( $shims ) {
255
+                    // if its a kit then we don't add shims here
256
+                    return '';
257
+                }
258
+                $url .= $kit_url; // CDN
259
+                $url .= "?wpfas=true"; // set our var so our version is not removed
260
+            } else {
261
+                $v = '';
262
+                // Check and load locally.
263
+                if ( $local && $this->has_local() ) {
264
+                    $script .= ".min";
265
+                    $v .= '&ver=' . strip_tags( $this->settings['local_version'] );
266
+                    $url .= $this->get_fonts_url(); // Local fonts url.
267
+                } else {
268
+                    $url .= "https://$sub.fontawesome.com/releases/"; // CDN
269
+                    $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
270
+                }
271
+                $url .= $type == 'CSS' ? 'css/' : 'js/'; // type
272
+                $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
273
+                $url .= "?wpfas=true" . $v; // set our var so our version is not removed
274
+            }
275
+
276
+            return $url;
277
+        }
278
+
279
+        /**
280
+         * Try and remove any other versions of Font Awesome added by other plugins/themes.
281
+         *
282
+         * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version.
283
+         *
284
+         * @param $url
285
+         * @param $original_url
286
+         * @param $_context
287
+         *
288
+         * @return string The filtered url.
289
+         */
290
+        public function remove_font_awesome( $url, $original_url, $_context ) {
291
+
292
+            if ( $_context == 'display'
293
+                 && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
294
+                 && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
295
+            ) {// it's a font-awesome-url (probably)
296
+
297
+                if ( strstr( $url, "wpfas=true" ) !== false ) {
298
+                    if ( $this->settings['type'] == 'JS' ) {
299
+                        if ( $this->settings['js-pseudo'] ) {
300
+                            $url .= "' data-search-pseudo-elements defer='defer";
301
+                        } else {
302
+                            $url .= "' defer='defer";
303
+                        }
304
+                    }
305
+                } else {
306
+                    $url = ''; // removing the url removes the file
307
+                }
308
+
309
+            }
310
+
311
+            return $url;
312
+        }
313
+
314
+        /**
315
+         * Register the database settings with WordPress.
316
+         */
317
+        public function register_settings() {
318
+            register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
319
+        }
320
+
321
+        /**
322
+         * Add the WordPress settings menu item.
323
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
324
+         */
325
+        public function menu_item() {
326
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
327
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
328
+                $this,
329
+                'settings_page'
330
+            ) );
331
+        }
332
+
333
+        /**
334
+         * Get the current Font Awesome output settings.
335
+         *
336
+         * @return array The array of settings.
337
+         */
338
+        public function get_settings() {
339
+            $db_settings = get_option( 'wp-font-awesome-settings' );
340
+
341
+            $defaults = array(
342
+                'type'      => 'CSS', // type to use, CSS or JS or KIT
343
+                'version'   => '', // latest
344
+                'enqueue'   => '', // front and backend
345
+                'shims'     => '0', // default OFF now in 2020
346
+                'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
347
+                'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
348
+                'pro'       => '0', // if pro CDN url should be used
349
+                'local'     => '0', // Store fonts locally.
350
+                'local_version' => '', // Local fonts version.
351
+                'kit-url'   => '', // the kit url
352
+            );
353
+
354
+            $settings = wp_parse_args( $db_settings, $defaults );
355
+
356
+            /**
357
+             * Filter the Font Awesome settings.
358
+             *
359
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
360
+             */
361
+            return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
362
+        }
363
+
364
+        /**
365
+         * The settings page html output.
366
+         */
367
+        public function settings_page() {
368
+            if ( ! current_user_can( 'manage_options' ) ) {
369
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
370
+            }
371
+
372
+            // a hidden way to force the update of the version number via api instead of waiting the 48 hours
373
+            if ( isset( $_REQUEST['force-version-check'] ) ) {
374
+                $this->get_latest_version( $force_api = true );
375
+            }
376
+
377
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
378
+                ?>
379 379
                 <style>
380 380
                     .wpfas-kit-show {
381 381
                         display: none;
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
                     <h1><?php echo $this->name; ?></h1>
402 402
                     <form method="post" action="options.php" class="fas-settings-form">
403 403
 						<?php
404
-						settings_fields( 'wp-font-awesome-settings' );
405
-						do_settings_sections( 'wp-font-awesome-settings' );
406
-						$table_class = '';
407
-						if ( $this->settings['type'] ) {
408
-							$table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
409
-						}
410
-						if ( ! empty( $this->settings['pro'] ) ) {
411
-							$table_class .= ' wpfas-has-pro';
412
-						}
413
-						?>
404
+                        settings_fields( 'wp-font-awesome-settings' );
405
+                        do_settings_sections( 'wp-font-awesome-settings' );
406
+                        $table_class = '';
407
+                        if ( $this->settings['type'] ) {
408
+                            $table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
409
+                        }
410
+                        if ( ! empty( $this->settings['pro'] ) ) {
411
+                            $table_class .= ' wpfas-has-pro';
412
+                        }
413
+                        ?>
414 414
 						<?php if ( $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ) { ?>
415 415
 							<?php if ( $this->has_local() ) { ?>
416 416
 							<div class="notice notice-info"><p><strong><?php _e( 'Font Awesome fonts are loading locally.', 'font-awesome-settings' ); ?></strong></p></div>
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
                                 <td>
436 436
                                     <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
437 437
                                     <span><?php
438
-										echo sprintf(
439
-											__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
440
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
441
-											'</a>'
442
-										);
443
-										?></span>
438
+                                        echo sprintf(
439
+                                            __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
440
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
441
+                                            '</a>'
442
+                                        );
443
+                                        ?></span>
444 444
                                 </td>
445 445
                             </tr>
446 446
 
@@ -481,14 +481,14 @@  discard block
 block discarded – undo
481 481
                                     <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
482 482
                                     <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/>
483 483
                                     <span><?php
484
-										echo wp_sprintf(
485
-											__( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
486
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
487
-											' <i class="fas fa-external-link-alt"></i></a>',
488
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
489
-											' <i class="fas fa-external-link-alt"></i></a>'
490
-										);
491
-										?></span>
484
+                                        echo wp_sprintf(
485
+                                            __( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
486
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
487
+                                            ' <i class="fas fa-external-link-alt"></i></a>',
488
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
489
+                                            ' <i class="fas fa-external-link-alt"></i></a>'
490
+                                        );
491
+                                        ?></span>
492 492
                                 </td>
493 493
                             </tr>
494 494
 
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
                         </table>
543 543
                         <div class="fas-buttons">
544 544
 							<?php
545
-							submit_button();
546
-							?>
545
+                            submit_button();
546
+                            ?>
547 547
                             <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro','font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
548 548
 
549 549
                         </div>
@@ -552,392 +552,392 @@  discard block
 block discarded – undo
552 552
                     <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div>
553 553
                 </div>
554 554
 				<?php
555
-			}
556
-		}
557
-
558
-		/**
559
-		 * Check a version number is valid and if so return it or else return an empty string.
560
-		 *
561
-		 * @param $version string The version number to check.
562
-		 *
563
-		 * @since 1.0.6
564
-		 *
565
-		 * @return string Either a valid version number or an empty string.
566
-		 */
567
-		public function validate_version_number( $version ) {
568
-
569
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
570
-				// valid
571
-			} else {
572
-				$version = '';// not validated
573
-			}
574
-
575
-			return $version;
576
-		}
577
-
578
-
579
-		/**
580
-		 * Get the latest version of Font Awesome.
581
-		 *
582
-		 * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours.
583
-		 *
584
-		 * @since 1.0.7
585
-		 * @return mixed|string The latest version number found.
586
-		 */
587
-		public function get_latest_version( $force_api = false ) {
588
-			$latest_version = $this->latest;
589
-
590
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
591
-
592
-			if ( $cache === false || $force_api ) { // its not set
593
-				$api_ver = $this->get_latest_version_from_api();
594
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
595
-					$latest_version = $api_ver;
596
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
597
-				}
598
-			} elseif ( $this->validate_version_number( $cache ) ) {
599
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
600
-					$latest_version = $cache;
601
-				}
602
-			}
603
-
604
-			// Check and auto download fonts locally.
605
-			if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) {
606
-				if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
607
-					$this->download_package( $latest_version );
608
-				}
609
-			}
610
-
611
-			return $latest_version;
612
-		}
613
-
614
-		/**
615
-		 * Get the latest Font Awesome version from the github API.
616
-		 *
617
-		 * @since 1.0.7
618
-		 * @return string The latest version number or `0` on API fail.
619
-		 */
620
-		public function get_latest_version_from_api() {
621
-			$version  = "0";
622
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
623
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
624
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
625
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
626
-					$version = $api_response['tag_name'];
627
-				}
628
-			}
629
-
630
-			return $version;
631
-		}
632
-
633
-		/**
634
-		 * Inline CSS for RTL language support.
635
-		 *
636
-		 * @since 1.0.13
637
-		 * @return string Inline CSS.
638
-		 */
639
-		public function rtl_inline_css() {
640
-			$inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}';
641
-
642
-			return $inline_css;
643
-		}
644
-
645
-		/**
646
-		 * Show any warnings as an admin notice.
647
-		 *
648
-		 * @return void
649
-		 */
650
-		public function admin_notices() {
651
-			$settings = $this->settings;
652
-
653
-			if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
654
-				if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
655
-					?>
555
+            }
556
+        }
557
+
558
+        /**
559
+         * Check a version number is valid and if so return it or else return an empty string.
560
+         *
561
+         * @param $version string The version number to check.
562
+         *
563
+         * @since 1.0.6
564
+         *
565
+         * @return string Either a valid version number or an empty string.
566
+         */
567
+        public function validate_version_number( $version ) {
568
+
569
+            if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
570
+                // valid
571
+            } else {
572
+                $version = '';// not validated
573
+            }
574
+
575
+            return $version;
576
+        }
577
+
578
+
579
+        /**
580
+         * Get the latest version of Font Awesome.
581
+         *
582
+         * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours.
583
+         *
584
+         * @since 1.0.7
585
+         * @return mixed|string The latest version number found.
586
+         */
587
+        public function get_latest_version( $force_api = false ) {
588
+            $latest_version = $this->latest;
589
+
590
+            $cache = get_transient( 'wp-font-awesome-settings-version' );
591
+
592
+            if ( $cache === false || $force_api ) { // its not set
593
+                $api_ver = $this->get_latest_version_from_api();
594
+                if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
595
+                    $latest_version = $api_ver;
596
+                    set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
597
+                }
598
+            } elseif ( $this->validate_version_number( $cache ) ) {
599
+                if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
600
+                    $latest_version = $cache;
601
+                }
602
+            }
603
+
604
+            // Check and auto download fonts locally.
605
+            if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) {
606
+                if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
607
+                    $this->download_package( $latest_version );
608
+                }
609
+            }
610
+
611
+            return $latest_version;
612
+        }
613
+
614
+        /**
615
+         * Get the latest Font Awesome version from the github API.
616
+         *
617
+         * @since 1.0.7
618
+         * @return string The latest version number or `0` on API fail.
619
+         */
620
+        public function get_latest_version_from_api() {
621
+            $version  = "0";
622
+            $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
623
+            if ( ! is_wp_error( $response ) && is_array( $response ) ) {
624
+                $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
625
+                if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
626
+                    $version = $api_response['tag_name'];
627
+                }
628
+            }
629
+
630
+            return $version;
631
+        }
632
+
633
+        /**
634
+         * Inline CSS for RTL language support.
635
+         *
636
+         * @since 1.0.13
637
+         * @return string Inline CSS.
638
+         */
639
+        public function rtl_inline_css() {
640
+            $inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}';
641
+
642
+            return $inline_css;
643
+        }
644
+
645
+        /**
646
+         * Show any warnings as an admin notice.
647
+         *
648
+         * @return void
649
+         */
650
+        public function admin_notices() {
651
+            $settings = $this->settings;
652
+
653
+            if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
654
+                if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
655
+                    ?>
656 656
                     <div class="notice  notice-error is-dismissible">
657 657
                         <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p>
658 658
                     </div>
659 659
 					<?php
660
-				}
661
-			} else {
662
-				if ( ! empty( $settings ) ) {
663
-					if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
664
-						$link = admin_url('options-general.php?page=wp-font-awesome-settings');
665
-						?>
660
+                }
661
+            } else {
662
+                if ( ! empty( $settings ) ) {
663
+                    if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
664
+                        $link = admin_url('options-general.php?page=wp-font-awesome-settings');
665
+                        ?>
666 666
                         <div class="notice  notice-error is-dismissible">
667 667
                             <p><?php echo sprintf( __( 'Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings' ),"<a href='". esc_url_raw( $link )."'>","</a>" ); ?></p>
668 668
                         </div>
669 669
 						<?php
670
-					}
671
-				}
672
-			}
673
-		}
674
-
675
-		/**
676
-		 * Handle fontawesome add settings to download fontawesome to store locally.
677
-		 *
678
-		 * @since 1.1.1
679
-		 *
680
-		 * @param string $option The option name.
681
-		 * @param mixed  $value  The option value.
682
-		 */
683
-		public function add_option_wp_font_awesome_settings( $option, $value ) {
684
-			// Do nothing if WordPress is being installed.
685
-			if ( wp_installing() ) {
686
-				return;
687
-			}
688
-
689
-			if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) {
690
-				$version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version();
691
-
692
-				if ( ! empty( $version ) ) {
693
-					$response = $this->download_package( $version, $value );
694
-
695
-					if ( is_wp_error( $response ) ) {
696
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
697
-					}
698
-				}
699
-			}
700
-		}
701
-
702
-		/**
703
-		 * Handle fontawesome update settings to download fontawesome to store locally.
704
-		 *
705
-		 * @since 1.1.0
706
-		 *
707
-		 * @param mixed $old_value The old option value.
708
-		 * @param mixed $value     The new option value.
709
-		 */
710
-		public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
711
-			// Do nothing if WordPress is being installed.
712
-			if ( wp_installing() ) {
713
-				return;
714
-			}
715
-
716
-			if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) {
717
-				// Old values
718
-				$old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
719
-				$old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
720
-
721
-				// New values
722
-				$new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
723
-
724
-				if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
725
-					$response = $this->download_package( $new_version, $new_value );
726
-
727
-					if ( is_wp_error( $response ) ) {
728
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
729
-					}
730
-				}
731
-			}
732
-		}
733
-
734
-		/**
735
-		 * Get the fonts directory local path.
736
-		 *
737
-		 * @since 1.1.0
738
-		 *
739
-		 * @param string Fonts directory local path.
740
-		 */
741
-		public function get_fonts_dir() {
742
-			$upload_dir = wp_upload_dir( null, false );
743
-
744
-			return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
745
-		}
746
-
747
-		/**
748
-		 * Get the fonts directory local url.
749
-		 *
750
-		 * @since 1.1.0
751
-		 *
752
-		 * @param string Fonts directory local url.
753
-		 */
754
-		public function get_fonts_url() {
755
-			$upload_dir = wp_upload_dir( null, false );
756
-
757
-			return $upload_dir['baseurl'] .  '/ayefonts/fa/';
758
-		}
759
-
760
-		/**
761
-		 * Check whether load locally active.
762
-		 *
763
-		 * @since 1.1.0
764
-		 *
765
-		 * @return bool True if active else false.
766
-		 */
767
-		public function has_local() {
768
-			if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
769
-				return true;
770
-			}
771
-
772
-			return false;
773
-		}
774
-
775
-		/**
776
-		 * Get the WP Filesystem access.
777
-		 *
778
-		 * @since 1.1.0
779
-		 *
780
-		 * @return object The WP Filesystem.
781
-		 */
782
-		public function get_wp_filesystem() {
783
-			if ( ! function_exists( 'get_filesystem_method' ) ) {
784
-				require_once( ABSPATH . "/wp-admin/includes/file.php" );
785
-			}
786
-
787
-			$access_type = get_filesystem_method();
788
-
789
-			if ( $access_type === 'direct' ) {
790
-				/* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
791
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
792
-
793
-				/* Initialize the API */
794
-				if ( ! WP_Filesystem( $creds ) ) {
795
-					/* Any problems and we exit */
796
-					return false;
797
-				}
798
-
799
-				global $wp_filesystem;
800
-
801
-				return $wp_filesystem;
802
-				/* Do our file manipulations below */
803
-			} else if ( defined( 'FTP_USER' ) ) {
804
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
805
-
806
-				/* Initialize the API */
807
-				if ( ! WP_Filesystem( $creds ) ) {
808
-					/* Any problems and we exit */
809
-					return false;
810
-				}
811
-
812
-				global $wp_filesystem;
813
-
814
-				return $wp_filesystem;
815
-			} else {
816
-				/* Don't have direct write access. Prompt user with our notice */
817
-				return false;
818
-			}
819
-		}
820
-
821
-		/**
822
-		 * Download the fontawesome package file.
823
-		 *
824
-		 * @since 1.1.0
825
-		 *
826
-		 * @param mixed $version The font awesome.
827
-		 * @param array $option Fontawesome settings.
828
-		 * @return WP_ERROR|bool Error on fail and true on success.
829
-		 */
830
-		public function download_package( $version, $option = array() ) {
831
-			$filename = 'fontawesome-free-' . $version . '-web';
832
-			$url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
833
-
834
-			if ( ! function_exists( 'wp_handle_upload' ) ) {
835
-				require_once ABSPATH . 'wp-admin/includes/file.php';
836
-			}
837
-
838
-			$download_file = download_url( esc_url_raw( $url ) );
839
-
840
-			if ( is_wp_error( $download_file ) ) {
841
-				return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
842
-			} else if ( empty( $download_file ) ) {
843
-				return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
844
-			}
845
-
846
-			$response = $this->extract_package( $download_file, $filename, true );
847
-
848
-			// Update local version.
849
-			if ( is_wp_error( $response ) ) {
850
-				return $response;
851
-			} else if ( $response ) {
852
-				if ( empty( $option ) ) {
853
-					$option = get_option( 'wp-font-awesome-settings' );
854
-				}
855
-
856
-				$option['local_version'] = $version;
857
-
858
-				// Remove action to prevent looping.
859
-				remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
860
-
861
-				update_option( 'wp-font-awesome-settings', $option );
862
-
863
-				return true;
864
-			}
865
-
866
-			return false;
867
-		}
868
-
869
-		/**
870
-		 * Extract the fontawesome package file.
871
-		 *
872
-		 * @since 1.1.0
873
-		 *
874
-		 * @param string $package The package file path.
875
-		 * @param string $dirname Package file name.
876
-		 * @param bool   $delete_package Delete temp file or not.
877
-		 * @return WP_Error|bool True on success WP_Error on fail.
878
-		 */
879
-		public function extract_package( $package, $dirname = '', $delete_package = false ) {
880
-			global $wp_filesystem;
881
-
882
-			$wp_filesystem = $this->get_wp_filesystem();
883
-
884
-			if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
885
-				return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
886
-			} else if ( empty( $wp_filesystem ) ) {
887
-				return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
888
-			}
889
-
890
-			$fonts_dir = $this->get_fonts_dir();
891
-			$fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
892
-
893
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
894
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
895
-			}
896
-
897
-			// Unzip package to working directory.
898
-			$result = unzip_file( $package, $fonts_tmp_dir );
899
-
900
-			if ( is_wp_error( $result ) ) {
901
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
902
-
903
-				if ( 'incompatible_archive' === $result->get_error_code() ) {
904
-					return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
905
-				}
906
-
907
-				return $result;
908
-			}
909
-
910
-			if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
911
-				$wp_filesystem->delete( $fonts_dir, true );
912
-			}
913
-
914
-			$extract_dir = $fonts_tmp_dir;
915
-
916
-			if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
917
-				$extract_dir .= $dirname . DIRECTORY_SEPARATOR;
918
-			}
919
-
920
-			try {
921
-				$return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
922
-			} catch ( Exception $e ) {
923
-				$return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
924
-			}
925
-
926
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
927
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
928
-			}
929
-
930
-			// Once extracted, delete the package if required.
931
-			if ( $delete_package ) {
932
-				unlink( $package );
933
-			}
934
-
935
-			return $return;
936
-		}
937
-	}
938
-
939
-	/**
940
-	 * Run the class if found.
941
-	 */
942
-	WP_Font_Awesome_Settings::instance();
670
+                    }
671
+                }
672
+            }
673
+        }
674
+
675
+        /**
676
+         * Handle fontawesome add settings to download fontawesome to store locally.
677
+         *
678
+         * @since 1.1.1
679
+         *
680
+         * @param string $option The option name.
681
+         * @param mixed  $value  The option value.
682
+         */
683
+        public function add_option_wp_font_awesome_settings( $option, $value ) {
684
+            // Do nothing if WordPress is being installed.
685
+            if ( wp_installing() ) {
686
+                return;
687
+            }
688
+
689
+            if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) {
690
+                $version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version();
691
+
692
+                if ( ! empty( $version ) ) {
693
+                    $response = $this->download_package( $version, $value );
694
+
695
+                    if ( is_wp_error( $response ) ) {
696
+                        add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
697
+                    }
698
+                }
699
+            }
700
+        }
701
+
702
+        /**
703
+         * Handle fontawesome update settings to download fontawesome to store locally.
704
+         *
705
+         * @since 1.1.0
706
+         *
707
+         * @param mixed $old_value The old option value.
708
+         * @param mixed $value     The new option value.
709
+         */
710
+        public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
711
+            // Do nothing if WordPress is being installed.
712
+            if ( wp_installing() ) {
713
+                return;
714
+            }
715
+
716
+            if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) {
717
+                // Old values
718
+                $old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
719
+                $old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
720
+
721
+                // New values
722
+                $new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
723
+
724
+                if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
725
+                    $response = $this->download_package( $new_version, $new_value );
726
+
727
+                    if ( is_wp_error( $response ) ) {
728
+                        add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
729
+                    }
730
+                }
731
+            }
732
+        }
733
+
734
+        /**
735
+         * Get the fonts directory local path.
736
+         *
737
+         * @since 1.1.0
738
+         *
739
+         * @param string Fonts directory local path.
740
+         */
741
+        public function get_fonts_dir() {
742
+            $upload_dir = wp_upload_dir( null, false );
743
+
744
+            return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
745
+        }
746
+
747
+        /**
748
+         * Get the fonts directory local url.
749
+         *
750
+         * @since 1.1.0
751
+         *
752
+         * @param string Fonts directory local url.
753
+         */
754
+        public function get_fonts_url() {
755
+            $upload_dir = wp_upload_dir( null, false );
756
+
757
+            return $upload_dir['baseurl'] .  '/ayefonts/fa/';
758
+        }
759
+
760
+        /**
761
+         * Check whether load locally active.
762
+         *
763
+         * @since 1.1.0
764
+         *
765
+         * @return bool True if active else false.
766
+         */
767
+        public function has_local() {
768
+            if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
769
+                return true;
770
+            }
771
+
772
+            return false;
773
+        }
774
+
775
+        /**
776
+         * Get the WP Filesystem access.
777
+         *
778
+         * @since 1.1.0
779
+         *
780
+         * @return object The WP Filesystem.
781
+         */
782
+        public function get_wp_filesystem() {
783
+            if ( ! function_exists( 'get_filesystem_method' ) ) {
784
+                require_once( ABSPATH . "/wp-admin/includes/file.php" );
785
+            }
786
+
787
+            $access_type = get_filesystem_method();
788
+
789
+            if ( $access_type === 'direct' ) {
790
+                /* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
791
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
792
+
793
+                /* Initialize the API */
794
+                if ( ! WP_Filesystem( $creds ) ) {
795
+                    /* Any problems and we exit */
796
+                    return false;
797
+                }
798
+
799
+                global $wp_filesystem;
800
+
801
+                return $wp_filesystem;
802
+                /* Do our file manipulations below */
803
+            } else if ( defined( 'FTP_USER' ) ) {
804
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
805
+
806
+                /* Initialize the API */
807
+                if ( ! WP_Filesystem( $creds ) ) {
808
+                    /* Any problems and we exit */
809
+                    return false;
810
+                }
811
+
812
+                global $wp_filesystem;
813
+
814
+                return $wp_filesystem;
815
+            } else {
816
+                /* Don't have direct write access. Prompt user with our notice */
817
+                return false;
818
+            }
819
+        }
820
+
821
+        /**
822
+         * Download the fontawesome package file.
823
+         *
824
+         * @since 1.1.0
825
+         *
826
+         * @param mixed $version The font awesome.
827
+         * @param array $option Fontawesome settings.
828
+         * @return WP_ERROR|bool Error on fail and true on success.
829
+         */
830
+        public function download_package( $version, $option = array() ) {
831
+            $filename = 'fontawesome-free-' . $version . '-web';
832
+            $url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
833
+
834
+            if ( ! function_exists( 'wp_handle_upload' ) ) {
835
+                require_once ABSPATH . 'wp-admin/includes/file.php';
836
+            }
837
+
838
+            $download_file = download_url( esc_url_raw( $url ) );
839
+
840
+            if ( is_wp_error( $download_file ) ) {
841
+                return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
842
+            } else if ( empty( $download_file ) ) {
843
+                return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
844
+            }
845
+
846
+            $response = $this->extract_package( $download_file, $filename, true );
847
+
848
+            // Update local version.
849
+            if ( is_wp_error( $response ) ) {
850
+                return $response;
851
+            } else if ( $response ) {
852
+                if ( empty( $option ) ) {
853
+                    $option = get_option( 'wp-font-awesome-settings' );
854
+                }
855
+
856
+                $option['local_version'] = $version;
857
+
858
+                // Remove action to prevent looping.
859
+                remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
860
+
861
+                update_option( 'wp-font-awesome-settings', $option );
862
+
863
+                return true;
864
+            }
865
+
866
+            return false;
867
+        }
868
+
869
+        /**
870
+         * Extract the fontawesome package file.
871
+         *
872
+         * @since 1.1.0
873
+         *
874
+         * @param string $package The package file path.
875
+         * @param string $dirname Package file name.
876
+         * @param bool   $delete_package Delete temp file or not.
877
+         * @return WP_Error|bool True on success WP_Error on fail.
878
+         */
879
+        public function extract_package( $package, $dirname = '', $delete_package = false ) {
880
+            global $wp_filesystem;
881
+
882
+            $wp_filesystem = $this->get_wp_filesystem();
883
+
884
+            if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
885
+                return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
886
+            } else if ( empty( $wp_filesystem ) ) {
887
+                return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
888
+            }
889
+
890
+            $fonts_dir = $this->get_fonts_dir();
891
+            $fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
892
+
893
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
894
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
895
+            }
896
+
897
+            // Unzip package to working directory.
898
+            $result = unzip_file( $package, $fonts_tmp_dir );
899
+
900
+            if ( is_wp_error( $result ) ) {
901
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
902
+
903
+                if ( 'incompatible_archive' === $result->get_error_code() ) {
904
+                    return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
905
+                }
906
+
907
+                return $result;
908
+            }
909
+
910
+            if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
911
+                $wp_filesystem->delete( $fonts_dir, true );
912
+            }
913
+
914
+            $extract_dir = $fonts_tmp_dir;
915
+
916
+            if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
917
+                $extract_dir .= $dirname . DIRECTORY_SEPARATOR;
918
+            }
919
+
920
+            try {
921
+                $return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
922
+            } catch ( Exception $e ) {
923
+                $return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
924
+            }
925
+
926
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
927
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
928
+            }
929
+
930
+            // Once extracted, delete the package if required.
931
+            if ( $delete_package ) {
932
+                unlink( $package );
933
+            }
934
+
935
+            return $return;
936
+        }
937
+    }
938
+
939
+    /**
940
+     * Run the class if found.
941
+     */
942
+    WP_Font_Awesome_Settings::instance();
943 943
 }
Please login to merge, or discard this patch.
Spacing   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
22
+if (!class_exists('WP_Font_Awesome_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
 		 * @return WP_Font_Awesome_Settings - Main instance.
93 93
 		 */
94 94
 		public static function instance() {
95
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
95
+			if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) {
96 96
 				self::$instance = new WP_Font_Awesome_Settings;
97 97
 
98
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
98
+				add_action('init', array(self::$instance, 'init')); // set settings
99 99
 
100
-				if ( is_admin() ) {
101
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
102
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
103
-					add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
100
+				if (is_admin()) {
101
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
102
+					add_action('admin_init', array(self::$instance, 'register_settings'));
103
+					add_action('admin_notices', array(self::$instance, 'admin_notices'));
104 104
 				}
105 105
 
106
-				do_action( 'wp_font_awesome_settings_loaded' );
106
+				do_action('wp_font_awesome_settings_loaded');
107 107
 			}
108 108
 
109 109
 			return self::$instance;
@@ -116,40 +116,40 @@  discard block
 block discarded – undo
116 116
 		 */
117 117
 		public function init() {
118 118
 			// Download fontawesome locally.
119
-			add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 );
120
-			add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
119
+			add_action('add_option_wp-font-awesome-settings', array($this, 'add_option_wp_font_awesome_settings'), 10, 2);
120
+			add_action('update_option_wp-font-awesome-settings', array($this, 'update_option_wp_font_awesome_settings'), 10, 2);
121 121
 
122 122
 			$this->settings = $this->get_settings();
123 123
 
124 124
 			// check if the official plugin is active and use that instead if so.
125
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
125
+			if (!defined('FONTAWESOME_PLUGIN_FILE')) {
126 126
 
127
-				if ( $this->settings['type'] == 'CSS' ) {
127
+				if ($this->settings['type'] == 'CSS') {
128 128
 
129
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
130
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
129
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
130
+						add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000);
131 131
 					}
132 132
 
133
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
134
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
135
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
133
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
134
+						add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000);
135
+						add_filter('block_editor_settings_all', array($this, 'enqueue_editor_styles'), 10, 2);
136 136
 					}
137 137
 
138 138
 				} else {
139 139
 
140
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
141
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
140
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
141
+						add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
142 142
 					}
143 143
 
144
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
145
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
146
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
144
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
145
+						add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
146
+						add_filter('block_editor_settings_all', array($this, 'enqueue_editor_scripts'), 10, 2);
147 147
 					}
148 148
 				}
149 149
 
150 150
 				// remove font awesome if set to do so
151
-				if ( $this->settings['dequeue'] == '1' ) {
152
-					add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
151
+				if ($this->settings['dequeue'] == '1') {
152
+					add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3);
153 153
 				}
154 154
 			}
155 155
 
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		 *
164 164
 		 * @return array
165 165
 		 */
166
-		public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
166
+		public function enqueue_editor_styles($editor_settings, $block_editor_context) {
167 167
 
168
-			if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
168
+			if (!empty($editor_settings['__unstableResolvedAssets']['styles'])) {
169 169
 				$url = $this->get_url();
170 170
 				$editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
171 171
 			}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		 *
182 182
 		 * @return array
183 183
 		 */
184
-		public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
184
+		public function enqueue_editor_scripts($editor_settings, $block_editor_context) {
185 185
 
186 186
 			$url = $this->get_url();
187 187
 			$editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
@@ -195,22 +195,22 @@  discard block
 block discarded – undo
195 195
 		public function enqueue_style() {
196 196
 			// build url
197 197
 			$url = $this->get_url();
198
-			$version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
198
+			$version = !empty($this->settings['local']) && empty($this->settings['pro']) ? strip_tags($this->settings['local_version']) : null;
199 199
 
200
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
201
-			wp_register_style( 'font-awesome', $url, array(), $version );
202
-			wp_enqueue_style( 'font-awesome' );
200
+			wp_deregister_style('font-awesome'); // deregister in case its already there
201
+			wp_register_style('font-awesome', $url, array(), $version);
202
+			wp_enqueue_style('font-awesome');
203 203
 
204 204
 			// RTL language support CSS.
205
-			if ( is_rtl() ) {
206
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
205
+			if (is_rtl()) {
206
+				wp_add_inline_style('font-awesome', $this->rtl_inline_css());
207 207
 			}
208 208
 
209
-			if ( $this->settings['shims'] ) {
210
-				$url = $this->get_url( true );
211
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
212
-				wp_register_style( 'font-awesome-shims', $url, array(), $version );
213
-				wp_enqueue_style( 'font-awesome-shims' );
209
+			if ($this->settings['shims']) {
210
+				$url = $this->get_url(true);
211
+				wp_deregister_style('font-awesome-shims'); // deregister in case its already there
212
+				wp_register_style('font-awesome-shims', $url, array(), $version);
213
+				wp_enqueue_style('font-awesome-shims');
214 214
 			}
215 215
 		}
216 216
 
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 			$url = $this->get_url();
223 223
 
224 224
 			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
225
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
226
-			wp_register_script( 'font-awesome', $url, array(), null );
227
-			wp_enqueue_script( 'font-awesome' );
225
+			call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there
226
+			wp_register_script('font-awesome', $url, array(), null);
227
+			wp_enqueue_script('font-awesome');
228 228
 
229
-			if ( $this->settings['shims'] ) {
230
-				$url = $this->get_url( true );
231
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
232
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
233
-				wp_enqueue_script( 'font-awesome-shims' );
229
+			if ($this->settings['shims']) {
230
+				$url = $this->get_url(true);
231
+				call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there
232
+				wp_register_script('font-awesome-shims', $url, array(), null);
233
+				wp_enqueue_script('font-awesome-shims');
234 234
 			}
235 235
 		}
236 236
 
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
 		 *
243 243
 		 * @return string The url to the file.
244 244
 		 */
245
-		public function get_url( $shims = false, $local = true ) {
245
+		public function get_url($shims = false, $local = true) {
246 246
 			$script  = $shims ? 'v4-shims' : 'all';
247 247
 			$sub     = $this->settings['pro'] ? 'pro' : 'use';
248 248
 			$type    = $this->settings['type'];
249 249
 			$version = $this->settings['version'];
250
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
250
+			$kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : '';
251 251
 			$url     = '';
252 252
 
253
-			if ( $type == 'KIT' && $kit_url ) {
254
-				if ( $shims ) {
253
+			if ($type == 'KIT' && $kit_url) {
254
+				if ($shims) {
255 255
 					// if its a kit then we don't add shims here
256 256
 					return '';
257 257
 				}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 			} else {
261 261
 				$v = '';
262 262
 				// Check and load locally.
263
-				if ( $local && $this->has_local() ) {
263
+				if ($local && $this->has_local()) {
264 264
 					$script .= ".min";
265
-					$v .= '&ver=' . strip_tags( $this->settings['local_version'] );
265
+					$v .= '&ver=' . strip_tags($this->settings['local_version']);
266 266
 					$url .= $this->get_fonts_url(); // Local fonts url.
267 267
 				} else {
268 268
 					$url .= "https://$sub.fontawesome.com/releases/"; // CDN
269
-					$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
269
+					$url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
270 270
 				}
271 271
 				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
272 272
 				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
@@ -287,16 +287,16 @@  discard block
 block discarded – undo
287 287
 		 *
288 288
 		 * @return string The filtered url.
289 289
 		 */
290
-		public function remove_font_awesome( $url, $original_url, $_context ) {
290
+		public function remove_font_awesome($url, $original_url, $_context) {
291 291
 
292
-			if ( $_context == 'display'
293
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
294
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
292
+			if ($_context == 'display'
293
+			     && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false)
294
+			     && (strstr($url, ".js") !== false || strstr($url, ".css") !== false)
295 295
 			) {// it's a font-awesome-url (probably)
296 296
 
297
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
298
-					if ( $this->settings['type'] == 'JS' ) {
299
-						if ( $this->settings['js-pseudo'] ) {
297
+				if (strstr($url, "wpfas=true") !== false) {
298
+					if ($this->settings['type'] == 'JS') {
299
+						if ($this->settings['js-pseudo']) {
300 300
 							$url .= "' data-search-pseudo-elements defer='defer";
301 301
 						} else {
302 302
 							$url .= "' defer='defer";
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		 * Register the database settings with WordPress.
316 316
 		 */
317 317
 		public function register_settings() {
318
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
318
+			register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings');
319 319
 		}
320 320
 
321 321
 		/**
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 		 */
325 325
 		public function menu_item() {
326 326
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
327
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
327
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
328 328
 				$this,
329 329
 				'settings_page'
330
-			) );
330
+			));
331 331
 		}
332 332
 
333 333
 		/**
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		 * @return array The array of settings.
337 337
 		 */
338 338
 		public function get_settings() {
339
-			$db_settings = get_option( 'wp-font-awesome-settings' );
339
+			$db_settings = get_option('wp-font-awesome-settings');
340 340
 
341 341
 			$defaults = array(
342 342
 				'type'      => 'CSS', // type to use, CSS or JS or KIT
@@ -351,30 +351,30 @@  discard block
 block discarded – undo
351 351
 				'kit-url'   => '', // the kit url
352 352
 			);
353 353
 
354
-			$settings = wp_parse_args( $db_settings, $defaults );
354
+			$settings = wp_parse_args($db_settings, $defaults);
355 355
 
356 356
 			/**
357 357
 			 * Filter the Font Awesome settings.
358 358
 			 *
359 359
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
360 360
 			 */
361
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
361
+			return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults);
362 362
 		}
363 363
 
364 364
 		/**
365 365
 		 * The settings page html output.
366 366
 		 */
367 367
 		public function settings_page() {
368
-			if ( ! current_user_can( 'manage_options' ) ) {
369
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
368
+			if (!current_user_can('manage_options')) {
369
+				wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings'));
370 370
 			}
371 371
 
372 372
 			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
373
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
374
-				$this->get_latest_version( $force_api = true );
373
+			if (isset($_REQUEST['force-version-check'])) {
374
+				$this->get_latest_version($force_api = true);
375 375
 			}
376 376
 
377
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
377
+			if (!defined('FONTAWESOME_PLUGIN_FILE')) {
378 378
 				?>
379 379
                 <style>
380 380
                     .wpfas-kit-show {
@@ -401,42 +401,42 @@  discard block
 block discarded – undo
401 401
                     <h1><?php echo $this->name; ?></h1>
402 402
                     <form method="post" action="options.php" class="fas-settings-form">
403 403
 						<?php
404
-						settings_fields( 'wp-font-awesome-settings' );
405
-						do_settings_sections( 'wp-font-awesome-settings' );
404
+						settings_fields('wp-font-awesome-settings');
405
+						do_settings_sections('wp-font-awesome-settings');
406 406
 						$table_class = '';
407
-						if ( $this->settings['type'] ) {
408
-							$table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
407
+						if ($this->settings['type']) {
408
+							$table_class .= 'wpfas-' . sanitize_html_class(strtolower($this->settings['type'])) . '-set';
409 409
 						}
410
-						if ( ! empty( $this->settings['pro'] ) ) {
410
+						if (!empty($this->settings['pro'])) {
411 411
 							$table_class .= ' wpfas-has-pro';
412 412
 						}
413 413
 						?>
414
-						<?php if ( $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ) { ?>
415
-							<?php if ( $this->has_local() ) { ?>
416
-							<div class="notice notice-info"><p><strong><?php _e( 'Font Awesome fonts are loading locally.', 'font-awesome-settings' ); ?></strong></p></div>
414
+						<?php if ($this->settings['type'] != 'KIT' && !empty($this->settings['local']) && empty($this->settings['pro'])) { ?>
415
+							<?php if ($this->has_local()) { ?>
416
+							<div class="notice notice-info"><p><strong><?php _e('Font Awesome fonts are loading locally.', 'font-awesome-settings'); ?></strong></p></div>
417 417
 							<?php } else { ?>
418
-							<div class="notice notice-error"><p><strong><?php _e( 'Font Awesome fonts are not loading locally!', 'font-awesome-settings' ); ?></strong></p></div>
418
+							<div class="notice notice-error"><p><strong><?php _e('Font Awesome fonts are not loading locally!', 'font-awesome-settings'); ?></strong></p></div>
419 419
 							<?php } ?>
420 420
 						<?php } ?>
421
-                        <table class="form-table wpfas-table-settings <?php echo esc_attr( $table_class ); ?>">
421
+                        <table class="form-table wpfas-table-settings <?php echo esc_attr($table_class); ?>">
422 422
                             <tr valign="top">
423
-                                <th scope="row"><label for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th>
423
+                                <th scope="row"><label for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th>
424 424
                                 <td>
425 425
                                     <select name="wp-font-awesome-settings[type]" id="wpfas-type" onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}">
426
-                                        <option value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option>
427
-                                        <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option>
428
-                                        <option value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option>
426
+                                        <option value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option>
427
+                                        <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option>
428
+                                        <option value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option>
429 429
                                     </select>
430 430
                                 </td>
431 431
                             </tr>
432 432
 
433 433
                             <tr valign="top" class="wpfas-kit-show">
434
-                                <th scope="row"><label for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th>
434
+                                <th scope="row"><label for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th>
435 435
                                 <td>
436
-                                    <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
436
+                                    <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr($this->settings['kit-url']); ?>" placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
437 437
                                     <span><?php
438 438
 										echo sprintf(
439
-											__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
439
+											__('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'),
440 440
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
441 441
 											'</a>'
442 442
 										);
@@ -445,44 +445,44 @@  discard block
 block discarded – undo
445 445
                             </tr>
446 446
 
447 447
                             <tr valign="top" class="wpfas-kit-hide">
448
-                                <th scope="row"><label for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th>
448
+                                <th scope="row"><label for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th>
449 449
                                 <td>
450 450
                                     <select name="wp-font-awesome-settings[version]" id="wpfas-version">
451
-                                        <option value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?></option>
452
-                                        <option value="6.1.0" <?php selected( $this->settings['version'], '6.1.0' ); ?>>6.1.0</option>
453
-                                        <option value="6.0.0" <?php selected( $this->settings['version'], '6.0.0' ); ?>>6.0.0</option>
454
-                                        <option value="5.15.4" <?php selected( $this->settings['version'], '5.15.4' ); ?>>5.15.4</option>
455
-                                        <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>5.6.0</option>
456
-                                        <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>5.5.0</option>
457
-                                        <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>5.4.0</option>
458
-                                        <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>5.3.0</option>
459
-                                        <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>5.2.0</option>
460
-                                        <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>5.1.0</option>
461
-                                        <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>4.7.1 (CSS only)</option>
451
+                                        <option value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?></option>
452
+                                        <option value="6.1.0" <?php selected($this->settings['version'], '6.1.0'); ?>>6.1.0</option>
453
+                                        <option value="6.0.0" <?php selected($this->settings['version'], '6.0.0'); ?>>6.0.0</option>
454
+                                        <option value="5.15.4" <?php selected($this->settings['version'], '5.15.4'); ?>>5.15.4</option>
455
+                                        <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>5.6.0</option>
456
+                                        <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>5.5.0</option>
457
+                                        <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>5.4.0</option>
458
+                                        <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>5.3.0</option>
459
+                                        <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>5.2.0</option>
460
+                                        <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>5.1.0</option>
461
+                                        <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>4.7.1 (CSS only)</option>
462 462
                                     </select>
463 463
                                 </td>
464 464
                             </tr>
465 465
 
466 466
                             <tr valign="top">
467
-                                <th scope="row"><label for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th>
467
+                                <th scope="row"><label for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th>
468 468
                                 <td>
469 469
                                     <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue">
470
-                                        <option value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option>
471
-                                        <option value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option>
472
-                                        <option value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option>
470
+                                        <option value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option>
471
+                                        <option value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option>
472
+                                        <option value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option>
473 473
                                     </select>
474 474
                                 </td>
475 475
                             </tr>
476 476
 
477 477
                             <tr valign="top" class="wpfas-kit-hide">
478 478
                                 <th scope="row"><label
479
-                                            for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th>
479
+                                            for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th>
480 480
                                 <td>
481 481
                                     <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
482
-                                    <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/>
482
+                                    <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/>
483 483
                                     <span><?php
484 484
 										echo wp_sprintf(
485
-											__( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
485
+											__('Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings'),
486 486
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
487 487
 											' <i class="fas fa-external-link-alt"></i></a>',
488 488
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
@@ -493,49 +493,49 @@  discard block
 block discarded – undo
493 493
                             </tr>
494 494
 
495 495
 							<tr valign="top" class="wpfas-kit-hide wpfas-hide-pro">
496
-								<th scope="row"><label for="wpfas-local"><?php _e( 'Load Fonts Locally', 'font-awesome-settings' ); ?></label></th>
496
+								<th scope="row"><label for="wpfas-local"><?php _e('Load Fonts Locally', 'font-awesome-settings'); ?></label></th>
497 497
 								<td>
498 498
 									<input type="hidden" name="wp-font-awesome-settings[local]" value="0"/>
499
-									<input type="hidden" name="wp-font-awesome-settings[local_version]" value="<?php echo esc_attr( $this->settings['local_version'] ); ?>"/>
500
-									<input type="checkbox" name="wp-font-awesome-settings[local]" value="1" <?php checked( $this->settings['local'], '1' ); ?> id="wpfas-local"/>
501
-									<span><?php _e( '(For free version only) Load FontAwesome fonts from locally. This downloads FontAwesome fonts from fontawesome.com & stores at the local site.', 'font-awesome-settings' ); ?></span>
499
+									<input type="hidden" name="wp-font-awesome-settings[local_version]" value="<?php echo esc_attr($this->settings['local_version']); ?>"/>
500
+									<input type="checkbox" name="wp-font-awesome-settings[local]" value="1" <?php checked($this->settings['local'], '1'); ?> id="wpfas-local"/>
501
+									<span><?php _e('(For free version only) Load FontAwesome fonts from locally. This downloads FontAwesome fonts from fontawesome.com & stores at the local site.', 'font-awesome-settings'); ?></span>
502 502
 								</td>
503 503
 							</tr>
504 504
 
505 505
                             <tr valign="top" class="wpfas-kit-hide">
506 506
                                 <th scope="row"><label
507
-                                            for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label>
507
+                                            for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label>
508 508
                                 </th>
509 509
                                 <td>
510 510
                                     <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/>
511 511
                                     <input type="checkbox" name="wp-font-awesome-settings[shims]"
512
-                                           value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/>
513
-                                    <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span>
512
+                                           value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/>
513
+                                    <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span>
514 514
                                 </td>
515 515
                             </tr>
516 516
 
517 517
                             <tr valign="top" class="wpfas-kit-hide">
518 518
                                 <th scope="row"><label
519
-                                            for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label>
519
+                                            for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label>
520 520
                                 </th>
521 521
                                 <td>
522 522
                                     <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/>
523 523
                                     <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]"
524
-                                           value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?>
524
+                                           value="1" <?php checked($this->settings['js-pseudo'], '1'); ?>
525 525
                                            id="wpfas-js-pseudo"/>
526
-                                    <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span>
526
+                                    <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span>
527 527
                                 </td>
528 528
                             </tr>
529 529
 
530 530
                             <tr valign="top">
531 531
                                 <th scope="row"><label
532
-                                            for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th>
532
+                                            for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th>
533 533
                                 <td>
534 534
                                     <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/>
535 535
                                     <input type="checkbox" name="wp-font-awesome-settings[dequeue]"
536
-                                           value="1" <?php checked( $this->settings['dequeue'], '1' ); ?>
536
+                                           value="1" <?php checked($this->settings['dequeue'], '1'); ?>
537 537
                                            id="wpfas-dequeue"/>
538
-                                    <span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings' ); ?></span>
538
+                                    <span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings'); ?></span>
539 539
                                 </td>
540 540
                             </tr>
541 541
 
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
 							<?php
545 545
 							submit_button();
546 546
 							?>
547
-                            <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro','font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
547
+                            <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro', 'font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
548 548
 
549 549
                         </div>
550 550
                     </form>
551 551
 
552
-                    <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div>
552
+                    <div id="wpfas-version"><?php echo sprintf(__('Version: %s (affiliate links provided)', 'font-awesome-settings'), $this->version); ?></div>
553 553
                 </div>
554 554
 				<?php
555 555
 			}
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @return string Either a valid version number or an empty string.
566 566
 		 */
567
-		public function validate_version_number( $version ) {
567
+		public function validate_version_number($version) {
568 568
 
569
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
569
+			if (version_compare($version, '0.0.1', '>=') >= 0) {
570 570
 				// valid
571 571
 			} else {
572
-				$version = '';// not validated
572
+				$version = ''; // not validated
573 573
 			}
574 574
 
575 575
 			return $version;
@@ -584,27 +584,27 @@  discard block
 block discarded – undo
584 584
 		 * @since 1.0.7
585 585
 		 * @return mixed|string The latest version number found.
586 586
 		 */
587
-		public function get_latest_version( $force_api = false ) {
587
+		public function get_latest_version($force_api = false) {
588 588
 			$latest_version = $this->latest;
589 589
 
590
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
590
+			$cache = get_transient('wp-font-awesome-settings-version');
591 591
 
592
-			if ( $cache === false || $force_api ) { // its not set
592
+			if ($cache === false || $force_api) { // its not set
593 593
 				$api_ver = $this->get_latest_version_from_api();
594
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
594
+				if (version_compare($api_ver, $this->latest, '>=') >= 0) {
595 595
 					$latest_version = $api_ver;
596
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
596
+					set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS);
597 597
 				}
598
-			} elseif ( $this->validate_version_number( $cache ) ) {
599
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
598
+			} elseif ($this->validate_version_number($cache)) {
599
+				if (version_compare($cache, $this->latest, '>=') >= 0) {
600 600
 					$latest_version = $cache;
601 601
 				}
602 602
 			}
603 603
 
604 604
 			// Check and auto download fonts locally.
605
-			if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) {
606
-				if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
607
-					$this->download_package( $latest_version );
605
+			if (empty($this->settings['pro']) && empty($this->settings['version']) && $this->settings['type'] != 'KIT' && !empty($this->settings['local']) && !empty($this->settings['local_version']) && !empty($latest_version)) {
606
+				if (version_compare($latest_version, $this->settings['local_version'], '>') && is_admin() && !wp_doing_ajax()) {
607
+					$this->download_package($latest_version);
608 608
 				}
609 609
 			}
610 610
 
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 		 */
620 620
 		public function get_latest_version_from_api() {
621 621
 			$version  = "0";
622
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
623
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
624
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
625
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
622
+			$response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest");
623
+			if (!is_wp_error($response) && is_array($response)) {
624
+				$api_response = json_decode(wp_remote_retrieve_body($response), true);
625
+				if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) {
626 626
 					$version = $api_response['tag_name'];
627 627
 				}
628 628
 			}
@@ -650,21 +650,21 @@  discard block
 block discarded – undo
650 650
 		public function admin_notices() {
651 651
 			$settings = $this->settings;
652 652
 
653
-			if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
654
-				if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
653
+			if (defined('FONTAWESOME_PLUGIN_FILE')) {
654
+				if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-font-awesome-settings') {
655 655
 					?>
656 656
                     <div class="notice  notice-error is-dismissible">
657
-                        <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p>
657
+                        <p><?php _e('The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings'); ?></p>
658 658
                     </div>
659 659
 					<?php
660 660
 				}
661 661
 			} else {
662
-				if ( ! empty( $settings ) ) {
663
-					if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
662
+				if (!empty($settings)) {
663
+					if ($settings['type'] != 'KIT' && $settings['pro'] && ($settings['version'] == '' || version_compare($settings['version'], '6', '>='))) {
664 664
 						$link = admin_url('options-general.php?page=wp-font-awesome-settings');
665 665
 						?>
666 666
                         <div class="notice  notice-error is-dismissible">
667
-                            <p><?php echo sprintf( __( 'Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings' ),"<a href='". esc_url_raw( $link )."'>","</a>" ); ?></p>
667
+                            <p><?php echo sprintf(__('Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings'), "<a href='" . esc_url_raw($link) . "'>", "</a>"); ?></p>
668 668
                         </div>
669 669
 						<?php
670 670
 					}
@@ -680,20 +680,20 @@  discard block
 block discarded – undo
680 680
 		 * @param string $option The option name.
681 681
 		 * @param mixed  $value  The option value.
682 682
 		 */
683
-		public function add_option_wp_font_awesome_settings( $option, $value ) {
683
+		public function add_option_wp_font_awesome_settings($option, $value) {
684 684
 			// Do nothing if WordPress is being installed.
685
-			if ( wp_installing() ) {
685
+			if (wp_installing()) {
686 686
 				return;
687 687
 			}
688 688
 
689
-			if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) {
690
-				$version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version();
689
+			if (!empty($value['local']) && empty($value['pro']) && !(!empty($value['type']) && $value['type'] == 'KIT')) {
690
+				$version = isset($value['version']) && $value['version'] ? $value['version'] : $this->get_latest_version();
691 691
 
692
-				if ( ! empty( $version ) ) {
693
-					$response = $this->download_package( $version, $value );
692
+				if (!empty($version)) {
693
+					$response = $this->download_package($version, $value);
694 694
 
695
-					if ( is_wp_error( $response ) ) {
696
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
695
+					if (is_wp_error($response)) {
696
+						add_settings_error('general', 'fontawesome_download', __('ERROR:', 'font-awesome-settings') . ' ' . $response->get_error_message(), 'error');
697 697
 					}
698 698
 				}
699 699
 			}
@@ -707,25 +707,25 @@  discard block
 block discarded – undo
707 707
 		 * @param mixed $old_value The old option value.
708 708
 		 * @param mixed $value     The new option value.
709 709
 		 */
710
-		public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
710
+		public function update_option_wp_font_awesome_settings($old_value, $new_value) {
711 711
 			// Do nothing if WordPress is being installed.
712
-			if ( wp_installing() ) {
712
+			if (wp_installing()) {
713 713
 				return;
714 714
 			}
715 715
 
716
-			if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) {
716
+			if (!empty($new_value['local']) && empty($new_value['pro']) && !(!empty($new_value['type']) && $new_value['type'] == 'KIT')) {
717 717
 				// Old values
718
-				$old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
719
-				$old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
718
+				$old_version = isset($old_value['version']) && $old_value['version'] ? $old_value['version'] : (isset($old_value['local_version']) ? $old_value['local_version'] : '');
719
+				$old_local = isset($old_value['local']) ? (int) $old_value['local'] : 0;
720 720
 
721 721
 				// New values
722
-				$new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
722
+				$new_version = isset($new_value['version']) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
723 723
 
724
-				if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
725
-					$response = $this->download_package( $new_version, $new_value );
724
+				if (empty($old_local) || $old_version !== $new_version || !file_exists($this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css')) {
725
+					$response = $this->download_package($new_version, $new_value);
726 726
 
727
-					if ( is_wp_error( $response ) ) {
728
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
727
+					if (is_wp_error($response)) {
728
+						add_settings_error('general', 'fontawesome_download', __('ERROR:', 'font-awesome-settings') . ' ' . $response->get_error_message(), 'error');
729 729
 					}
730 730
 				}
731 731
 			}
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 		 * @param string Fonts directory local path.
740 740
 		 */
741 741
 		public function get_fonts_dir() {
742
-			$upload_dir = wp_upload_dir( null, false );
742
+			$upload_dir = wp_upload_dir(null, false);
743 743
 
744
-			return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
744
+			return $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
745 745
 		}
746 746
 
747 747
 		/**
@@ -752,9 +752,9 @@  discard block
 block discarded – undo
752 752
 		 * @param string Fonts directory local url.
753 753
 		 */
754 754
 		public function get_fonts_url() {
755
-			$upload_dir = wp_upload_dir( null, false );
755
+			$upload_dir = wp_upload_dir(null, false);
756 756
 
757
-			return $upload_dir['baseurl'] .  '/ayefonts/fa/';
757
+			return $upload_dir['baseurl'] . '/ayefonts/fa/';
758 758
 		}
759 759
 
760 760
 		/**
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		 * @return bool True if active else false.
766 766
 		 */
767 767
 		public function has_local() {
768
-			if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
768
+			if (!empty($this->settings['local']) && empty($this->settings['pro']) && file_exists($this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css')) {
769 769
 				return true;
770 770
 			}
771 771
 
@@ -780,18 +780,18 @@  discard block
 block discarded – undo
780 780
 		 * @return object The WP Filesystem.
781 781
 		 */
782 782
 		public function get_wp_filesystem() {
783
-			if ( ! function_exists( 'get_filesystem_method' ) ) {
784
-				require_once( ABSPATH . "/wp-admin/includes/file.php" );
783
+			if (!function_exists('get_filesystem_method')) {
784
+				require_once(ABSPATH . "/wp-admin/includes/file.php");
785 785
 			}
786 786
 
787 787
 			$access_type = get_filesystem_method();
788 788
 
789
-			if ( $access_type === 'direct' ) {
789
+			if ($access_type === 'direct') {
790 790
 				/* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
791
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
791
+				$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
792 792
 
793 793
 				/* Initialize the API */
794
-				if ( ! WP_Filesystem( $creds ) ) {
794
+				if (!WP_Filesystem($creds)) {
795 795
 					/* Any problems and we exit */
796 796
 					return false;
797 797
 				}
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
 
801 801
 				return $wp_filesystem;
802 802
 				/* Do our file manipulations below */
803
-			} else if ( defined( 'FTP_USER' ) ) {
804
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
803
+			} else if (defined('FTP_USER')) {
804
+				$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
805 805
 
806 806
 				/* Initialize the API */
807
-				if ( ! WP_Filesystem( $creds ) ) {
807
+				if (!WP_Filesystem($creds)) {
808 808
 					/* Any problems and we exit */
809 809
 					return false;
810 810
 				}
@@ -827,38 +827,38 @@  discard block
 block discarded – undo
827 827
 		 * @param array $option Fontawesome settings.
828 828
 		 * @return WP_ERROR|bool Error on fail and true on success.
829 829
 		 */
830
-		public function download_package( $version, $option = array() ) {
830
+		public function download_package($version, $option = array()) {
831 831
 			$filename = 'fontawesome-free-' . $version . '-web';
832 832
 			$url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
833 833
 
834
-			if ( ! function_exists( 'wp_handle_upload' ) ) {
834
+			if (!function_exists('wp_handle_upload')) {
835 835
 				require_once ABSPATH . 'wp-admin/includes/file.php';
836 836
 			}
837 837
 
838
-			$download_file = download_url( esc_url_raw( $url ) );
838
+			$download_file = download_url(esc_url_raw($url));
839 839
 
840
-			if ( is_wp_error( $download_file ) ) {
841
-				return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
842
-			} else if ( empty( $download_file ) ) {
843
-				return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
840
+			if (is_wp_error($download_file)) {
841
+				return new WP_Error('fontawesome_download_failed', __($download_file->get_error_message(), 'font-awesome-settings'));
842
+			} else if (empty($download_file)) {
843
+				return new WP_Error('fontawesome_download_failed', __('Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings'));
844 844
 			}
845 845
 
846
-			$response = $this->extract_package( $download_file, $filename, true );
846
+			$response = $this->extract_package($download_file, $filename, true);
847 847
 
848 848
 			// Update local version.
849
-			if ( is_wp_error( $response ) ) {
849
+			if (is_wp_error($response)) {
850 850
 				return $response;
851
-			} else if ( $response ) {
852
-				if ( empty( $option ) ) {
853
-					$option = get_option( 'wp-font-awesome-settings' );
851
+			} else if ($response) {
852
+				if (empty($option)) {
853
+					$option = get_option('wp-font-awesome-settings');
854 854
 				}
855 855
 
856 856
 				$option['local_version'] = $version;
857 857
 
858 858
 				// Remove action to prevent looping.
859
-				remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
859
+				remove_action('update_option_wp-font-awesome-settings', array($this, 'update_option_wp_font_awesome_settings'), 10, 2);
860 860
 
861
-				update_option( 'wp-font-awesome-settings', $option );
861
+				update_option('wp-font-awesome-settings', $option);
862 862
 
863 863
 				return true;
864 864
 			}
@@ -876,60 +876,60 @@  discard block
 block discarded – undo
876 876
 		 * @param bool   $delete_package Delete temp file or not.
877 877
 		 * @return WP_Error|bool True on success WP_Error on fail.
878 878
 		 */
879
-		public function extract_package( $package, $dirname = '', $delete_package = false ) {
879
+		public function extract_package($package, $dirname = '', $delete_package = false) {
880 880
 			global $wp_filesystem;
881 881
 
882 882
 			$wp_filesystem = $this->get_wp_filesystem();
883 883
 
884
-			if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
885
-				return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
886
-			} else if ( empty( $wp_filesystem ) ) {
887
-				return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
884
+			if (empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
885
+				return new WP_Error('fontawesome_filesystem_error', __($wp_filesystem->errors->get_error_message(), 'font-awesome-settings'));
886
+			} else if (empty($wp_filesystem)) {
887
+				return new WP_Error('fontawesome_filesystem_error', __('Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings'));
888 888
 			}
889 889
 
890 890
 			$fonts_dir = $this->get_fonts_dir();
891
-			$fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
891
+			$fonts_tmp_dir = dirname($fonts_dir) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
892 892
 
893
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
894
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
893
+			if ($wp_filesystem->is_dir($fonts_tmp_dir)) {
894
+				$wp_filesystem->delete($fonts_tmp_dir, true);
895 895
 			}
896 896
 
897 897
 			// Unzip package to working directory.
898
-			$result = unzip_file( $package, $fonts_tmp_dir );
898
+			$result = unzip_file($package, $fonts_tmp_dir);
899 899
 
900
-			if ( is_wp_error( $result ) ) {
901
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
900
+			if (is_wp_error($result)) {
901
+				$wp_filesystem->delete($fonts_tmp_dir, true);
902 902
 
903
-				if ( 'incompatible_archive' === $result->get_error_code() ) {
904
-					return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
903
+				if ('incompatible_archive' === $result->get_error_code()) {
904
+					return new WP_Error('fontawesome_incompatible_archive', __($result->get_error_message(), 'font-awesome-settings'));
905 905
 				}
906 906
 
907 907
 				return $result;
908 908
 			}
909 909
 
910
-			if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
911
-				$wp_filesystem->delete( $fonts_dir, true );
910
+			if ($wp_filesystem->is_dir($fonts_dir)) {
911
+				$wp_filesystem->delete($fonts_dir, true);
912 912
 			}
913 913
 
914 914
 			$extract_dir = $fonts_tmp_dir;
915 915
 
916
-			if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
916
+			if ($dirname && $wp_filesystem->is_dir($extract_dir . $dirname . DIRECTORY_SEPARATOR)) {
917 917
 				$extract_dir .= $dirname . DIRECTORY_SEPARATOR;
918 918
 			}
919 919
 
920 920
 			try {
921
-				$return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
922
-			} catch ( Exception $e ) {
923
-				$return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
921
+				$return = $wp_filesystem->move($extract_dir, $fonts_dir, true);
922
+			} catch (Exception $e) {
923
+				$return = new WP_Error('fontawesome_move_package', __('Fail to move font awesome package!', 'font-awesome-settings'));
924 924
 			}
925 925
 
926
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
927
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
926
+			if ($wp_filesystem->is_dir($fonts_tmp_dir)) {
927
+				$wp_filesystem->delete($fonts_tmp_dir, true);
928 928
 			}
929 929
 
930 930
 			// Once extracted, delete the package if required.
931
-			if ( $delete_package ) {
932
-				unlink( $package );
931
+			if ($delete_package) {
932
+				unlink($package);
933 933
 			}
934 934
 
935 935
 			return $return;
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.85";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.85";
19
+    if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.85";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (empty($ayecode_ui_version) || version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.