Passed
Push — master ( 5d2154...beaeba )
by Brian
03:53
created
includes/deprecated-functions.php 1 patch
Spacing   +91 added lines, -91 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
  * @deprecated
@@ -19,48 +19,48 @@  discard block
 block discarded – undo
19 19
  * @deprecated
20 20
  */
21 21
 function wpinv_get_invoice_cart() {
22
-    return wpinv_get_invoice( getpaid_get_current_invoice_id() );
22
+    return wpinv_get_invoice(getpaid_get_current_invoice_id());
23 23
 }
24 24
 
25 25
 /**
26 26
  * @deprecated
27 27
  */
28
-function wpinv_get_invoice_description( $invoice ) {
29
-    $invoice = new WPInv_Invoice( $invoice );
28
+function wpinv_get_invoice_description($invoice) {
29
+    $invoice = new WPInv_Invoice($invoice);
30 30
     return $invoice->get_description();
31 31
 }
32 32
 
33 33
 /**
34 34
  * @deprecated
35 35
  */
36
-function wpinv_get_invoice_currency_code( $invoice ) {
37
-    $invoice = new WPInv_Invoice( $invoice );
36
+function wpinv_get_invoice_currency_code($invoice) {
37
+    $invoice = new WPInv_Invoice($invoice);
38 38
     return $invoice->get_currency();
39 39
 }
40 40
 
41 41
 /**
42 42
  * @deprecated
43 43
  */
44
-function wpinv_get_payment_user_email( $invoice ) {
45
-    $invoice = new WPInv_Invoice( $invoice );
44
+function wpinv_get_payment_user_email($invoice) {
45
+    $invoice = new WPInv_Invoice($invoice);
46 46
     return $invoice->get_email();
47 47
 }
48 48
 
49 49
 /**
50 50
  * @deprecated
51 51
  */
52
-function wpinv_get_user_id( $invoice ) {
53
-    $invoice = new WPInv_Invoice( $invoice );
52
+function wpinv_get_user_id($invoice) {
53
+    $invoice = new WPInv_Invoice($invoice);
54 54
     return $invoice->get_user_id();
55 55
 }
56 56
 
57 57
 /**
58 58
  * @deprecated
59 59
  */
60
-function wpinv_get_invoice_status( $invoice, $return_label = false ) {
61
-    $invoice = new WPInv_Invoice( $invoice );
60
+function wpinv_get_invoice_status($invoice, $return_label = false) {
61
+    $invoice = new WPInv_Invoice($invoice);
62 62
     
63
-    if ( $return_label ) {
63
+    if ($return_label) {
64 64
         return $invoice->get_status_nicename();
65 65
     }
66 66
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 /**
71 71
  * @deprecated
72 72
  */
73
-function wpinv_get_payment_gateway( $invoice, $return_label = false ) {
74
-    $invoice = new WPInv_Invoice( $invoice );
73
+function wpinv_get_payment_gateway($invoice, $return_label = false) {
74
+    $invoice = new WPInv_Invoice($invoice);
75 75
 
76
-    if ( $return_label ) {
76
+    if ($return_label) {
77 77
         return $invoice->get_gateway_title();
78 78
     }
79 79
 
@@ -83,75 +83,75 @@  discard block
 block discarded – undo
83 83
 /**
84 84
  * @deprecated
85 85
  */
86
-function wpinv_get_payment_gateway_name( $invoice ) {
87
-    return wpinv_get_payment_gateway( $invoice, true );
86
+function wpinv_get_payment_gateway_name($invoice) {
87
+    return wpinv_get_payment_gateway($invoice, true);
88 88
 }
89 89
 
90 90
 /**
91 91
  * @deprecated
92 92
  */
93
-function wpinv_get_payment_transaction_id( $invoice ) {
94
-    $invoice = new WPInv_Invoice( $invoice );
93
+function wpinv_get_payment_transaction_id($invoice) {
94
+    $invoice = new WPInv_Invoice($invoice);
95 95
     return $invoice->get_transaction_id();
96 96
 }
97 97
 
98 98
 /**
99 99
  * @deprecated
100 100
  */
101
-function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) {
102
-    $invoice = new WPInv_Invoice( $invoice_id );
103
-    return $invoice->get_meta( $meta_key, $single );
101
+function wpinv_get_invoice_meta($invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true) {
102
+    $invoice = new WPInv_Invoice($invoice_id);
103
+    return $invoice->get_meta($meta_key, $single);
104 104
 }
105 105
 
106 106
 /**
107 107
  * @deprecated
108 108
  */
109
-function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) {
110
-    $invoice = new WPInv_Invoice( $invoice_id );
111
-    return $invoice->update_meta_data( $meta_key, $meta_value );
109
+function wpinv_update_invoice_meta($invoice_id = 0, $meta_key = '', $meta_value = '') {
110
+    $invoice = new WPInv_Invoice($invoice_id);
111
+    return $invoice->update_meta_data($meta_key, $meta_value);
112 112
 }
113 113
 
114 114
 /**
115 115
  * @deprecated
116 116
  */
117
-function wpinv_get_items( $invoice = 0 ) {
118
-    $invoice = new WPInv_Invoice( $invoice );
117
+function wpinv_get_items($invoice = 0) {
118
+    $invoice = new WPInv_Invoice($invoice);
119 119
     return $invoice->get_items();
120 120
 }
121 121
 
122 122
 /**
123 123
  * @deprecated
124 124
  */
125
-function wpinv_get_fees( $invoice = 0 ) {
126
-    $invoice = new WPInv_Invoice( $invoice );
125
+function wpinv_get_fees($invoice = 0) {
126
+    $invoice = new WPInv_Invoice($invoice);
127 127
     return $invoice->get_fees();
128 128
 }
129 129
 
130 130
 /**
131 131
  * @deprecated
132 132
  */
133
-function wpinv_get_invoice_ip( $invoice ) {
134
-    $invoice = new WPInv_Invoice( $invoice );
133
+function wpinv_get_invoice_ip($invoice) {
134
+    $invoice = new WPInv_Invoice($invoice);
135 135
     return $invoice->get_ip();
136 136
 }
137 137
 
138 138
 /**
139 139
  * @deprecated
140 140
  */
141
-function wpinv_get_invoice_user_info( $invoice ) {
142
-    $invoice = new WPInv_Invoice( $invoice );
141
+function wpinv_get_invoice_user_info($invoice) {
142
+    $invoice = new WPInv_Invoice($invoice);
143 143
     return $invoice->get_user_info();
144 144
 }
145 145
 
146 146
 /**
147 147
  * @deprecated
148 148
  */
149
-function wpinv_subtotal( $invoice = 0, $currency = false ) {
150
-    $invoice  = new WPInv_Invoice( $invoice );
149
+function wpinv_subtotal($invoice = 0, $currency = false) {
150
+    $invoice  = new WPInv_Invoice($invoice);
151 151
     $subtotal = $invoice->get_subtotal();
152 152
 
153
-    if ( $currency ) {
154
-        return wpinv_price( wpinv_format_amount( $subtotal ), $invoice->get_currency() );
153
+    if ($currency) {
154
+        return wpinv_price(wpinv_format_amount($subtotal), $invoice->get_currency());
155 155
     }
156 156
 
157 157
     return $subtotal;
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 /**
161 161
  * @deprecated
162 162
  */
163
-function wpinv_tax( $invoice = 0, $currency = false ) {
164
-    $invoice  = new WPInv_Invoice( $invoice );
163
+function wpinv_tax($invoice = 0, $currency = false) {
164
+    $invoice  = new WPInv_Invoice($invoice);
165 165
     $tax      = $invoice->get_total_tax();
166 166
 
167
-    if ( $currency ) {
168
-        return wpinv_price( wpinv_format_amount( $tax ), $invoice->get_currency() );
167
+    if ($currency) {
168
+        return wpinv_price(wpinv_format_amount($tax), $invoice->get_currency());
169 169
     }
170 170
 
171 171
     return $tax;
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 /**
175 175
  * @deprecated
176 176
  */
177
-function wpinv_discount( $invoice = 0, $currency = false, $deprecated ) {
178
-    $invoice  = new WPInv_Invoice( $invoice );
177
+function wpinv_discount($invoice = 0, $currency = false, $deprecated) {
178
+    $invoice  = new WPInv_Invoice($invoice);
179 179
     $discount = $invoice->get_total_discount();
180 180
 
181
-    if ( $currency ) {
182
-        return wpinv_price( wpinv_format_amount( $discount ), $invoice->get_currency() );
181
+    if ($currency) {
182
+        return wpinv_price(wpinv_format_amount($discount), $invoice->get_currency());
183 183
     }
184 184
 
185 185
     return $discount;
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 /**
189 189
  * @deprecated
190 190
  */
191
-function wpinv_discount_code( $invoice = 0 ) {
192
-    $invoice = new WPInv_Invoice( $invoice );
191
+function wpinv_discount_code($invoice = 0) {
192
+    $invoice = new WPInv_Invoice($invoice);
193 193
     return $invoice->get_discount_code();
194 194
 }
195 195
 
196 196
 /**
197 197
  * @deprecated
198 198
  */
199
-function wpinv_payment_total( $invoice = 0, $currency = false ) {
200
-    $invoice  = new WPInv_Invoice( $invoice );
199
+function wpinv_payment_total($invoice = 0, $currency = false) {
200
+    $invoice = new WPInv_Invoice($invoice);
201 201
     $total = $invoice->get_total();
202 202
 
203
-    if ( $currency ) {
204
-        return wpinv_price( wpinv_format_amount( $total ), $invoice->get_currency() );
203
+    if ($currency) {
204
+        return wpinv_price(wpinv_format_amount($total), $invoice->get_currency());
205 205
     }
206 206
 
207 207
     return $total;
@@ -210,51 +210,51 @@  discard block
 block discarded – undo
210 210
 /**
211 211
  * @deprecated
212 212
  */
213
-function wpinv_get_date_created( $invoice = 0, $format = '' ) {
214
-    $invoice = new WPInv_Invoice( $invoice );
213
+function wpinv_get_date_created($invoice = 0, $format = '') {
214
+    $invoice = new WPInv_Invoice($invoice);
215 215
 
216
-    $format         = ! empty( $format ) ? $format : get_option( 'date_format' );
216
+    $format         = !empty($format) ? $format : get_option('date_format');
217 217
     $date_created   = $invoice->get_created_date();
218 218
 
219
-    return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : '';
219
+    return empty($date_created) ? date_i18n($format, strtotime($date_created)) : '';
220 220
 }
221 221
 
222 222
 /**
223 223
  * @deprecated
224 224
  */
225
-function wpinv_get_invoice_date( $invoice = 0, $format = '' ) {
226
-    wpinv_get_date_created( $invoice, $format );
225
+function wpinv_get_invoice_date($invoice = 0, $format = '') {
226
+    wpinv_get_date_created($invoice, $format);
227 227
 }
228 228
 
229 229
 /**
230 230
  * @deprecated
231 231
  */
232
-function wpinv_get_invoice_vat_number( $invoice = 0 ) {
233
-    $invoice = new WPInv_Invoice( $invoice );
232
+function wpinv_get_invoice_vat_number($invoice = 0) {
233
+    $invoice = new WPInv_Invoice($invoice);
234 234
     return $invoice->get_vat_number();
235 235
 }
236 236
 
237 237
 /**
238 238
  * @deprecated
239 239
  */
240
-function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) {
241
-    $invoice = new WPInv_Invoice( $invoice );
242
-    return $invoice->add_note( $note, $user_type, $added_by_user, $system );
240
+function wpinv_insert_payment_note($invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false) {
241
+    $invoice = new WPInv_Invoice($invoice);
242
+    return $invoice->add_note($note, $user_type, $added_by_user, $system);
243 243
 }
244 244
 
245 245
 /**
246 246
  * @deprecated
247 247
  */
248
-function wpinv_get_payment_key( $invoice = 0 ) {
249
-	$invoice = new WPInv_Invoice( $invoice );
248
+function wpinv_get_payment_key($invoice = 0) {
249
+	$invoice = new WPInv_Invoice($invoice);
250 250
     return $invoice->get_key();
251 251
 }
252 252
 
253 253
 /**
254 254
  * @deprecated
255 255
  */
256
-function wpinv_get_invoice_number( $invoice = 0 ) {
257
-    $invoice = new WPInv_Invoice( $invoice );
256
+function wpinv_get_invoice_number($invoice = 0) {
257
+    $invoice = new WPInv_Invoice($invoice);
258 258
     return $invoice->get_number();
259 259
 }
260 260
 
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 /**
402 402
  * @deprecated
403 403
  */
404
-function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) {    
405
-    $invoice = new WPInv_Invoice( $invoice );
406
-    return $invoice->update_status( $new_status );
404
+function wpinv_update_payment_status($invoice, $new_status = 'publish') {    
405
+    $invoice = new WPInv_Invoice($invoice);
406
+    return $invoice->update_status($new_status);
407 407
 }
408 408
 
409 409
 /**
@@ -456,22 +456,22 @@  discard block
 block discarded – undo
456 456
 /**
457 457
  * @deprecated
458 458
  */
459
-function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) {
459
+function wpinv_set_payment_transaction_id($invoice_id = 0, $transaction_id = '') {
460 460
 
461 461
     // Fetch the invoice.
462
-    $invoice = new WPInv_Invoice( $invoice_id );
462
+    $invoice = new WPInv_Invoice($invoice_id);
463 463
 
464
-    if ( 0 ==  $invoice->get_id() ) {
464
+    if (0 == $invoice->get_id()) {
465 465
         return false;
466 466
     }
467 467
 
468 468
     // Prepare the transaction id.
469
-    if ( empty( $transaction_id ) ) {
469
+    if (empty($transaction_id)) {
470 470
         $transaction_id = $invoice_id;
471 471
     }
472 472
 
473 473
     // Set the transaction id;
474
-    $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) );
474
+    $invoice->set_transaction_id(apply_filters('wpinv_set_payment_transaction_id', $transaction_id, $invoice));
475 475
 
476 476
     // Save the invoice.
477 477
     return $invoice->save();
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
  * @param WPInv_Invoice $invoice
485 485
  * @param string $gateway
486 486
  */
487
-function wpinv_send_to_gateway( $gateway, $invoice ) {
487
+function wpinv_send_to_gateway($gateway, $invoice) {
488 488
 
489 489
     $payment_data = array(
490 490
         'invoice_id'        => $invoice->get_id(),
491 491
         'items'             => $invoice->get_cart_details(),
492
-        'cart_discounts'    => array( $invoice->get_discount_code() ),
492
+        'cart_discounts'    => array($invoice->get_discount_code()),
493 493
         'fees'              => $invoice->get_total_fees(),
494 494
         'subtotal'          => $invoice->get_subtotal(),
495 495
         'discount'          => $invoice->get_total_discount(),
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
         'price'             => $invoice->get_total(),
498 498
         'invoice_key'       => $invoice->get_key(),
499 499
         'user_email'        => $invoice->get_email(),
500
-        'date'              => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
500
+        'date'              => date('Y-m-d H:i:s', current_time('timestamp')),
501 501
         'user_info'         => $invoice->get_user_info(),
502
-        'post_data'         => stripslashes_deep( $_POST ),
502
+        'post_data'         => stripslashes_deep($_POST),
503 503
         'cart_details'      => $invoice->get_cart_details(),
504 504
         'gateway'           => $gateway,
505 505
         'card_info'         => array(),
506 506
         'gateway_nonce'     => wp_create_nonce('wpi-gateway'),
507 507
     );
508 508
 
509
-    do_action( 'wpinv_gateway_' . $gateway, $payment_data );
509
+    do_action('wpinv_gateway_' . $gateway, $payment_data);
510 510
 }
511 511
 
512 512
 /**
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 /**
520 520
  * @deprecated
521 521
  */
522
-function wpinv_die( $message = '', $title = '', $status = 400 ) {
523
-    add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 );
524
-    add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 );
525
-    wp_die( $message, $title, array( 'response' => $status ));
522
+function wpinv_die($message = '', $title = '', $status = 400) {
523
+    add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3);
524
+    add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3);
525
+    wp_die($message, $title, array('response' => $status));
526 526
 }
527 527
 
528 528
 /**
@@ -640,14 +640,14 @@  discard block
 block discarded – undo
640 640
 /**
641 641
  * @deprecated
642 642
  */
643
-function wpinv_invoice_status_label( $status, $status_display = '' ) {
644
-    return empty( $status_display ) ? sanitize_text_field( $status ) : sanitize_text_field( $status_display );
643
+function wpinv_invoice_status_label($status, $status_display = '') {
644
+    return empty($status_display) ? sanitize_text_field($status) : sanitize_text_field($status_display);
645 645
 }
646 646
 
647 647
 /**
648 648
  * @deprecated
649 649
  */
650
-function wpinv_clean_invoice_number( $number ) {
650
+function wpinv_clean_invoice_number($number) {
651 651
     return $number;
652 652
 }
653 653
 
@@ -852,12 +852,12 @@  discard block
 block discarded – undo
852 852
 /**
853 853
  * @deprecated
854 854
  */
855
-function wpinv_item_show_price( $item_id = 0, $echo = true ) {
855
+function wpinv_item_show_price($item_id = 0, $echo = true) {
856 856
 
857
-    if ( $echo ) {
858
-        echo wpinv_item_price( $item_id );
857
+    if ($echo) {
858
+        echo wpinv_item_price($item_id);
859 859
     } else {
860
-        return wpinv_item_price( $item_id );
860
+        return wpinv_item_price($item_id);
861 861
     }
862 862
 
863 863
 }
864 864
\ No newline at end of file
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 1 patch
Spacing   +180 added lines, -180 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 $id ? wpinv_get_item( $id ) : false;
33
+    $id = WPInv_Item::get_item_id_by_field($value, strtolower($field), $type);
34
+    return $id ? wpinv_get_item($id) : false;
35 35
 
36 36
 }
37 37
 
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
  * @param int|WPInv_Item the item to retrieve.
42 42
  * @return WPInv_Item|false
43 43
  */
44
-function wpinv_get_item( $item = 0 ) {
44
+function wpinv_get_item($item = 0) {
45 45
     
46
-    if ( empty( $item ) ) {
46
+    if (empty($item)) {
47 47
         return false;
48 48
     }
49 49
 
50
-    $item = new WPInv_Item( $item );
50
+    $item = new WPInv_Item($item);
51 51
     return $item->get_id() ? $item : false;
52 52
 
53 53
 }
54 54
 
55
-function wpinv_get_all_items( $args = array() ) {
55
+function wpinv_get_all_items($args = array()) {
56 56
 
57
-    $args = wp_parse_args( $args, array(
58
-        'status'         => array( 'publish' ),
59
-        'limit'          => get_option( 'posts_per_page' ),
57
+    $args = wp_parse_args($args, array(
58
+        'status'         => array('publish'),
59
+        'limit'          => get_option('posts_per_page'),
60 60
         'page'           => 1,
61 61
         'exclude'        => array(),
62 62
         'orderby'        => 'date',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         'meta_query'     => array(),
66 66
         'return'         => 'objects',
67 67
         'paginate'       => false,
68
-    ) );
68
+    ));
69 69
 
70 70
     $wp_query_args = array(
71 71
         'post_type'      => 'wpi_item',
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
         'fields'         => 'ids',
76 76
         'orderby'        => $args['orderby'],
77 77
         'order'          => $args['order'],
78
-        'paged'          => absint( $args['page'] ),
78
+        'paged'          => absint($args['page']),
79 79
     );
80 80
 
81
-    if ( ! empty( $args['exclude'] ) ) {
82
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
81
+    if (!empty($args['exclude'])) {
82
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
83 83
     }
84 84
 
85
-    if ( ! $args['paginate' ] ) {
85
+    if (!$args['paginate']) {
86 86
         $wp_query_args['no_found_rows'] = true;
87 87
     }
88 88
 
89
-    if ( ! empty( $args['search'] ) ) {
89
+    if (!empty($args['search'])) {
90 90
         $wp_query_args['s'] = $args['search'];
91 91
     }
92 92
 
93
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
94
-        $types = wpinv_parse_list( $args['type'] );
93
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
94
+        $types = wpinv_parse_list($args['type']);
95 95
         $wp_query_args['meta_query'][] = array(
96 96
             'key'     => '_wpinv_type',
97
-            'value'   => implode( ',', $types ),
97
+            'value'   => implode(',', $types),
98 98
             'compare' => 'IN',
99 99
         );
100 100
     }
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
     $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
103 103
 
104 104
     // Get results.
105
-    $items = new WP_Query( $wp_query_args );
105
+    $items = new WP_Query($wp_query_args);
106 106
 
107
-    if ( 'objects' === $args['return'] ) {
108
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
109
-    } elseif ( 'self' === $args['return'] ) {
107
+    if ('objects' === $args['return']) {
108
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
109
+    } elseif ('self' === $args['return']) {
110 110
         return $items;
111 111
     } else {
112 112
         $return = $items->posts;
113 113
     }
114 114
 
115
-    if ( $args['paginate' ] ) {
115
+    if ($args['paginate']) {
116 116
         return (object) array(
117 117
             'items'      => $return,
118 118
             'total'         => $items->found_posts,
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 }
126 126
 
127
-function wpinv_is_free_item( $item_id = 0 ) {
128
-    if( empty( $item_id ) ) {
127
+function wpinv_is_free_item($item_id = 0) {
128
+    if (empty($item_id)) {
129 129
         return false;
130 130
     }
131 131
 
132
-    $item = new WPInv_Item( $item_id );
132
+    $item = new WPInv_Item($item_id);
133 133
     
134 134
     return $item->is_free();
135 135
 }
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
  * 
140 140
  * @param WP_Post|WPInv_Item|Int $item The item to check for.
141 141
  */
142
-function wpinv_item_is_editable( $item = 0 ) {
142
+function wpinv_item_is_editable($item = 0) {
143 143
 
144 144
     // Fetch the item.
145
-    $item = new WPInv_Item( $item );
145
+    $item = new WPInv_Item($item);
146 146
 
147 147
     // Check if it is editable.
148 148
     return $item->is_editable();
149 149
 }
150 150
 
151
-function wpinv_get_item_price( $item_id = 0 ) {
152
-    if( empty( $item_id ) ) {
151
+function wpinv_get_item_price($item_id = 0) {
152
+    if (empty($item_id)) {
153 153
         return false;
154 154
     }
155 155
 
156
-    $item = new WPInv_Item( $item_id );
156
+    $item = new WPInv_Item($item_id);
157 157
     
158 158
     return $item->get_price();
159 159
 }
@@ -163,266 +163,266 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @param WPInv_Item|int $item
165 165
  */
166
-function wpinv_is_recurring_item( $item = 0 ) {
167
-    $item = new WPInv_Item( $item ); 
166
+function wpinv_is_recurring_item($item = 0) {
167
+    $item = new WPInv_Item($item); 
168 168
     return $item->is_recurring();
169 169
 }
170 170
 
171
-function wpinv_item_price( $item_id = 0 ) {
172
-    if( empty( $item_id ) ) {
171
+function wpinv_item_price($item_id = 0) {
172
+    if (empty($item_id)) {
173 173
         return false;
174 174
     }
175 175
 
176
-    $price = wpinv_get_item_price( $item_id );
177
-    $price = wpinv_price( wpinv_format_amount( $price ) );
176
+    $price = wpinv_get_item_price($item_id);
177
+    $price = wpinv_price(wpinv_format_amount($price));
178 178
     
179
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
179
+    return apply_filters('wpinv_item_price', $price, $item_id);
180 180
 }
181 181
 
182
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
183
-    if ( is_null( $amount_override ) ) {
184
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
182
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
183
+    if (is_null($amount_override)) {
184
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
185 185
     } else {
186 186
         $original_price = $amount_override;
187 187
     }
188 188
     
189 189
     $price = $original_price;
190 190
 
191
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
191
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
192 192
 }
193 193
 
194
-function wpinv_item_custom_singular_name( $item_id ) {
195
-    if( empty( $item_id ) ) {
194
+function wpinv_item_custom_singular_name($item_id) {
195
+    if (empty($item_id)) {
196 196
         return false;
197 197
     }
198 198
 
199
-    $item = new WPInv_Item( $item_id );
199
+    $item = new WPInv_Item($item_id);
200 200
     
201 201
     return $item->get_custom_singular_name();
202 202
 }
203 203
 
204 204
 function wpinv_get_item_types() {
205 205
     $item_types = array(
206
-            'custom'    => __( 'Standard', 'invoicing' ),
207
-            'fee'       => __( 'Fee', 'invoicing' ),
206
+            'custom'    => __('Standard', 'invoicing'),
207
+            'fee'       => __('Fee', 'invoicing'),
208 208
         );
209
-    return apply_filters( 'wpinv_get_item_types', $item_types );
209
+    return apply_filters('wpinv_get_item_types', $item_types);
210 210
 }
211 211
 
212 212
 function wpinv_item_types() {
213 213
     $item_types = wpinv_get_item_types();
214 214
     
215
-    return ( !empty( $item_types ) ? array_keys( $item_types ) : array() );
215
+    return (!empty($item_types) ? array_keys($item_types) : array());
216 216
 }
217 217
 
218
-function wpinv_get_item_type( $item_id ) {
219
-    if( empty( $item_id ) ) {
218
+function wpinv_get_item_type($item_id) {
219
+    if (empty($item_id)) {
220 220
         return false;
221 221
     }
222 222
 
223
-    $item = new WPInv_Item( $item_id );
223
+    $item = new WPInv_Item($item_id);
224 224
     
225 225
     return $item->get_type();
226 226
 }
227 227
 
228
-function wpinv_item_type( $item_id ) {
228
+function wpinv_item_type($item_id) {
229 229
     $item_types = wpinv_get_item_types();
230 230
     
231
-    $item_type = wpinv_get_item_type( $item_id );
231
+    $item_type = wpinv_get_item_type($item_id);
232 232
     
233
-    if ( empty( $item_type ) ) {
233
+    if (empty($item_type)) {
234 234
         $item_type = '-';
235 235
     }
236 236
     
237
-    $item_type = isset( $item_types[$item_type] ) ? $item_types[$item_type] : __( $item_type, 'invoicing' );
237
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
238 238
 
239
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
239
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
240 240
 }
241 241
 
242
-function wpinv_get_random_item( $post_ids = true ) {
243
-    wpinv_get_random_items( 1, $post_ids );
242
+function wpinv_get_random_item($post_ids = true) {
243
+    wpinv_get_random_items(1, $post_ids);
244 244
 }
245 245
 
246
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
247
-    if ( $post_ids ) {
248
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids' );
246
+function wpinv_get_random_items($num = 3, $post_ids = true) {
247
+    if ($post_ids) {
248
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids');
249 249
     } else {
250
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num );
250
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num);
251 251
     }
252 252
     
253
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
253
+    $args = apply_filters('wpinv_get_random_items', $args);
254 254
     
255
-    return get_posts( $args );
255
+    return get_posts($args);
256 256
 }
257 257
 
258
-function wpinv_get_item_token( $url = '' ) {
258
+function wpinv_get_item_token($url = '') {
259 259
     $args    = array();
260
-    $hash    = apply_filters( 'wpinv_get_url_token_algorithm', 'sha256' );
261
-    $secret  = apply_filters( 'wpinv_get_url_token_secret', hash( $hash, wp_salt() ) );
260
+    $hash    = apply_filters('wpinv_get_url_token_algorithm', 'sha256');
261
+    $secret  = apply_filters('wpinv_get_url_token_secret', hash($hash, wp_salt()));
262 262
 
263
-    $parts   = parse_url( $url );
263
+    $parts   = parse_url($url);
264 264
     $options = array();
265 265
 
266
-    if ( isset( $parts['query'] ) ) {
267
-        wp_parse_str( $parts['query'], $query_args );
266
+    if (isset($parts['query'])) {
267
+        wp_parse_str($parts['query'], $query_args);
268 268
 
269
-        if ( ! empty( $query_args['o'] ) ) {
270
-            $options = explode( ':', rawurldecode( $query_args['o'] ) );
269
+        if (!empty($query_args['o'])) {
270
+            $options = explode(':', rawurldecode($query_args['o']));
271 271
 
272
-            if ( in_array( 'ip', $options ) ) {
272
+            if (in_array('ip', $options)) {
273 273
                 $args['ip'] = wpinv_get_ip();
274 274
             }
275 275
 
276
-            if ( in_array( 'ua', $options ) ) {
276
+            if (in_array('ua', $options)) {
277 277
                 $ua = wpinv_get_user_agent();
278
-                $args['user_agent'] = rawurlencode( $ua );
278
+                $args['user_agent'] = rawurlencode($ua);
279 279
             }
280 280
         }
281 281
     }
282 282
 
283
-    $args = apply_filters( 'wpinv_get_url_token_args', $args, $url, $options );
283
+    $args = apply_filters('wpinv_get_url_token_args', $args, $url, $options);
284 284
 
285 285
     $args['secret'] = $secret;
286 286
     $args['token']  = false;
287 287
 
288
-    $url   = add_query_arg( $args, $url );
289
-    $parts = parse_url( $url );
288
+    $url   = add_query_arg($args, $url);
289
+    $parts = parse_url($url);
290 290
 
291
-    if ( ! isset( $parts['path'] ) ) {
291
+    if (!isset($parts['path'])) {
292 292
         $parts['path'] = '';
293 293
     }
294 294
 
295
-    $token = md5( $parts['path'] . '?' . $parts['query'] );
295
+    $token = md5($parts['path'] . '?' . $parts['query']);
296 296
 
297 297
     return $token;
298 298
 }
299 299
 
300
-function wpinv_validate_url_token( $url = '' ) {
300
+function wpinv_validate_url_token($url = '') {
301 301
     $ret   = false;
302
-    $parts = parse_url( $url );
302
+    $parts = parse_url($url);
303 303
 
304
-    if ( isset( $parts['query'] ) ) {
305
-        wp_parse_str( $parts['query'], $query_args );
304
+    if (isset($parts['query'])) {
305
+        wp_parse_str($parts['query'], $query_args);
306 306
 
307
-        $allowed = apply_filters( 'wpinv_url_token_allowed_params', array(
307
+        $allowed = apply_filters('wpinv_url_token_allowed_params', array(
308 308
             'item',
309 309
             'ttl',
310 310
             'token'
311
-        ) );
311
+        ));
312 312
 
313 313
         $remove = array();
314 314
 
315
-        foreach( $query_args as $key => $value ) {
316
-            if( false === in_array( $key, $allowed ) ) {
315
+        foreach ($query_args as $key => $value) {
316
+            if (false === in_array($key, $allowed)) {
317 317
                 $remove[] = $key;
318 318
             }
319 319
         }
320 320
 
321
-        if( ! empty( $remove ) ) {
322
-            $url = remove_query_arg( $remove, $url );
321
+        if (!empty($remove)) {
322
+            $url = remove_query_arg($remove, $url);
323 323
         }
324 324
 
325
-        if ( isset( $query_args['ttl'] ) && current_time( 'timestamp' ) > $query_args['ttl'] ) {
326
-            wp_die( apply_filters( 'wpinv_item_link_expired_text', __( 'Sorry but your item link has expired.', 'invoicing' ) ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
325
+        if (isset($query_args['ttl']) && current_time('timestamp') > $query_args['ttl']) {
326
+            wp_die(apply_filters('wpinv_item_link_expired_text', __('Sorry but your item link has expired.', 'invoicing')), __('Error', 'invoicing'), array('response' => 403));
327 327
         }
328 328
 
329
-        if ( isset( $query_args['token'] ) && $query_args['token'] == wpinv_get_item_token( $url ) ) {
329
+        if (isset($query_args['token']) && $query_args['token'] == wpinv_get_item_token($url)) {
330 330
             $ret = true;
331 331
         }
332 332
 
333 333
     }
334 334
 
335
-    return apply_filters( 'wpinv_validate_url_token', $ret, $url, $query_args );
335
+    return apply_filters('wpinv_validate_url_token', $ret, $url, $query_args);
336 336
 }
337 337
 
338
-function wpinv_item_in_cart( $item_id = 0, $options = array() ) {
338
+function wpinv_item_in_cart($item_id = 0, $options = array()) {
339 339
     $cart_items = wpinv_get_cart_contents();
340 340
 
341 341
     $ret = false;
342 342
 
343
-    if ( is_array( $cart_items ) ) {
344
-        foreach ( $cart_items as $item ) {
345
-            if ( $item['id'] == $item_id ) {
343
+    if (is_array($cart_items)) {
344
+        foreach ($cart_items as $item) {
345
+            if ($item['id'] == $item_id) {
346 346
                 $ret = true;
347 347
                 break;
348 348
             }
349 349
         }
350 350
     }
351 351
 
352
-    return (bool) apply_filters( 'wpinv_item_in_cart', $ret, $item_id, $options );
352
+    return (bool) apply_filters('wpinv_item_in_cart', $ret, $item_id, $options);
353 353
 }
354 354
 
355
-function wpinv_get_cart_item_tax( $item_id = 0, $subtotal = '', $options = array() ) {
355
+function wpinv_get_cart_item_tax($item_id = 0, $subtotal = '', $options = array()) {
356 356
     $tax = 0;
357
-    if ( ! wpinv_item_is_tax_exclusive( $item_id ) ) {
358
-        $country = !empty( $_POST['country'] ) ? $_POST['country'] : false;
359
-        $state   = isset( $_POST['state'] ) ? $_POST['state'] : '';
357
+    if (!wpinv_item_is_tax_exclusive($item_id)) {
358
+        $country = !empty($_POST['country']) ? $_POST['country'] : false;
359
+        $state   = isset($_POST['state']) ? $_POST['state'] : '';
360 360
 
361
-        $tax = wpinv_calculate_tax( $subtotal, $country, $state, $item_id );
361
+        $tax = wpinv_calculate_tax($subtotal, $country, $state, $item_id);
362 362
     }
363 363
 
364
-    return apply_filters( 'wpinv_get_cart_item_tax', $tax, $item_id, $subtotal, $options );
364
+    return apply_filters('wpinv_get_cart_item_tax', $tax, $item_id, $subtotal, $options);
365 365
 }
366 366
 
367
-function wpinv_cart_item_price( $item, $currency = '' ) {
367
+function wpinv_cart_item_price($item, $currency = '') {
368 368
 
369
-    if( empty( $currency ) ) {
369
+    if (empty($currency)) {
370 370
         $currency = wpinv_get_currency();
371 371
     }
372 372
 
373
-    $item_id    = isset( $item['id'] ) ? $item['id'] : 0;
374
-    $price      = isset( $item['item_price'] ) ? wpinv_round_amount( $item['item_price'] ) : 0;
375
-    $tax        = wpinv_price( wpinv_format_amount( $item['tax'] ) );
373
+    $item_id    = isset($item['id']) ? $item['id'] : 0;
374
+    $price      = isset($item['item_price']) ? wpinv_round_amount($item['item_price']) : 0;
375
+    $tax        = wpinv_price(wpinv_format_amount($item['tax']));
376 376
     
377
-    if ( !wpinv_is_free_item( $item_id ) && !wpinv_item_is_tax_exclusive( $item_id ) ) {
378
-        if ( wpinv_prices_show_tax_on_checkout() && !wpinv_prices_include_tax() ) {
377
+    if (!wpinv_is_free_item($item_id) && !wpinv_item_is_tax_exclusive($item_id)) {
378
+        if (wpinv_prices_show_tax_on_checkout() && !wpinv_prices_include_tax()) {
379 379
             $price += $tax;
380 380
         }
381 381
         
382
-        if( !wpinv_prices_show_tax_on_checkout() && wpinv_prices_include_tax() ) {
382
+        if (!wpinv_prices_show_tax_on_checkout() && wpinv_prices_include_tax()) {
383 383
             $price -= $tax;
384 384
         }        
385 385
     }
386 386
 
387
-    $price = wpinv_price( wpinv_format_amount( $price ), $currency );
387
+    $price = wpinv_price(wpinv_format_amount($price), $currency);
388 388
 
389
-    return apply_filters( 'wpinv_cart_item_price_label', $price, $item );
389
+    return apply_filters('wpinv_cart_item_price_label', $price, $item);
390 390
 }
391 391
 
392
-function wpinv_cart_item_subtotal( $item, $currency = '' ) {
392
+function wpinv_cart_item_subtotal($item, $currency = '') {
393 393
 
394
-    if( empty( $currency ) ) {
394
+    if (empty($currency)) {
395 395
         $currency = wpinv_get_currency();
396 396
     }
397 397
 
398
-    $subtotal   = isset( $item['subtotal'] ) ? $item['subtotal'] : 0;
399
-    $subtotal   = wpinv_price( wpinv_format_amount( $subtotal ), $currency );
398
+    $subtotal   = isset($item['subtotal']) ? $item['subtotal'] : 0;
399
+    $subtotal   = wpinv_price(wpinv_format_amount($subtotal), $currency);
400 400
 
401
-    return apply_filters( 'wpinv_cart_item_subtotal_label', $subtotal, $item );
401
+    return apply_filters('wpinv_cart_item_subtotal_label', $subtotal, $item);
402 402
 }
403 403
 
404
-function wpinv_cart_item_tax( $item, $currency = '' ) {
404
+function wpinv_cart_item_tax($item, $currency = '') {
405 405
     $tax        = '';
406 406
     $tax_rate   = '';
407 407
 
408
-    if( empty( $currency ) ) {
408
+    if (empty($currency)) {
409 409
         $currency = wpinv_get_currency();
410 410
     }
411 411
     
412
-    if ( isset( $item['tax'] ) && $item['tax'] > 0 && $item['subtotal'] > 0 ) {
413
-        $tax      = wpinv_price( wpinv_format_amount( $item['tax'] ), $currency );
414
-        $tax_rate = !empty( $item['vat_rate'] ) ? $item['vat_rate'] : ( $item['tax'] / $item['subtotal'] ) * 100;
415
-        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
412
+    if (isset($item['tax']) && $item['tax'] > 0 && $item['subtotal'] > 0) {
413
+        $tax      = wpinv_price(wpinv_format_amount($item['tax']), $currency);
414
+        $tax_rate = !empty($item['vat_rate']) ? $item['vat_rate'] : ($item['tax'] / $item['subtotal']) * 100;
415
+        $tax_rate = $tax_rate > 0 ? (float) wpinv_round_amount($tax_rate, 4) : '';
416 416
         $tax_rate = $tax_rate != '' ? ' <small class="tax-rate normal small">(' . $tax_rate . '%)</small>' : '';
417 417
     }
418 418
     
419
-    $tax        = $tax . $tax_rate;
419
+    $tax = $tax . $tax_rate;
420 420
     
421
-    if ( $tax === '' ) {
421
+    if ($tax === '') {
422 422
         $tax = 0; // Zero tax
423 423
     }
424 424
 
425
-    return apply_filters( 'wpinv_cart_item_tax_label', $tax, $item );
425
+    return apply_filters('wpinv_cart_item_tax_label', $tax, $item);
426 426
 }
427 427
 
428 428
 /**
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
  * @param WPInv_Item|int $item
432 432
  * @param bool $html
433 433
  */
434
-function wpinv_get_item_suffix( $item, $html = true ) {
434
+function wpinv_get_item_suffix($item, $html = true) {
435 435
 
436
-    $item   = new WPInv_Item( $item );
437
-    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '';
438
-    $suffix = $html ? $suffix : strip_tags( $suffix );
436
+    $item   = new WPInv_Item($item);
437
+    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __('(r)', 'invoicing') . '</span>' : '';
438
+    $suffix = $html ? $suffix : strip_tags($suffix);
439 439
 
440
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
440
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
441 441
 }
442 442
 
443 443
 /**
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
  * @param WPInv_Item|int $item
447 447
  * @param bool $force_delete
448 448
  */
449
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
450
-    $item = new WPInv_Item( $item );
451
-    $item->delete( $force_delete );
449
+function wpinv_remove_item($item = 0, $force_delete = false) {
450
+    $item = new WPInv_Item($item);
451
+    $item->delete($force_delete);
452 452
 }
453 453
 
454 454
 /**
@@ -487,45 +487,45 @@  discard block
 block discarded – undo
487 487
  * @param bool $wp_error whether or not to return a WP_Error on failure.
488 488
  * @return bool|WP_Error|WPInv_Item
489 489
  */
490
-function wpinv_create_item( $args = array(), $wp_error = false ) {
490
+function wpinv_create_item($args = array(), $wp_error = false) {
491 491
 
492 492
     // Prepare the item.
493
-    if ( ! empty( $args['custom_id'] ) && empty( $args['ID'] ) ) {
494
-        $type = empty( $args['type'] ) ? 'custom' : $args['type'];
495
-        $item = wpinv_get_item_by( 'custom_id', $args['custom_id'], $type );
493
+    if (!empty($args['custom_id']) && empty($args['ID'])) {
494
+        $type = empty($args['type']) ? 'custom' : $args['type'];
495
+        $item = wpinv_get_item_by('custom_id', $args['custom_id'], $type);
496 496
 
497
-        if ( ! empty( $item ) ) {
497
+        if (!empty($item)) {
498 498
             $args['ID'] = $item->get_id();
499 499
         }
500 500
 
501 501
     }
502 502
 
503 503
     // Do we have an item?
504
-    if ( ! empty( $args['ID'] ) ) {
505
-        $item = new WPInv_Item( $args['ID'] );
504
+    if (!empty($args['ID'])) {
505
+        $item = new WPInv_Item($args['ID']);
506 506
     } else {
507 507
         $item = new WPInv_Item();
508 508
     }
509 509
 
510 510
     // Do we have an error?
511
-    if ( ! empty( $item->last_error ) ) {
512
-        return $wp_error ? new WP_Error( 'invalid_item', $item->last_error ) : false;
511
+    if (!empty($item->last_error)) {
512
+        return $wp_error ? new WP_Error('invalid_item', $item->last_error) : false;
513 513
     }
514 514
 
515 515
     // Update item props.
516
-    $item->set_props( $args );
516
+    $item->set_props($args);
517 517
 
518 518
     // Save the item.
519 519
     $item->save();
520 520
 
521 521
     // Do we have an error?
522
-    if ( ! empty( $item->last_error ) ) {
523
-        return $wp_error ? new WP_Error( 'not_saved', $item->last_error ) : false;
522
+    if (!empty($item->last_error)) {
523
+        return $wp_error ? new WP_Error('not_saved', $item->last_error) : false;
524 524
     }
525 525
 
526 526
     // Was the item saved?
527
-    if ( ! $item->get_id() ) {
528
-        return $wp_error ? new WP_Error( 'not_saved', __( 'An error occured while saving the item', 'invoicing' ) ) : false;
527
+    if (!$item->get_id()) {
528
+        return $wp_error ? new WP_Error('not_saved', __('An error occured while saving the item', 'invoicing')) : false;
529 529
     }
530 530
 
531 531
     return $item;
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
  * 
538 538
  * @see wpinv_create_item()
539 539
  */
540
-function wpinv_update_item( $args = array(), $wp_error = false ) {
541
-    return wpinv_create_item( $args, $wp_error );
540
+function wpinv_update_item($args = array(), $wp_error = false) {
541
+    return wpinv_create_item($args, $wp_error);
542 542
 }
543 543
 
544 544
 /**
545 545
  * Sanitizes a recurring period
546 546
  */
547
-function getpaid_sanitize_recurring_period( $period, $full = false ) {
547
+function getpaid_sanitize_recurring_period($period, $full = false) {
548 548
 
549 549
     $periods = array(
550 550
         'D' => 'day',
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
         'Y' => 'year',
554 554
     );
555 555
 
556
-    if ( ! isset( $periods[ $period ] ) ) {
556
+    if (!isset($periods[$period])) {
557 557
         $period = 'D';
558 558
     }
559 559
 
560
-    return $full ? $periods[ $period ] : $period;
560
+    return $full ? $periods[$period] : $period;
561 561
 
562 562
 }
563 563
 
@@ -566,34 +566,34 @@  discard block
 block discarded – undo
566 566
  * 
567 567
  * @param WPInv_Item|GetPaid_Form_Item $item
568 568
  */
569
-function getpaid_item_recurring_price_help_text( $item, $currency = '' ) {
569
+function getpaid_item_recurring_price_help_text($item, $currency = '') {
570 570
 
571 571
     // Abort if it is not recurring.
572
-    if ( ! $item->is_recurring() ) {
572
+    if (!$item->is_recurring()) {
573 573
         return '';
574 574
     }
575 575
 
576
-    $initial_price   = wpinv_price( $item->get_initial_price(), $currency );
577
-    $recurring_price = wpinv_price( $item->get_recurring_price(), $currency );
578
-    $period          = getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' );
576
+    $initial_price   = wpinv_price($item->get_initial_price(), $currency);
577
+    $recurring_price = wpinv_price($item->get_recurring_price(), $currency);
578
+    $period          = getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '');
579 579
     $initial_class   = 'getpaid-item-initial-price';
580 580
     $recurring_class = 'getpaid-item-recurring-price';
581 581
 
582
-    if ( $item instanceof GetPaid_Form_Item ) {
583
-        $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
584
-        $recurring_price = wpinv_price( $item->get_recurring_sub_total(), $currency );
582
+    if ($item instanceof GetPaid_Form_Item) {
583
+        $initial_price   = wpinv_price($item->get_sub_total(), $currency);
584
+        $recurring_price = wpinv_price($item->get_recurring_sub_total(), $currency);
585 585
     }
586 586
 
587 587
     // For free trial items.
588
-    if ( $item->has_free_trial() ) {
589
-        $trial_period = getpaid_get_subscription_period_label( $item->get_trial_period(), $item->get_trial_interval() );
588
+    if ($item->has_free_trial()) {
589
+        $trial_period = getpaid_get_subscription_period_label($item->get_trial_period(), $item->get_trial_interval());
590 590
 
591
-        if ( 0 == $item->get_initial_price() ) {
591
+        if (0 == $item->get_initial_price()) {
592 592
 
593 593
             return sprintf(
594 594
 
595 595
                 // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period
596
-                _x( 'Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing' ),
596
+                _x('Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing'),
597 597
                 $trial_period,
598 598
                 "<span class='$recurring_class'>$recurring_price</span>",
599 599
                 $period
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
         return sprintf(
606 606
 
607 607
             // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period
608
-            _x( '%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing' ),
608
+            _x('%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing'),
609 609
             "<span class='$initial_class'>$initial_price</span>",
610 610
             $trial_period,
611 611
             "<span class='$recurring_class'>$recurring_price</span>",
@@ -615,12 +615,12 @@  discard block
 block discarded – undo
615 615
 
616 616
     }
617 617
 
618
-    if ( $initial_price == $recurring_price ) {
618
+    if ($initial_price == $recurring_price) {
619 619
 
620 620
         return sprintf(
621 621
 
622 622
             // translators: $1: is the recurring price, $2: is the susbcription period
623
-            _x( '%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing' ),
623
+            _x('%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing'),
624 624
             "<span class='$recurring_class'>$recurring_price</span>",
625 625
             $period
626 626
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     return sprintf(
632 632
 
633 633
         // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period
634
-        _x( 'Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing' ),
634
+        _x('Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing'),
635 635
         "<span class='$initial_class'>$initial_price</span>",
636 636
         "<span class='$recurring_class'>$recurring_price</span>",
637 637
         $period
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 1 patch
Spacing   +484 added lines, -484 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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 8
 
9 9
 	/**
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 		/**
38 38
 		 * Take the array options and use them to build.
39 39
 		 */
40
-		public function __construct( $options ) {
40
+		public function __construct($options) {
41 41
 			global $sd_widgets;
42 42
 
43
-			$sd_widgets[ $options['base_id'] ] = array(
43
+			$sd_widgets[$options['base_id']] = array(
44 44
 				'name'       => $options['name'],
45 45
 				'class_name' => $options['class_name']
46 46
 			);
47
-			$this->base_id                     = $options['base_id'];
47
+			$this->base_id = $options['base_id'];
48 48
 			// lets filter the options before we do anything
49
-			$options       = apply_filters( "wp_super_duper_options", $options );
50
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
51
-			$options       = $this->add_name_from_key( $options );
49
+			$options       = apply_filters("wp_super_duper_options", $options);
50
+			$options       = apply_filters("wp_super_duper_options_{$this->base_id}", $options);
51
+			$options       = $this->add_name_from_key($options);
52 52
 			$this->options = $options;
53 53
 
54 54
 			$this->base_id   = $options['base_id'];
55
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
55
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
56 56
 
57 57
 			// init parent
58
-			parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
58
+			parent::__construct($options['base_id'], $options['name'], $options['widget_ops']);
59 59
 
60
-			if ( isset( $options['class_name'] ) ) {
60
+			if (isset($options['class_name'])) {
61 61
 				// register widget
62 62
 				$this->class_name = $options['class_name'];
63 63
 
@@ -65,66 +65,66 @@  discard block
 block discarded – undo
65 65
 				$this->register_shortcode();
66 66
 
67 67
 				// Fusion Builder (avada) support
68
-				if ( function_exists( 'fusion_builder_map' ) ) {
69
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
68
+				if (function_exists('fusion_builder_map')) {
69
+					add_action('init', array($this, 'register_fusion_element'));
70 70
 				}
71 71
 
72 72
 				// register block
73
-				add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
73
+				add_action('admin_enqueue_scripts', array($this, 'register_block'));
74 74
 			}
75 75
 
76 76
 			// add the CSS and JS we need ONCE
77 77
 			global $sd_widget_scripts;
78 78
 
79
-			if ( ! $sd_widget_scripts ) {
80
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
81
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
82
-				wp_add_inline_style( 'widgets', $this->widget_css() );
79
+			if (!$sd_widget_scripts) {
80
+				wp_add_inline_script('admin-widgets', $this->widget_js());
81
+				wp_add_inline_script('customize-controls', $this->widget_js());
82
+				wp_add_inline_style('widgets', $this->widget_css());
83 83
 
84 84
 				// maybe add elementor editor styles
85
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
85
+				add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles'));
86 86
 
87 87
 				$sd_widget_scripts = true;
88 88
 
89 89
 				// add shortcode insert button once
90
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
90
+				add_action('media_buttons', array($this, 'shortcode_insert_button'));
91 91
 				// generatepress theme sections compatibility
92
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
93
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
92
+				if (function_exists('generate_sections_sections_metabox')) {
93
+					add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script'));
94 94
 				}
95
-				if ( $this->is_preview() ) {
96
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
95
+				if ($this->is_preview()) {
96
+					add_action('wp_footer', array($this, 'shortcode_insert_button_script'));
97 97
 					// this makes the insert button work for elementor
98
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
98
+					add_action('elementor/editor/after_enqueue_scripts', array(
99 99
 						$this,
100 100
 						'shortcode_insert_button_script'
101
-					) ); // for elementor
101
+					)); // for elementor
102 102
 				}
103 103
 				// this makes the insert button work for cornerstone
104
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
104
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder'));
105 105
 
106
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
107
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
106
+				add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings'));
107
+				add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker'));
108 108
 
109 109
 				// add generator text to admin head
110
-				add_action( 'admin_head', array( $this, 'generator' ) );
110
+				add_action('admin_head', array($this, 'generator'));
111 111
 			}
112 112
 
113
-			do_action( 'wp_super_duper_widget_init', $options, $this );
113
+			do_action('wp_super_duper_widget_init', $options, $this);
114 114
 		}
115 115
 
116 116
 		/**
117 117
 		 * Add our widget CSS to elementor editor.
118 118
 		 */
119 119
 		public function elementor_editor_styles() {
120
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
120
+			wp_add_inline_style('elementor-editor', $this->widget_css(false));
121 121
 		}
122 122
 
123 123
 		public function register_fusion_element() {
124 124
 
125 125
 			$options = $this->options;
126 126
 
127
-			if ( $this->base_id ) {
127
+			if ($this->base_id) {
128 128
 
129 129
 				$params = $this->get_fusion_params();
130 130
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 					'allow_generator' => true,
136 136
 				);
137 137
 
138
-				if ( ! empty( $params ) ) {
138
+				if (!empty($params)) {
139 139
 					$args['params'] = $params;
140 140
 				}
141 141
 
142
-				fusion_builder_map( $args );
142
+				fusion_builder_map($args);
143 143
 			}
144 144
 
145 145
 		}
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 			$params    = array();
149 149
 			$arguments = $this->get_arguments();
150 150
 
151
-			if ( ! empty( $arguments ) ) {
152
-				foreach ( $arguments as $key => $val ) {
151
+			if (!empty($arguments)) {
152
+				foreach ($arguments as $key => $val) {
153 153
 					$param = array();
154 154
 					// type
155 155
 					$param['type'] = str_replace(
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 						$val['type'] );
172 172
 
173 173
 					// multiselect
174
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
174
+					if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) {
175 175
 						$param['type']     = 'multiple_select';
176 176
 						$param['multiple'] = true;
177 177
 					}
@@ -180,29 +180,29 @@  discard block
 block discarded – undo
180 180
 					$param['heading'] = $val['title'];
181 181
 
182 182
 					// description
183
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
183
+					$param['description'] = isset($val['desc']) ? $val['desc'] : '';
184 184
 
185 185
 					// param_name
186 186
 					$param['param_name'] = $key;
187 187
 
188 188
 					// Default
189
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
189
+					$param['default'] = isset($val['default']) ? $val['default'] : '';
190 190
 
191 191
 					// Group
192
-					if ( isset( $val['group'] ) ) {
192
+					if (isset($val['group'])) {
193 193
 						$param['group'] = $val['group'];
194 194
 					}
195 195
 
196 196
 					// value
197
-					if ( $val['type'] == 'checkbox' ) {
198
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
199
-							unset( $param['default'] );
197
+					if ($val['type'] == 'checkbox') {
198
+						if (isset($val['default']) && $val['default'] == '0') {
199
+							unset($param['default']);
200 200
 						}
201
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
202
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
203
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
201
+						$param['value'] = array('' => __("No"), '1' => __("Yes"));
202
+					} elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') {
203
+						$param['value'] = isset($val['options']) ? $val['options'] : array();
204 204
 					} else {
205
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
205
+						$param['value'] = isset($val['default']) ? $val['default'] : '';
206 206
 					}
207 207
 
208 208
 					// setup the param
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
220 220
 		 */
221 221
 		public static function maybe_cornerstone_builder() {
222
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
222
+			if (did_action('cornerstone_before_boot_app')) {
223 223
 				self::shortcode_insert_button_script();
224 224
 			}
225 225
 		}
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		 *
232 232
 		 * @return string
233 233
 		 */
234
-		public static function get_picker( $editor_id = '' ) {
234
+		public static function get_picker($editor_id = '') {
235 235
 
236 236
 			ob_start();
237
-			if ( isset( $_POST['editor_id'] ) ) {
238
-				$editor_id = esc_attr( $_POST['editor_id'] );
239
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
237
+			if (isset($_POST['editor_id'])) {
238
+				$editor_id = esc_attr($_POST['editor_id']);
239
+			} elseif (isset($_REQUEST['et_fb'])) {
240 240
 				$editor_id = 'main_content_content_vb_tiny_mce';
241 241
 			}
242 242
 
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 
246 246
 			<div class="sd-shortcode-left-wrap">
247 247
 				<?php
248
-				ksort( $sd_widgets );
248
+				ksort($sd_widgets);
249 249
 				//				print_r($sd_widgets);exit;
250
-				if ( ! empty( $sd_widgets ) ) {
250
+				if (!empty($sd_widgets)) {
251 251
 					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
252
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
253
-					foreach ( $sd_widgets as $shortcode => $class ) {
254
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
252
+					echo "<option>" . __('Select shortcode') . "</option>";
253
+					foreach ($sd_widgets as $shortcode => $class) {
254
+						echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
255 255
 					}
256 256
 					echo "</select>";
257 257
 
@@ -264,37 +264,37 @@  discard block
 block discarded – undo
264 264
 			<div class="sd-shortcode-right-wrap">
265 265
 				<textarea id='sd-shortcode-output' disabled></textarea>
266 266
 				<div id='sd-shortcode-output-actions'>
267
-					<?php if ( $editor_id != '' ) { ?>
267
+					<?php if ($editor_id != '') { ?>
268 268
 						<button class="button sd-insert-shortcode-button"
269
-						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
269
+						        onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) {
270 270
 							        echo "'" . $editor_id . "'";
271
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
271
+						        } ?>)"><?php _e('Insert shortcode'); ?></button>
272 272
 					<?php } ?>
273 273
 					<button class="button"
274
-					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
274
+					        onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button>
275 275
 				</div>
276 276
 			</div>
277 277
 			<?php
278 278
 
279 279
 			$html = ob_get_clean();
280 280
 
281
-			if ( wp_doing_ajax() ) {
281
+			if (wp_doing_ajax()) {
282 282
 				echo $html;
283 283
 				$should_die = true;
284 284
 
285 285
 				// some builder get the editor via ajax so we should not die on those ocasions
286 286
 				$dont_die = array(
287
-					'parent_tag',// WP Bakery
287
+					'parent_tag', // WP Bakery
288 288
 					'avia_request' // enfold
289 289
 				);
290 290
 
291
-				foreach ( $dont_die as $request ) {
292
-					if ( isset( $_REQUEST[ $request ] ) ) {
291
+				foreach ($dont_die as $request) {
292
+					if (isset($_REQUEST[$request])) {
293 293
 						$should_die = false;
294 294
 					}
295 295
 				}
296 296
 
297
-				if ( $should_die ) {
297
+				if ($should_die) {
298 298
 					wp_die();
299 299
 				}
300 300
 
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 		public static function get_widget_settings() {
322 322
 			global $sd_widgets;
323 323
 
324
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
325
-			if ( ! $shortcode ) {
324
+			$shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : '';
325
+			if (!$shortcode) {
326 326
 				wp_die();
327 327
 			}
328
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
329
-			if ( ! $widget_args ) {
328
+			$widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : '';
329
+			if (!$widget_args) {
330 330
 				wp_die();
331 331
 			}
332
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
-			if ( ! $class_name ) {
332
+			$class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
+			if (!$class_name) {
334 334
 				wp_die();
335 335
 			}
336 336
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			$widget = new $class_name;
339 339
 
340 340
 			ob_start();
341
-			$widget->form( array() );
341
+			$widget->form(array());
342 342
 			$form = ob_get_clean();
343 343
 			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
344 344
 			echo "<style>" . $widget->widget_css() . "</style>";
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 		 * @param string $editor_id Optional. Shortcode editor id. Default null.
357 357
 		 * @param string $insert_shortcode_function Optional. Insert shotcode function. Default null.
358 358
 		 */
359
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
359
+		public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
360 360
 			global $sd_widgets, $shortcode_insert_button_once;
361
-			if ( $shortcode_insert_button_once ) {
361
+			if ($shortcode_insert_button_once) {
362 362
 				return;
363 363
 			}
364 364
 			add_thickbox();
@@ -368,21 +368,21 @@  discard block
 block discarded – undo
368 368
 			 * Cornerstone makes us play dirty tricks :/
369 369
 			 * 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.
370 370
 			 */
371
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
371
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
372 372
 				echo '<span id="insert-media-button">';
373 373
 			}
374 374
 
375
-			echo self::shortcode_button( 'this', 'true' );
375
+			echo self::shortcode_button('this', 'true');
376 376
 
377 377
 			// see opening note
378
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
378
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
379 379
 				echo '</span>'; // end #insert-media-button
380 380
 			}
381 381
 
382 382
 			// Add separate script for generatepress theme sections
383
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
383
+			if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) {
384 384
 			} else {
385
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
385
+				self::shortcode_insert_button_script($editor_id, $insert_shortcode_function);
386 386
 			}
387 387
 
388 388
 			$shortcode_insert_button_once = true;
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 		 *
397 397
 		 * @return mixed
398 398
 		 */
399
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
399
+		public static function shortcode_button($id = '', $search_for_id = '') {
400 400
 			ob_start();
401 401
 			?>
402 402
 			<span class="sd-lable-shortcode-inserter">
403 403
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
404
-				if ( $search_for_id ) {
404
+				if ($search_for_id) {
405 405
 					echo "," . $search_for_id;
406 406
 				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
407 407
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			$html = ob_get_clean();
418 418
 
419 419
 			// remove line breaks so we can use it in js
420
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
420
+			return preg_replace("/\r|\n/", "", trim($html));
421 421
 		}
422 422
 
423 423
 		/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 						jQuery($this).data('sd-widget-enabled', true);
476 476
 					}
477 477
 
478
-					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>';
478
+					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>';
479 479
 					var form = jQuery($this).parents('' + $selector + '');
480 480
 
481 481
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
513 513
 			 */
514 514
 
515
-			return str_replace( array(
515
+			return str_replace(array(
516 516
 				'<script>',
517 517
 				'</script>'
518
-			), '', $output );
518
+			), '', $output);
519 519
 		}
520 520
 
521 521
 		/**
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		 * @param string $editor_id
527 527
 		 * @param string $insert_shortcode_function
528 528
 		 */
529
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
529
+		public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') {
530 530
 			?>
531 531
 			<style>
532 532
 				.sd-shortcode-left-wrap {
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 					width: 100%;
646 646
 				}
647 647
 
648
-				<?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?>
648
+				<?php if (function_exists('generate_sections_sections_metabox')) { ?>
649 649
 				.generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter {
650 650
 					display: inline;
651 651
 				}
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
 				<?php } ?>
654 654
 			</style>
655 655
 			<?php
656
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
656
+			if (class_exists('SiteOrigin_Panels')) {
657 657
 				echo "<script>" . self::siteorigin_js() . "</script>";
658 658
 			}
659 659
 			?>
660 660
 			<script>
661 661
 				<?php
662
-				if(! empty( $insert_shortcode_function )){
662
+				if (!empty($insert_shortcode_function)) {
663 663
 					echo $insert_shortcode_function;
664
-				}else{
664
+				} else {
665 665
 
666 666
 				/**
667 667
 				 * Function for super duper insert shortcode.
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
 					if ($shortcode) {
675 675
 						if (!$editor_id) {
676 676
 							<?php
677
-							if ( isset( $_REQUEST['et_fb'] ) ) {
677
+							if (isset($_REQUEST['et_fb'])) {
678 678
 								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
679
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
679
+							} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') {
680 680
 								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
681 681
 							} else {
682 682
 								echo '$editor_id = "#wp-content-editor-container textarea";';
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 							'shortcode': $short_code,
762 762
 							'attributes': 123,
763 763
 							'post_id': 321,
764
-							'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
764
+							'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
765 765
 						};
766 766
 
767 767
 						if (typeof ajaxurl === 'undefined') {
768
-							var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>";
768
+							var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
769 769
 						}
770 770
 
771 771
 						jQuery.post(ajaxurl, data, function (response) {
@@ -974,11 +974,11 @@  discard block
 block discarded – undo
974 974
 					var data = {
975 975
 						'action': 'super_duper_get_picker',
976 976
 						'editor_id': $id,
977
-						'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>'
977
+						'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>'
978 978
 					};
979 979
 
980 980
 					if (!ajaxurl) {
981
-						var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
981
+						var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
982 982
 					}
983 983
 
984 984
 					jQuery.post(ajaxurl, data, function (response) {
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
 				 */
1000 1000
 				function sd_shortcode_button($id) {
1001 1001
 					if ($id) {
1002
-						return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>';
1002
+						return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>';
1003 1003
 					} else {
1004
-						return '<?php echo self::shortcode_button();?>';
1004
+						return '<?php echo self::shortcode_button(); ?>';
1005 1005
 					}
1006 1006
 				}
1007 1007
 
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 		 *
1017 1017
 		 * @return mixed
1018 1018
 		 */
1019
-		public function widget_css( $advanced = true ) {
1019
+		public function widget_css($advanced = true) {
1020 1020
 			ob_start();
1021 1021
 			?>
1022 1022
 			<style>
1023
-				<?php if( $advanced ){ ?>
1023
+				<?php if ($advanced) { ?>
1024 1024
 				.sd-advanced-setting {
1025 1025
 					display: none;
1026 1026
 				}
@@ -1062,10 +1062,10 @@  discard block
 block discarded – undo
1062 1062
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1063 1063
 			 */
1064 1064
 
1065
-			return str_replace( array(
1065
+			return str_replace(array(
1066 1066
 				'<style>',
1067 1067
 				'</style>'
1068
-			), '', $output );
1068
+			), '', $output);
1069 1069
 		}
1070 1070
 
1071 1071
 		/**
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 						jQuery($this).data('sd-widget-enabled', true);
1136 1136
 					}
1137 1137
 
1138
-					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>';
1138
+					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>';
1139 1139
 					var form = jQuery($this).parents('' + $selector + '');
1140 1140
 
1141 1141
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 					});
1228 1228
 
1229 1229
 				}
1230
-				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1230
+				<?php do_action('wp_super_duper_widget_js', $this); ?>
1231 1231
 			</script>
1232 1232
 			<?php
1233 1233
 			$output = ob_get_clean();
@@ -1236,10 +1236,10 @@  discard block
 block discarded – undo
1236 1236
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1237 1237
 			 */
1238 1238
 
1239
-			return str_replace( array(
1239
+			return str_replace(array(
1240 1240
 				'<script>',
1241 1241
 				'</script>'
1242
-			), '', $output );
1242
+			), '', $output);
1243 1243
 		}
1244 1244
 
1245 1245
 
@@ -1250,14 +1250,14 @@  discard block
 block discarded – undo
1250 1250
 		 *
1251 1251
 		 * @return mixed
1252 1252
 		 */
1253
-		private function add_name_from_key( $options, $arguments = false ) {
1254
-			if ( ! empty( $options['arguments'] ) ) {
1255
-				foreach ( $options['arguments'] as $key => $val ) {
1256
-					$options['arguments'][ $key ]['name'] = $key;
1253
+		private function add_name_from_key($options, $arguments = false) {
1254
+			if (!empty($options['arguments'])) {
1255
+				foreach ($options['arguments'] as $key => $val) {
1256
+					$options['arguments'][$key]['name'] = $key;
1257 1257
 				}
1258
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1259
-				foreach ( $options as $key => $val ) {
1260
-					$options[ $key ]['name'] = $key;
1258
+			} elseif ($arguments && is_array($options) && !empty($options)) {
1259
+				foreach ($options as $key => $val) {
1260
+					$options[$key]['name'] = $key;
1261 1261
 				}
1262 1262
 			}
1263 1263
 
@@ -1270,8 +1270,8 @@  discard block
 block discarded – undo
1270 1270
 		 * @since 1.0.0
1271 1271
 		 */
1272 1272
 		public function register_shortcode() {
1273
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1274
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) );
1273
+			add_shortcode($this->base_id, array($this, 'shortcode_output'));
1274
+			add_action('wp_ajax_super_duper_output_shortcode', array(__CLASS__, 'render_shortcode'));
1275 1275
 		}
1276 1276
 
1277 1277
 		/**
@@ -1281,33 +1281,33 @@  discard block
 block discarded – undo
1281 1281
 		 */
1282 1282
 		public static function render_shortcode() {
1283 1283
 
1284
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1285
-			if ( ! current_user_can( 'manage_options' ) ) {
1284
+			check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
1285
+			if (!current_user_can('manage_options')) {
1286 1286
 				wp_die();
1287 1287
 			}
1288 1288
 
1289 1289
 			// we might need the $post value here so lets set it.
1290
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1291
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1292
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1290
+			if (isset($_POST['post_id']) && $_POST['post_id']) {
1291
+				$post_obj = get_post(absint($_POST['post_id']));
1292
+				if (!empty($post_obj) && empty($post)) {
1293 1293
 					global $post;
1294 1294
 					$post = $post_obj;
1295 1295
 				}
1296 1296
 			}
1297 1297
 
1298
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1299
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1300
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1298
+			if (isset($_POST['shortcode']) && $_POST['shortcode']) {
1299
+				$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
1300
+				$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
1301 1301
 				$attributes       = '';
1302
-				if ( ! empty( $attributes_array ) ) {
1303
-					foreach ( $attributes_array as $key => $value ) {
1304
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . wp_slash( $value ) . "' ";
1302
+				if (!empty($attributes_array)) {
1303
+					foreach ($attributes_array as $key => $value) {
1304
+						$attributes .= " " . sanitize_title_with_dashes($key) . "='" . wp_slash($value) . "' ";
1305 1305
 					}
1306 1306
 				}
1307 1307
 
1308 1308
 				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1309 1309
 
1310
-				echo do_shortcode( $shortcode );
1310
+				echo do_shortcode($shortcode);
1311 1311
 
1312 1312
 			}
1313 1313
 			wp_die();
@@ -1321,45 +1321,45 @@  discard block
 block discarded – undo
1321 1321
 		 *
1322 1322
 		 * @return string
1323 1323
 		 */
1324
-		public function shortcode_output( $args = array(), $content = '' ) {
1325
-			$args = $this->argument_values( $args );
1324
+		public function shortcode_output($args = array(), $content = '') {
1325
+			$args = $this->argument_values($args);
1326 1326
 
1327 1327
 			// add extra argument so we know its a output to gutenberg
1328 1328
 			//$args
1329
-			$args = $this->string_to_bool( $args );
1329
+			$args = $this->string_to_bool($args);
1330 1330
 
1331 1331
 			// if we have a enclosed shortcode we add it to the special `html` argument
1332
-			if ( ! empty( $content ) ) {
1332
+			if (!empty($content)) {
1333 1333
 				$args['html'] = $content;
1334 1334
 			}
1335 1335
 
1336
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1337
-			$class .= " sdel-".$this->get_instance_hash();
1336
+			$class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : '';
1337
+			$class .= " sdel-" . $this->get_instance_hash();
1338 1338
 
1339
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1340
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1339
+			$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
1340
+			$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
1341 1341
 
1342
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1343
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); //@todo this does not seem right @kiran?
1342
+			$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
1343
+			$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); //@todo this does not seem right @kiran?
1344 1344
 
1345 1345
 			$shortcode_args = array();
1346 1346
 			$output         = '';
1347
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1348
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1347
+			$no_wrap        = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1348
+			if (isset($args['no_wrap']) && $args['no_wrap']) {
1349 1349
 				$no_wrap = true;
1350 1350
 			}
1351
-			$main_content = $this->output( $args, $shortcode_args, $content );
1352
-			if ( $main_content && ! $no_wrap ) {
1351
+			$main_content = $this->output($args, $shortcode_args, $content);
1352
+			if ($main_content && !$no_wrap) {
1353 1353
 				// wrap the shortcode in a div with the same class as the widget
1354 1354
 				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1355
-				if ( ! empty( $args['title'] ) ) {
1355
+				if (!empty($args['title'])) {
1356 1356
 					// if its a shortcode and there is a title try to grab the title wrappers
1357
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1358
-					if ( empty( $instance ) ) {
1357
+					$shortcode_args = array('before_title' => '', 'after_title' => '');
1358
+					if (empty($instance)) {
1359 1359
 						global $wp_registered_sidebars;
1360
-						if ( ! empty( $wp_registered_sidebars ) ) {
1361
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1362
-								if ( ! empty( $sidebar['before_title'] ) ) {
1360
+						if (!empty($wp_registered_sidebars)) {
1361
+							foreach ($wp_registered_sidebars as $sidebar) {
1362
+								if (!empty($sidebar['before_title'])) {
1363 1363
 									$shortcode_args['before_title'] = $sidebar['before_title'];
1364 1364
 									$shortcode_args['after_title']  = $sidebar['after_title'];
1365 1365
 									break;
@@ -1367,20 +1367,20 @@  discard block
 block discarded – undo
1367 1367
 							}
1368 1368
 						}
1369 1369
 					}
1370
-					$output .= $this->output_title( $shortcode_args, $args );
1370
+					$output .= $this->output_title($shortcode_args, $args);
1371 1371
 				}
1372 1372
 				$output .= $main_content;
1373 1373
 				$output .= '</div>';
1374
-			} elseif ( $main_content && $no_wrap ) {
1374
+			} elseif ($main_content && $no_wrap) {
1375 1375
 				$output .= $main_content;
1376 1376
 			}
1377 1377
 
1378 1378
 			// if preview show a placeholder if empty
1379
-			if ( $this->is_preview() && $output == '' ) {
1380
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1379
+			if ($this->is_preview() && $output == '') {
1380
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
1381 1381
 			}
1382 1382
 
1383
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1383
+			return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this);
1384 1384
 		}
1385 1385
 
1386 1386
 		/**
@@ -1390,8 +1390,8 @@  discard block
 block discarded – undo
1390 1390
 		 *
1391 1391
 		 * @return string
1392 1392
 		 */
1393
-		public function preview_placeholder_text( $name = '' ) {
1394
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1393
+		public function preview_placeholder_text($name = '') {
1394
+			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>";
1395 1395
 		}
1396 1396
 
1397 1397
 		/**
@@ -1401,13 +1401,13 @@  discard block
 block discarded – undo
1401 1401
 		 *
1402 1402
 		 * @return mixed
1403 1403
 		 */
1404
-		public function string_to_bool( $options ) {
1404
+		public function string_to_bool($options) {
1405 1405
 			// convert bool strings to booleans
1406
-			foreach ( $options as $key => $val ) {
1407
-				if ( $val == 'false' ) {
1408
-					$options[ $key ] = false;
1409
-				} elseif ( $val == 'true' ) {
1410
-					$options[ $key ] = true;
1406
+			foreach ($options as $key => $val) {
1407
+				if ($val == 'false') {
1408
+					$options[$key] = false;
1409
+				} elseif ($val == 'true') {
1410
+					$options[$key] = true;
1411 1411
 				}
1412 1412
 			}
1413 1413
 
@@ -1423,26 +1423,26 @@  discard block
 block discarded – undo
1423 1423
 		 *
1424 1424
 		 * @return array
1425 1425
 		 */
1426
-		public function argument_values( $instance ) {
1426
+		public function argument_values($instance) {
1427 1427
 			$argument_values = array();
1428 1428
 
1429 1429
 			// set widget instance
1430 1430
 			$this->instance = $instance;
1431 1431
 
1432
-			if ( empty( $this->arguments ) ) {
1432
+			if (empty($this->arguments)) {
1433 1433
 				$this->arguments = $this->get_arguments();
1434 1434
 			}
1435 1435
 
1436
-			if ( ! empty( $this->arguments ) ) {
1437
-				foreach ( $this->arguments as $key => $args ) {
1436
+			if (!empty($this->arguments)) {
1437
+				foreach ($this->arguments as $key => $args) {
1438 1438
 					// set the input name from the key
1439 1439
 					$args['name'] = $key;
1440 1440
 					//
1441
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1442
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1441
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
1442
+					if ($args['type'] == 'checkbox' && $argument_values[$key] == '') {
1443 1443
 						// don't set default for an empty checkbox
1444
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1445
-						$argument_values[ $key ] = $args['default'];
1444
+					} elseif ($argument_values[$key] == '' && isset($args['default'])) {
1445
+						$argument_values[$key] = $args['default'];
1446 1446
 					}
1447 1447
 				}
1448 1448
 			}
@@ -1469,12 +1469,12 @@  discard block
 block discarded – undo
1469 1469
 		 * @return array Get arguments.
1470 1470
 		 */
1471 1471
 		public function get_arguments() {
1472
-			if ( empty( $this->arguments ) ) {
1472
+			if (empty($this->arguments)) {
1473 1473
 				$this->arguments = $this->set_arguments();
1474 1474
 			}
1475 1475
 
1476
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1477
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1476
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
1477
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
1478 1478
 
1479 1479
 			return $this->arguments;
1480 1480
 		}
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 		 * @param array $widget_args
1487 1487
 		 * @param string $content
1488 1488
 		 */
1489
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1489
+		public function output($args = array(), $widget_args = array(), $content = '') {
1490 1490
 
1491 1491
 		}
1492 1492
 
@@ -1494,9 +1494,9 @@  discard block
 block discarded – undo
1494 1494
 		 * Add the dynamic block code inline when the wp-block in enqueued.
1495 1495
 		 */
1496 1496
 		public function register_block() {
1497
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1498
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1499
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1497
+			wp_add_inline_script('wp-blocks', $this->block());
1498
+			if (class_exists('SiteOrigin_Panels')) {
1499
+				wp_add_inline_script('wp-blocks', $this->siteorigin_js());
1500 1500
 			}
1501 1501
 		}
1502 1502
 
@@ -1510,13 +1510,13 @@  discard block
 block discarded – undo
1510 1510
 			$show      = false;
1511 1511
 			$arguments = $this->arguments;
1512 1512
 
1513
-			if ( empty( $arguments ) ) {
1513
+			if (empty($arguments)) {
1514 1514
 				$arguments = $this->get_arguments();
1515 1515
 			}
1516 1516
 
1517
-			if ( ! empty( $arguments ) ) {
1518
-				foreach ( $arguments as $argument ) {
1519
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1517
+			if (!empty($arguments)) {
1518
+				foreach ($arguments as $argument) {
1519
+					if (isset($argument['advanced']) && $argument['advanced']) {
1520 1520
 						$show = true;
1521 1521
 						break; // no need to continue if we know we have it
1522 1522
 					}
@@ -1535,15 +1535,15 @@  discard block
 block discarded – undo
1535 1535
 
1536 1536
 			$url = $this->url;
1537 1537
 
1538
-			if ( ! $url ) {
1538
+			if (!$url) {
1539 1539
 				// check if we are inside a plugin
1540
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1540
+				$file_dir = str_replace("/includes", "", dirname(__FILE__));
1541 1541
 
1542
-				$dir_parts = explode( "/wp-content/", $file_dir );
1543
-				$url_parts = explode( "/wp-content/", plugins_url() );
1542
+				$dir_parts = explode("/wp-content/", $file_dir);
1543
+				$url_parts = explode("/wp-content/", plugins_url());
1544 1544
 
1545
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1546
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1545
+				if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1546
+					$url       = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]);
1547 1547
 					$this->url = $url;
1548 1548
 				}
1549 1549
 			}
@@ -1564,46 +1564,46 @@  discard block
 block discarded – undo
1564 1564
 		 * @since 1.1.0
1565 1565
 		 * @return string
1566 1566
 		 */
1567
-		public function get_block_icon( $icon ) {
1567
+		public function get_block_icon($icon) {
1568 1568
 
1569 1569
 			// check if we have a Font Awesome icon
1570 1570
 			$fa_type = '';
1571
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1571
+			if (substr($icon, 0, 7) === "fas fa-") {
1572 1572
 				$fa_type = 'solid';
1573
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1573
+			} elseif (substr($icon, 0, 7) === "far fa-") {
1574 1574
 				$fa_type = 'regular';
1575
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1575
+			} elseif (substr($icon, 0, 7) === "fab fa-") {
1576 1576
 				$fa_type = 'brands';
1577 1577
 			} else {
1578 1578
 				$icon = "'" . $icon . "'";
1579 1579
 			}
1580 1580
 
1581 1581
 			// set the icon if we found one
1582
-			if ( $fa_type ) {
1583
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1582
+			if ($fa_type) {
1583
+				$fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon);
1584 1584
 				$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 . "'}))";
1585 1585
 			}
1586 1586
 
1587 1587
 			return $icon;
1588 1588
 		}
1589 1589
 
1590
-		public function group_arguments( $arguments ) {
1590
+		public function group_arguments($arguments) {
1591 1591
 //			echo '###';print_r($arguments);
1592
-			if ( ! empty( $arguments ) ) {
1592
+			if (!empty($arguments)) {
1593 1593
 				$temp_arguments = array();
1594
-				$general        = __( "General" );
1594
+				$general        = __("General");
1595 1595
 				$add_sections   = false;
1596
-				foreach ( $arguments as $key => $args ) {
1597
-					if ( isset( $args['group'] ) ) {
1598
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1596
+				foreach ($arguments as $key => $args) {
1597
+					if (isset($args['group'])) {
1598
+						$temp_arguments[$args['group']][$key] = $args;
1599 1599
 						$add_sections                             = true;
1600 1600
 					} else {
1601
-						$temp_arguments[ $general ][ $key ] = $args;
1601
+						$temp_arguments[$general][$key] = $args;
1602 1602
 					}
1603 1603
 				}
1604 1604
 
1605 1605
 				// only add sections if more than one
1606
-				if ( $add_sections ) {
1606
+				if ($add_sections) {
1607 1607
 					$arguments = $temp_arguments;
1608 1608
 				}
1609 1609
 			}
@@ -1647,9 +1647,9 @@  discard block
 block discarded – undo
1647 1647
 					var prev_attributes = [];
1648 1648
 
1649 1649
 					var term_query_type = '';
1650
-					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 "[]";} ?>;
1651
-					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
1652
-					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
1650
+					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 "[]"; } ?>;
1651
+					const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
1652
+					const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
1653 1653
 
1654 1654
 					/**
1655 1655
 					 * Register Basic Block.
@@ -1663,30 +1663,30 @@  discard block
 block discarded – undo
1663 1663
 					 * @return {?WPBlock}          The block, if it has been successfully
1664 1664
 					 *                             registered; otherwise `undefined`.
1665 1665
 					 */
1666
-					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.
1667
-						title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title.
1668
-						description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title.
1669
-						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/.
1666
+					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.
1667
+						title: '<?php echo addslashes($this->options['name']); ?>', // Block title.
1668
+						description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title.
1669
+						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/.
1670 1670
 						supports: {
1671 1671
 							<?php
1672
-							if ( isset( $this->options['block-supports'] ) ) {
1673
-								echo $this->array_to_attributes( $this->options['block-supports'] );
1672
+							if (isset($this->options['block-supports'])) {
1673
+								echo $this->array_to_attributes($this->options['block-supports']);
1674 1674
 							}
1675 1675
 							?>
1676 1676
 						},
1677
-						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.
1678
-						<?php if ( isset( $this->options['block-keywords'] ) ) {
1677
+						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.
1678
+						<?php if (isset($this->options['block-keywords'])) {
1679 1679
 						echo "keywords : " . $this->options['block-keywords'] . ",";
1680 1680
 					}?>
1681 1681
 
1682 1682
 						<?php
1683 1683
 
1684 1684
 						// maybe set no_wrap
1685
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1686
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
1685
+						$no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1686
+						if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) {
1687 1687
 							$no_wrap = true;
1688 1688
 						}
1689
-						if ( $no_wrap ) {
1689
+						if ($no_wrap) {
1690 1690
 							$this->options['block-wrap'] = '';
1691 1691
 						}
1692 1692
 
@@ -1699,10 +1699,10 @@  discard block
 block discarded – undo
1699 1699
 						echo "  html: false";
1700 1700
 						echo "},";*/
1701 1701
 
1702
-						if ( ! empty( $this->arguments ) ) {
1702
+						if (!empty($this->arguments)) {
1703 1703
 							echo "attributes : {";
1704 1704
 
1705
-							if ( $show_advanced ) {
1705
+							if ($show_advanced) {
1706 1706
 								echo "show_advanced: {";
1707 1707
 								echo "	type: 'boolean',";
1708 1708
 								echo "  default: false,";
@@ -1710,41 +1710,41 @@  discard block
 block discarded – undo
1710 1710
 							}
1711 1711
 
1712 1712
 							// block wrap element
1713
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
1713
+							if (!empty($this->options['block-wrap'])) { //@todo we should validate this?
1714 1714
 								echo "block_wrap: {";
1715 1715
 								echo "	type: 'string',";
1716
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
1716
+								echo "  default: '" . esc_attr($this->options['block-wrap']) . "',";
1717 1717
 								echo "},";
1718 1718
 							}
1719 1719
 
1720
-							foreach ( $this->arguments as $key => $args ) {
1720
+							foreach ($this->arguments as $key => $args) {
1721 1721
 
1722 1722
 								// set if we should show alignment
1723
-								if ( $key == 'alignment' ) {
1723
+								if ($key == 'alignment') {
1724 1724
 									$show_alignment = true;
1725 1725
 								}
1726 1726
 
1727 1727
 								$extra = '';
1728 1728
 
1729
-								if ( $args['type'] == 'checkbox' ) {
1729
+								if ($args['type'] == 'checkbox') {
1730 1730
 									$type    = 'boolean';
1731
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
1732
-								} elseif ( $args['type'] == 'number' ) {
1731
+									$default = isset($args['default']) && $args['default'] ? 'true' : 'false';
1732
+								} elseif ($args['type'] == 'number') {
1733 1733
 									$type    = 'number';
1734
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1735
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
1734
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1735
+								} elseif ($args['type'] == 'select' && !empty($args['multiple'])) {
1736 1736
 									$type = 'array';
1737
-									if ( is_array( $args['default'] ) ) {
1738
-										$default = isset( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
1737
+									if (is_array($args['default'])) {
1738
+										$default = isset($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]";
1739 1739
 									} else {
1740
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1740
+										$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1741 1741
 									}
1742
-								} elseif ( $args['type'] == 'multiselect' ) {
1742
+								} elseif ($args['type'] == 'multiselect') {
1743 1743
 									$type    = 'array';
1744
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1744
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1745 1745
 								} else {
1746 1746
 									$type    = 'string';
1747
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1747
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1748 1748
 								}
1749 1749
 								echo $key . " : {";
1750 1750
 								echo "type : '$type',";
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 							var $value = '';
1769 1769
 							<?php
1770 1770
 							// if we have a post_type and a category then link them
1771
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
1771
+							if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) {
1772 1772
 							?>
1773 1773
 							if(typeof(prev_attributes[props.id]) != 'undefined' ){
1774 1774
 								$pt = props.attributes.post_type;
@@ -1784,13 +1784,13 @@  discard block
 block discarded – undo
1784 1784
 
1785 1785
 								// taxonomies
1786 1786
 								if( $value && 'post_type' in prev_attributes[props.id] && 'category' in prev_attributes[props.id] && run ){
1787
-									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';} ?>"}).then(terms => {
1788
-										while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
1789
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
1787
+									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'; } ?>"}).then(terms => {
1788
+										while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) {
1789
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop();
1790 1790
 									}
1791
-									taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0});
1791
+									taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0});
1792 1792
 									jQuery.each( terms, function( key, val ) {
1793
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id});
1793
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id});
1794 1794
 									});
1795 1795
 
1796 1796
 									// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 									props.setAttributes({category: [0] });
1799 1799
 									props.setAttributes({category: $old_cat_value });
1800 1800
 
1801
-									return taxonomies_<?php echo str_replace("-","_", $this->id);?>;
1801
+									return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>;
1802 1802
 								});
1803 1803
 								}
1804 1804
 
@@ -1810,12 +1810,12 @@  discard block
 block discarded – undo
1810 1810
 									};
1811 1811
 									jQuery.post(ajaxurl, data, function(response) {
1812 1812
 										response = JSON.parse(response);
1813
-										while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) {
1814
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.pop();
1813
+										while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) {
1814
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop();
1815 1815
 										}
1816 1816
 
1817 1817
 										jQuery.each( response, function( key, val ) {
1818
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key});
1818
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key});
1819 1819
 										});
1820 1820
 
1821 1821
 										// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
 										props.setAttributes({sort_by: [0] });
1824 1824
 										props.setAttributes({sort_by: $old_sort_by_value });
1825 1825
 
1826
-										return sort_by_<?php echo str_replace("-","_", $this->id);?>;
1826
+										return sort_by_<?php echo str_replace("-", "_", $this->id); ?>;
1827 1827
 									});
1828 1828
 
1829 1829
 								}
@@ -1850,12 +1850,12 @@  discard block
 block discarded – undo
1850 1850
 									is_fetching = true;
1851 1851
 									var data = {
1852 1852
 										'action': 'super_duper_output_shortcode',
1853
-										'shortcode': '<?php echo $this->options['base_id'];?>',
1853
+										'shortcode': '<?php echo $this->options['base_id']; ?>',
1854 1854
 										'attributes': props.attributes,
1855
-										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
1855
+										'post_id': <?php global $post; if (isset($post->ID)) {
1856 1856
 										echo $post->ID;
1857 1857
 									}?>,
1858
-										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
1858
+										'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
1859 1859
 									};
1860 1860
 
1861 1861
 									jQuery.post(ajaxurl, data, function (response) {
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 
1865 1865
 										// if the content is empty then we place some placeholder text
1866 1866
 										if (env == '') {
1867
-											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>";
1867
+											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>";
1868 1868
 										}
1869 1869
 
1870 1870
 										props.setAttributes({content: env});
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 
1889 1889
 								el(wp.blockEditor.BlockControls, {key: 'controls'},
1890 1890
 
1891
-									<?php if($show_alignment){?>
1891
+									<?php if ($show_alignment) {?>
1892 1892
 									el(
1893 1893
 										wp.blockEditor.AlignmentToolbar,
1894 1894
 										{
@@ -1906,9 +1906,9 @@  discard block
 block discarded – undo
1906 1906
 
1907 1907
 									<?php
1908 1908
 
1909
-									if(! empty( $this->arguments )){
1909
+									if (!empty($this->arguments)) {
1910 1910
 
1911
-									if ( $show_advanced ) {
1911
+									if ($show_advanced) {
1912 1912
 									?>
1913 1913
 									el('div', {
1914 1914
 											style: {'padding-left': '16px','padding-right': '16px'}
@@ -1929,19 +1929,19 @@  discard block
 block discarded – undo
1929 1929
 
1930 1930
 									}
1931 1931
 
1932
-									$arguments = $this->group_arguments( $this->arguments );
1932
+									$arguments = $this->group_arguments($this->arguments);
1933 1933
 
1934 1934
 									// Do we have sections?
1935 1935
 									$has_sections = $arguments == $this->arguments ? false : true;
1936 1936
 
1937 1937
 
1938
-									if($has_sections){
1938
+									if ($has_sections) {
1939 1939
 									$panel_count = 0;
1940
-									foreach($arguments as $key => $args){
1940
+									foreach ($arguments as $key => $args) {
1941 1941
 									?>
1942 1942
 									el(wp.components.PanelBody, {
1943
-											title: '<?php esc_attr_e( $key ); ?>',
1944
-											initialOpen: <?php if ( $panel_count ) {
1943
+											title: '<?php esc_attr_e($key); ?>',
1944
+											initialOpen: <?php if ($panel_count) {
1945 1945
 											echo "false";
1946 1946
 										} else {
1947 1947
 											echo "true";
@@ -1949,24 +1949,24 @@  discard block
 block discarded – undo
1949 1949
 										},
1950 1950
 										<?php
1951 1951
 
1952
-										foreach ( $args as $k => $a ) {
1953
-											$this->build_block_arguments( $k, $a );
1952
+										foreach ($args as $k => $a) {
1953
+											$this->build_block_arguments($k, $a);
1954 1954
 										}
1955 1955
 										?>
1956 1956
 									),
1957 1957
 									<?php
1958
-									$panel_count ++;
1958
+									$panel_count++;
1959 1959
 
1960 1960
 									}
1961
-									}else {
1961
+									} else {
1962 1962
 									?>
1963 1963
 									el(wp.components.PanelBody, {
1964
-											title: '<?php esc_attr_e( "Settings" ); ?>',
1964
+											title: '<?php esc_attr_e("Settings"); ?>',
1965 1965
 											initialOpen: true
1966 1966
 										},
1967 1967
 										<?php
1968
-										foreach ( $this->arguments as $key => $args ) {
1969
-											$this->build_block_arguments( $key, $args );
1968
+										foreach ($this->arguments as $key => $args) {
1969
+											$this->build_block_arguments($key, $args);
1970 1970
 										}
1971 1971
 										?>
1972 1972
 									),
@@ -1980,9 +1980,9 @@  discard block
 block discarded – undo
1980 1980
 
1981 1981
 								<?php
1982 1982
 								// If the user sets block-output array then build it
1983
-								if ( ! empty( $this->options['block-output'] ) ) {
1984
-								$this->block_element( $this->options['block-output'] );
1985
-							}else{
1983
+								if (!empty($this->options['block-output'])) {
1984
+								$this->block_element($this->options['block-output']);
1985
+							} else {
1986 1986
 								// if no block-output is set then we try and get the shortcode html output via ajax.
1987 1987
 								?>
1988 1988
 								el('div', {
@@ -2006,19 +2006,19 @@  discard block
 block discarded – undo
2006 2006
 							var align = '';
2007 2007
 
2008 2008
 							// build the shortcode.
2009
-							var content = "[<?php echo $this->options['base_id'];?>";
2009
+							var content = "[<?php echo $this->options['base_id']; ?>";
2010 2010
 							$html = '';
2011 2011
 							<?php
2012 2012
 
2013
-							if(! empty( $this->arguments )){
2013
+							if (!empty($this->arguments)) {
2014 2014
 
2015
-							foreach($this->arguments as $key => $args){
2015
+							foreach ($this->arguments as $key => $args) {
2016 2016
 							?>
2017
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2018
-								if ('<?php echo esc_attr( $key );?>' == 'html') {
2019
-									$html = attr.<?php echo esc_attr( $key );?>;
2017
+							if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
2018
+								if ('<?php echo esc_attr($key); ?>' == 'html') {
2019
+									$html = attr.<?php echo esc_attr($key); ?>;
2020 2020
 								} else {
2021
-									content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' ";
2021
+									content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' ";
2022 2022
 								}
2023 2023
 							}
2024 2024
 							<?php
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 
2031 2031
 							// if has html element
2032 2032
 							if ($html) {
2033
-								content += $html + "[/<?php echo $this->options['base_id'];?>]";
2033
+								content += $html + "[/<?php echo $this->options['base_id']; ?>]";
2034 2034
 							}
2035 2035
 
2036 2036
 
@@ -2048,11 +2048,11 @@  discard block
 block discarded – undo
2048 2048
 							}
2049 2049
 
2050 2050
 							<?php
2051
-							if(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2051
+							if (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') {
2052 2052
 							?>
2053 2053
 							return content;
2054 2054
 							<?php
2055
-							}else{
2055
+							} else {
2056 2056
 							?>
2057 2057
 							var block_wrap = 'div';
2058 2058
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -2075,38 +2075,38 @@  discard block
 block discarded – undo
2075 2075
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2076 2076
 			 */
2077 2077
 
2078
-			return str_replace( array(
2078
+			return str_replace(array(
2079 2079
 				'<script>',
2080 2080
 				'</script>'
2081
-			), '', $output );
2081
+			), '', $output);
2082 2082
 		}
2083 2083
 
2084
-		public function build_block_arguments( $key, $args ) {
2085
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
2084
+		public function build_block_arguments($key, $args) {
2085
+			$custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : '';
2086 2086
 			$options           = '';
2087 2087
 			$extra             = '';
2088 2088
 			$require           = '';
2089 2089
 
2090 2090
 			// `content` is a protected and special argument
2091
-			if ( $key == 'content' ) {
2091
+			if ($key == 'content') {
2092 2092
 				return;
2093 2093
 			}
2094 2094
 
2095 2095
 			// require advanced
2096
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
2096
+			$require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : "";
2097 2097
 
2098 2098
 			// element require
2099
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2099
+			$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
2100 2100
 
2101 2101
 
2102 2102
 			$onchange  = "props.setAttributes({ $key: $key } )";
2103
-			$onchangecomplete  = "";
2103
+			$onchangecomplete = "";
2104 2104
 			$value     = "props.attributes.$key";
2105
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
2106
-			if ( in_array( $args['type'], $text_type ) ) {
2105
+			$text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx');
2106
+			if (in_array($args['type'], $text_type)) {
2107 2107
 				$type = 'TextControl';
2108 2108
 				// Save numbers as numbers and not strings
2109
-				if ( $args['type'] == 'number' ) {
2109
+				if ($args['type'] == 'number') {
2110 2110
 					$onchange = "props.setAttributes({ $key: Number($key) } )";
2111 2111
 				}
2112 2112
 			}
@@ -2144,11 +2144,11 @@  discard block
 block discarded – undo
2144 2144
 							return;
2145 2145
 						}
2146 2146
 			*/
2147
-			elseif ( $args['type'] == 'color' ) {
2147
+			elseif ($args['type'] == 'color') {
2148 2148
 				$type = 'ColorPicker';
2149 2149
 				$onchange = "";
2150 2150
 				$extra = "color: $value,";
2151
-				if(!empty($args['disable_alpha'])){
2151
+				if (!empty($args['disable_alpha'])) {
2152 2152
 					$extra .= "disableAlpha: true,";
2153 2153
 				}
2154 2154
 				$onchangecomplete = "onChangeComplete: function($key) {
@@ -2158,47 +2158,47 @@  discard block
 block discarded – undo
2158 2158
                         });
2159 2159
                     },";
2160 2160
 			}
2161
-			elseif ( $args['type'] == 'checkbox' ) {
2161
+			elseif ($args['type'] == 'checkbox') {
2162 2162
 				$type = 'CheckboxControl';
2163 2163
 				$extra .= "checked: props.attributes.$key,";
2164 2164
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
2165
-			} elseif ( $args['type'] == 'textarea' ) {
2165
+			} elseif ($args['type'] == 'textarea') {
2166 2166
 				$type = 'TextareaControl';
2167
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
2167
+			} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
2168 2168
 				$type = 'SelectControl';
2169 2169
 
2170
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
2171
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
2172
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
2173
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
2174
-				}else {
2170
+				if ($args['name'] == 'category' && !empty($args['post_type_linked'])) {
2171
+					$options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ",";
2172
+				}elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) {
2173
+					$options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ",";
2174
+				} else {
2175 2175
 
2176
-					if ( ! empty( $args['options'] ) ) {
2176
+					if (!empty($args['options'])) {
2177 2177
 						$options .= "options: [";
2178
-						foreach ( $args['options'] as $option_val => $option_label ) {
2179
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
2178
+						foreach ($args['options'] as $option_val => $option_label) {
2179
+							$options .= "{ value: '" . esc_attr($option_val) . "', label: '" . addslashes($option_label) . "' },";
2180 2180
 						}
2181 2181
 						$options .= "],";
2182 2182
 					}
2183 2183
 				}
2184
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2184
+				if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2185 2185
 					$extra .= ' multiple: true, ';
2186 2186
 				}
2187
-			} elseif ( $args['type'] == 'alignment' ) {
2187
+			} elseif ($args['type'] == 'alignment') {
2188 2188
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
2189 2189
 			} else {
2190
-				return;// if we have not implemented the control then don't break the JS.
2190
+				return; // if we have not implemented the control then don't break the JS.
2191 2191
 			}
2192 2192
 
2193 2193
 
2194 2194
 
2195 2195
 			// color input does not show the labels so we add them
2196
-			if($args['type']=='color'){
2196
+			if ($args['type'] == 'color') {
2197 2197
 				// add show only if advanced
2198 2198
 				echo $require_advanced;
2199 2199
 				// add setting require if defined
2200 2200
 				echo $element_require;
2201
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
2201
+				echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),";
2202 2202
 			}
2203 2203
 
2204 2204
 			// add show only if advanced
@@ -2207,21 +2207,21 @@  discard block
 block discarded – undo
2207 2207
 			echo $element_require;
2208 2208
 			?>
2209 2209
 			el( wp.components.<?php echo $type; ?>, {
2210
-			label: '<?php echo addslashes( $args['title'] ); ?>',
2211
-			help: '<?php if ( isset( $args['desc'] ) ) {
2212
-				echo addslashes( $args['desc'] );
2210
+			label: '<?php echo addslashes($args['title']); ?>',
2211
+			help: '<?php if (isset($args['desc'])) {
2212
+				echo addslashes($args['desc']);
2213 2213
 			} ?>',
2214 2214
 			value: <?php echo $value; ?>,
2215
-			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
2216
-				echo "type: '" . addslashes( $args['type'] ) . "',";
2215
+			<?php if ($type == 'TextControl' && $args['type'] != 'text') {
2216
+				echo "type: '" . addslashes($args['type']) . "',";
2217 2217
 			} ?>
2218
-			<?php if ( ! empty( $args['placeholder'] ) ) {
2219
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
2218
+			<?php if (!empty($args['placeholder'])) {
2219
+				echo "placeholder: '" . addslashes($args['placeholder']) . "',";
2220 2220
 			} ?>
2221 2221
 			<?php echo $options; ?>
2222 2222
 			<?php echo $extra; ?>
2223 2223
 			<?php echo $custom_attributes; ?>
2224
-			<?php echo $onchangecomplete;?>
2224
+			<?php echo $onchangecomplete; ?>
2225 2225
 			onChange: function ( <?php echo $key; ?> ) {
2226 2226
 			<?php echo $onchange; ?>
2227 2227
 			}
@@ -2239,16 +2239,16 @@  discard block
 block discarded – undo
2239 2239
 		 *
2240 2240
 		 * @return string
2241 2241
 		 */
2242
-		public function array_to_attributes( $custom_attributes, $html = false ) {
2242
+		public function array_to_attributes($custom_attributes, $html = false) {
2243 2243
 			$attributes = '';
2244
-			if ( ! empty( $custom_attributes ) ) {
2244
+			if (!empty($custom_attributes)) {
2245 2245
 
2246
-				if ( $html ) {
2247
-					foreach ( $custom_attributes as $key => $val ) {
2246
+				if ($html) {
2247
+					foreach ($custom_attributes as $key => $val) {
2248 2248
 						$attributes .= " $key='$val' ";
2249 2249
 					}
2250 2250
 				} else {
2251
-					foreach ( $custom_attributes as $key => $val ) {
2251
+					foreach ($custom_attributes as $key => $val) {
2252 2252
 						$attributes .= "'$key': '$val',";
2253 2253
 					}
2254 2254
 				}
@@ -2264,86 +2264,86 @@  discard block
 block discarded – undo
2264 2264
 		 *
2265 2265
 		 * @param $args
2266 2266
 		 */
2267
-		public function block_element( $args ) {
2267
+		public function block_element($args) {
2268 2268
 
2269 2269
 
2270
-			if ( ! empty( $args ) ) {
2271
-				foreach ( $args as $element => $new_args ) {
2270
+			if (!empty($args)) {
2271
+				foreach ($args as $element => $new_args) {
2272 2272
 
2273
-					if ( is_array( $new_args ) ) { // its an element
2273
+					if (is_array($new_args)) { // its an element
2274 2274
 
2275 2275
 
2276
-						if ( isset( $new_args['element'] ) ) {
2276
+						if (isset($new_args['element'])) {
2277 2277
 
2278
-							if ( isset( $new_args['element_require'] ) ) {
2279
-								echo str_replace( array(
2278
+							if (isset($new_args['element_require'])) {
2279
+								echo str_replace(array(
2280 2280
 										"'+",
2281 2281
 										"+'"
2282
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
2283
-								unset( $new_args['element_require'] );
2282
+									), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
2283
+								unset($new_args['element_require']);
2284 2284
 							}
2285 2285
 
2286 2286
 							echo "\n el( '" . $new_args['element'] . "', {";
2287 2287
 
2288 2288
 							// get the attributes
2289
-							foreach ( $new_args as $new_key => $new_value ) {
2289
+							foreach ($new_args as $new_key => $new_value) {
2290 2290
 
2291 2291
 
2292
-								if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
2292
+								if ($new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
2293 2293
 									// do nothing
2294 2294
 								} else {
2295
-									echo $this->block_element( array( $new_key => $new_value ) );
2295
+									echo $this->block_element(array($new_key => $new_value));
2296 2296
 								}
2297 2297
 							}
2298 2298
 
2299
-							echo "},";// end attributes
2299
+							echo "},"; // end attributes
2300 2300
 
2301 2301
 							// get the content
2302 2302
 							$first_item = 0;
2303
-							foreach ( $new_args as $new_key => $new_value ) {
2304
-								if ( $new_key === 'content' || is_array( $new_value ) ) {
2303
+							foreach ($new_args as $new_key => $new_value) {
2304
+								if ($new_key === 'content' || is_array($new_value)) {
2305 2305
 
2306
-									if ( $new_key === 'content' ) {
2307
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
2306
+									if ($new_key === 'content') {
2307
+										echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'";
2308 2308
 									}
2309 2309
 
2310
-									if ( is_array( $new_value ) ) {
2310
+									if (is_array($new_value)) {
2311 2311
 
2312
-										if ( isset( $new_value['element_require'] ) ) {
2313
-											echo str_replace( array(
2312
+										if (isset($new_value['element_require'])) {
2313
+											echo str_replace(array(
2314 2314
 													"'+",
2315 2315
 													"+'"
2316
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
2317
-											unset( $new_value['element_require'] );
2316
+												), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
2317
+											unset($new_value['element_require']);
2318 2318
 										}
2319 2319
 
2320
-										if ( isset( $new_value['element_repeat'] ) ) {
2320
+										if (isset($new_value['element_repeat'])) {
2321 2321
 											$x = 1;
2322
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
2323
-												$this->block_element( array( '' => $new_value ) );
2324
-												$x ++;
2322
+											while ($x <= absint($new_value['element_repeat'])) {
2323
+												$this->block_element(array('' => $new_value));
2324
+												$x++;
2325 2325
 											}
2326 2326
 										} else {
2327
-											$this->block_element( array( '' => $new_value ) );
2327
+											$this->block_element(array('' => $new_value));
2328 2328
 										}
2329 2329
 									}
2330
-									$first_item ++;
2330
+									$first_item++;
2331 2331
 								}
2332 2332
 							}
2333 2333
 
2334
-							echo ")";// end content
2334
+							echo ")"; // end content
2335 2335
 
2336 2336
 							echo ", \n";
2337 2337
 
2338 2338
 						}
2339 2339
 					} else {
2340 2340
 
2341
-						if ( substr( $element, 0, 3 ) === "if_" ) {
2342
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
2343
-						} elseif ( $element == 'style' ) {
2344
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
2341
+						if (substr($element, 0, 3) === "if_") {
2342
+							echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ",";
2343
+						} elseif ($element == 'style') {
2344
+							echo $element . ": " . $this->block_props_replace($new_args) . ",";
2345 2345
 						} else {
2346
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
2346
+							echo $element . ": '" . $this->block_props_replace($new_args) . "',";
2347 2347
 						}
2348 2348
 
2349 2349
 					}
@@ -2358,12 +2358,12 @@  discard block
 block discarded – undo
2358 2358
 		 *
2359 2359
 		 * @return mixed
2360 2360
 		 */
2361
-		public function block_props_replace( $string, $no_wrap = false ) {
2361
+		public function block_props_replace($string, $no_wrap = false) {
2362 2362
 
2363
-			if ( $no_wrap ) {
2364
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
2363
+			if ($no_wrap) {
2364
+				$string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string);
2365 2365
 			} else {
2366
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
2366
+				$string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string);
2367 2367
 			}
2368 2368
 
2369 2369
 			return $string;
@@ -2375,55 +2375,55 @@  discard block
 block discarded – undo
2375 2375
 		 * @param array $args
2376 2376
 		 * @param array $instance
2377 2377
 		 */
2378
-		public function widget( $args, $instance ) {
2378
+		public function widget($args, $instance) {
2379 2379
 
2380 2380
 			// get the filtered values
2381
-			$argument_values = $this->argument_values( $instance );
2382
-			$argument_values = $this->string_to_bool( $argument_values );
2383
-			$output          = $this->output( $argument_values, $args );
2381
+			$argument_values = $this->argument_values($instance);
2382
+			$argument_values = $this->string_to_bool($argument_values);
2383
+			$output          = $this->output($argument_values, $args);
2384 2384
 
2385 2385
 			$no_wrap = false;
2386
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
2386
+			if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) {
2387 2387
 				$no_wrap = true;
2388 2388
 			}
2389 2389
 
2390 2390
 			ob_start();
2391
-			if ( $output && ! $no_wrap ) {
2391
+			if ($output && !$no_wrap) {
2392 2392
 
2393 2393
 				$class_original = $this->options['widget_ops']['classname'];
2394
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
2394
+				$class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash();
2395 2395
 
2396 2396
 				// Before widget
2397 2397
 				$before_widget = $args['before_widget'];
2398
-				$before_widget = str_replace($class_original,$class,$before_widget);
2399
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
2400
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
2398
+				$before_widget = str_replace($class_original, $class, $before_widget);
2399
+				$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
2400
+				$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this);
2401 2401
 
2402 2402
 				// After widget
2403 2403
 				$after_widget = $args['after_widget'];
2404
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
2405
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
2404
+				$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
2405
+				$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this);
2406 2406
 
2407 2407
 				echo $before_widget;
2408 2408
 				// elementor strips the widget wrapping div so we check for and add it back if needed
2409
-				if ( $this->is_elementor_widget_output() ) {
2410
-					echo ! empty( $this->options['widget_ops']['classname'] ) ? "<span class='" . esc_attr( $class  ) . "'>" : '';
2409
+				if ($this->is_elementor_widget_output()) {
2410
+					echo !empty($this->options['widget_ops']['classname']) ? "<span class='" . esc_attr($class) . "'>" : '';
2411 2411
 				}
2412
-				echo $this->output_title( $args, $instance );
2412
+				echo $this->output_title($args, $instance);
2413 2413
 				echo $output;
2414
-				if ( $this->is_elementor_widget_output() ) {
2415
-					echo ! empty( $this->options['widget_ops']['classname'] ) ? "</span>" : '';
2414
+				if ($this->is_elementor_widget_output()) {
2415
+					echo !empty($this->options['widget_ops']['classname']) ? "</span>" : '';
2416 2416
 				}
2417 2417
 				echo $after_widget;
2418
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
2419
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
2418
+			} elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty
2419
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
2420 2420
 				echo $output;
2421
-			} elseif ( $output && $no_wrap ) {
2421
+			} elseif ($output && $no_wrap) {
2422 2422
 				echo $output;
2423 2423
 			}
2424 2424
 			$output = ob_get_clean();
2425 2425
 
2426
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
2426
+			$output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this);
2427 2427
 
2428 2428
 			echo $output;
2429 2429
 		}
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
 		 */
2437 2437
 		public function is_elementor_widget_output() {
2438 2438
 			$result = false;
2439
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
2439
+			if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') {
2440 2440
 				$result = true;
2441 2441
 			}
2442 2442
 
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
 		 */
2452 2452
 		public function is_elementor_preview() {
2453 2453
 			$result = false;
2454
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
2454
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
2455 2455
 				$result = true;
2456 2456
 			}
2457 2457
 
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
 		 */
2467 2467
 		public function is_divi_preview() {
2468 2468
 			$result = false;
2469
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
2469
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
2470 2470
 				$result = true;
2471 2471
 			}
2472 2472
 
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 		 */
2482 2482
 		public function is_beaver_preview() {
2483 2483
 			$result = false;
2484
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
2484
+			if (isset($_REQUEST['fl_builder'])) {
2485 2485
 				$result = true;
2486 2486
 			}
2487 2487
 
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
 		 */
2497 2497
 		public function is_siteorigin_preview() {
2498 2498
 			$result = false;
2499
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
2499
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
2500 2500
 				$result = true;
2501 2501
 			}
2502 2502
 
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 		 */
2512 2512
 		public function is_cornerstone_preview() {
2513 2513
 			$result = false;
2514
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
2514
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
2515 2515
 				$result = true;
2516 2516
 			}
2517 2517
 
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
 		 */
2527 2527
 		public function is_fusion_preview() {
2528 2528
 			$result = false;
2529
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
2529
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
2530 2530
 				$result = true;
2531 2531
 			}
2532 2532
 
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
2541 2541
 		 */
2542 2542
 		public function is_oxygen_preview() {
2543 2543
 			$result = false;
2544
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
2544
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
2545 2545
 				$result = true;
2546 2546
 			}
2547 2547
 
@@ -2556,21 +2556,21 @@  discard block
 block discarded – undo
2556 2556
 		 */
2557 2557
 		public function is_preview() {
2558 2558
 			$preview = false;
2559
-			if ( $this->is_divi_preview() ) {
2559
+			if ($this->is_divi_preview()) {
2560 2560
 				$preview = true;
2561
-			} elseif ( $this->is_elementor_preview() ) {
2561
+			} elseif ($this->is_elementor_preview()) {
2562 2562
 				$preview = true;
2563
-			} elseif ( $this->is_beaver_preview() ) {
2563
+			} elseif ($this->is_beaver_preview()) {
2564 2564
 				$preview = true;
2565
-			} elseif ( $this->is_siteorigin_preview() ) {
2565
+			} elseif ($this->is_siteorigin_preview()) {
2566 2566
 				$preview = true;
2567
-			} elseif ( $this->is_cornerstone_preview() ) {
2567
+			} elseif ($this->is_cornerstone_preview()) {
2568 2568
 				$preview = true;
2569
-			} elseif ( $this->is_fusion_preview() ) {
2569
+			} elseif ($this->is_fusion_preview()) {
2570 2570
 				$preview = true;
2571
-			} elseif ( $this->is_oxygen_preview() ) {
2571
+			} elseif ($this->is_oxygen_preview()) {
2572 2572
 				$preview = true;
2573
-			} elseif( $this->is_block_content_call() ) {
2573
+			} elseif ($this->is_block_content_call()) {
2574 2574
 				$preview = true;
2575 2575
 			}
2576 2576
 
@@ -2585,11 +2585,11 @@  discard block
 block discarded – undo
2585 2585
 		 *
2586 2586
 		 * @return string
2587 2587
 		 */
2588
-		public function output_title( $args, $instance = array() ) {
2588
+		public function output_title($args, $instance = array()) {
2589 2589
 			$output = '';
2590
-			if ( ! empty( $instance['title'] ) ) {
2590
+			if (!empty($instance['title'])) {
2591 2591
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2592
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
2592
+				$title  = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
2593 2593
 				$output = $args['before_title'] . $title . $args['after_title'];
2594 2594
 			}
2595 2595
 
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 		 *
2602 2602
 		 * @param array $instance The widget options.
2603 2603
 		 */
2604
-		public function form( $instance ) {
2604
+		public function form($instance) {
2605 2605
 
2606 2606
 			// set widget instance
2607 2607
 			$this->instance = $instance;
@@ -2609,20 +2609,20 @@  discard block
 block discarded – undo
2609 2609
 			// set it as a SD widget
2610 2610
 			echo $this->widget_advanced_toggle();
2611 2611
 
2612
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
2612
+			echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>";
2613 2613
 			$arguments_raw = $this->get_arguments();
2614 2614
 
2615
-			if ( is_array( $arguments_raw ) ) {
2615
+			if (is_array($arguments_raw)) {
2616 2616
 
2617
-				$arguments = $this->group_arguments( $arguments_raw );
2617
+				$arguments = $this->group_arguments($arguments_raw);
2618 2618
 
2619 2619
 				// Do we have sections?
2620 2620
 				$has_sections = $arguments == $arguments_raw ? false : true;
2621 2621
 
2622 2622
 
2623
-				if ( $has_sections ) {
2623
+				if ($has_sections) {
2624 2624
 					$panel_count = 0;
2625
-					foreach ( $arguments as $key => $args ) {
2625
+					foreach ($arguments as $key => $args) {
2626 2626
 
2627 2627
 						?>
2628 2628
 						<script>
@@ -2632,21 +2632,21 @@  discard block
 block discarded – undo
2632 2632
 
2633 2633
 						$hide       = $panel_count ? ' style="display:none;" ' : '';
2634 2634
 						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
2635
-						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>";
2636
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
2635
+						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>";
2636
+						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>";
2637 2637
 
2638
-						foreach ( $args as $k => $a ) {
2639
-							$this->widget_inputs( $a, $instance );
2638
+						foreach ($args as $k => $a) {
2639
+							$this->widget_inputs($a, $instance);
2640 2640
 						}
2641 2641
 
2642 2642
 						echo "</div>";
2643 2643
 
2644
-						$panel_count ++;
2644
+						$panel_count++;
2645 2645
 
2646 2646
 					}
2647 2647
 				} else {
2648
-					foreach ( $arguments as $key => $args ) {
2649
-						$this->widget_inputs( $args, $instance );
2648
+					foreach ($arguments as $key => $args) {
2649
+						$this->widget_inputs($args, $instance);
2650 2650
 					}
2651 2651
 				}
2652 2652
 
@@ -2661,7 +2661,7 @@  discard block
 block discarded – undo
2661 2661
 		public function widget_advanced_toggle() {
2662 2662
 
2663 2663
 			$output = '';
2664
-			if ( $this->block_show_advanced() ) {
2664
+			if ($this->block_show_advanced()) {
2665 2665
 				$val = 1;
2666 2666
 			} else {
2667 2667
 				$val = 0;
@@ -2681,14 +2681,14 @@  discard block
 block discarded – undo
2681 2681
 		 *
2682 2682
 		 * @return string $output
2683 2683
 		 */
2684
-		public function convert_element_require( $input ) {
2684
+		public function convert_element_require($input) {
2685 2685
 
2686
-			$input = str_replace( "'", '"', $input );// we only want double quotes
2686
+			$input = str_replace("'", '"', $input); // we only want double quotes
2687 2687
 
2688
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
2688
+			$output = esc_attr(str_replace(array("[%", "%]"), array(
2689 2689
 				"jQuery(form).find('[data-argument=\"",
2690 2690
 				"\"]').find('input,select,textarea').val()"
2691
-			), $input ) );
2691
+			), $input));
2692 2692
 
2693 2693
 			return $output;
2694 2694
 		}
@@ -2699,54 +2699,54 @@  discard block
 block discarded – undo
2699 2699
 		 * @param $args
2700 2700
 		 * @param $instance
2701 2701
 		 */
2702
-		public function widget_inputs( $args, $instance ) {
2702
+		public function widget_inputs($args, $instance) {
2703 2703
 
2704 2704
 			$class             = "";
2705 2705
 			$element_require   = "";
2706 2706
 			$custom_attributes = "";
2707 2707
 
2708 2708
 			// get value
2709
-			if ( isset( $instance[ $args['name'] ] ) ) {
2710
-				$value = $instance[ $args['name'] ];
2711
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
2712
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
2709
+			if (isset($instance[$args['name']])) {
2710
+				$value = $instance[$args['name']];
2711
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
2712
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
2713 2713
 			} else {
2714 2714
 				$value = '';
2715 2715
 			}
2716 2716
 
2717 2717
 			// get placeholder
2718
-			if ( ! empty( $args['placeholder'] ) ) {
2719
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
2718
+			if (!empty($args['placeholder'])) {
2719
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
2720 2720
 			} else {
2721 2721
 				$placeholder = '';
2722 2722
 			}
2723 2723
 
2724 2724
 			// get if advanced
2725
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
2725
+			if (isset($args['advanced']) && $args['advanced']) {
2726 2726
 				$class .= " sd-advanced-setting ";
2727 2727
 			}
2728 2728
 
2729 2729
 			// element_require
2730
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
2730
+			if (isset($args['element_require']) && $args['element_require']) {
2731 2731
 				$element_require = $args['element_require'];
2732 2732
 			}
2733 2733
 
2734 2734
 			// custom_attributes
2735
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
2736
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
2735
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
2736
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
2737 2737
 			}
2738 2738
 
2739 2739
 			// before wrapper
2740 2740
 			?>
2741
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
2742
-			   data-argument='<?php echo esc_attr( $args['name'] ); ?>'
2743
-			   data-element_require='<?php if ( $element_require ) {
2744
-				   echo $this->convert_element_require( $element_require );
2741
+			<p class="sd-argument <?php echo esc_attr($class); ?>"
2742
+			   data-argument='<?php echo esc_attr($args['name']); ?>'
2743
+			   data-element_require='<?php if ($element_require) {
2744
+				   echo $this->convert_element_require($element_require);
2745 2745
 			   } ?>'
2746 2746
 			>
2747 2747
 				<?php
2748 2748
 
2749
-				switch ( $args['type'] ) {
2749
+				switch ($args['type']) {
2750 2750
 					//array('text','password','number','email','tel','url','color')
2751 2751
 					case "text":
2752 2752
 					case "password":
@@ -2757,46 +2757,46 @@  discard block
 block discarded – undo
2757 2757
 					case "color":
2758 2758
 						?>
2759 2759
 						<label
2760
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2760
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
2761 2761
 						<input <?php echo $placeholder; ?> class="widefat"
2762 2762
 							<?php echo $custom_attributes; ?>
2763
-							                               id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2764
-							                               name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
2765
-							                               type="<?php echo esc_attr( $args['type'] ); ?>"
2766
-							                               value="<?php echo esc_attr( $value ); ?>">
2763
+							                               id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2764
+							                               name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
2765
+							                               type="<?php echo esc_attr($args['type']); ?>"
2766
+							                               value="<?php echo esc_attr($value); ?>">
2767 2767
 						<?php
2768 2768
 
2769 2769
 						break;
2770 2770
 					case "select":
2771
-						$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
2772
-						if ( $multiple ) {
2773
-							if ( empty( $value ) ) {
2771
+						$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
2772
+						if ($multiple) {
2773
+							if (empty($value)) {
2774 2774
 								$value = array();
2775 2775
 							}
2776 2776
 						}
2777 2777
 						?>
2778 2778
 						<label
2779
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2779
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
2780 2780
 						<select <?php echo $placeholder; ?> class="widefat"
2781 2781
 							<?php echo $custom_attributes; ?>
2782
-							                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2783
-							                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
2784
-							                                if ( $multiple ) {
2782
+							                                id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2783
+							                                name="<?php echo esc_attr($this->get_field_name($args['name']));
2784
+							                                if ($multiple) {
2785 2785
 								                                echo "[]";
2786 2786
 							                                } ?>"
2787
-							<?php if ( $multiple ) {
2787
+							<?php if ($multiple) {
2788 2788
 								echo "multiple";
2789 2789
 							} //@todo not implemented yet due to gutenberg not supporting it
2790 2790
 							?>
2791 2791
 						>
2792 2792
 							<?php
2793 2793
 
2794
-							if ( ! empty( $args['options'] ) ) {
2795
-								foreach ( $args['options'] as $val => $label ) {
2796
-									if ( $multiple ) {
2797
-										$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
2794
+							if (!empty($args['options'])) {
2795
+								foreach ($args['options'] as $val => $label) {
2796
+									if ($multiple) {
2797
+										$selected = in_array($val, $value) ? 'selected="selected"' : '';
2798 2798
 									} else {
2799
-										$selected = selected( $value, $val, false );
2799
+										$selected = selected($value, $val, false);
2800 2800
 									}
2801 2801
 									echo "<option value='$val' " . $selected . ">$label</option>";
2802 2802
 								}
@@ -2808,32 +2808,32 @@  discard block
 block discarded – undo
2808 2808
 					case "checkbox":
2809 2809
 						?>
2810 2810
 						<input <?php echo $placeholder; ?>
2811
-							<?php checked( 1, $value, true ) ?>
2811
+							<?php checked(1, $value, true) ?>
2812 2812
 							<?php echo $custom_attributes; ?>
2813
-							class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2814
-							name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox"
2813
+							class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2814
+							name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox"
2815 2815
 							value="1">
2816 2816
 						<label
2817
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2817
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
2818 2818
 						<?php
2819 2819
 						break;
2820 2820
 					case "textarea":
2821 2821
 						?>
2822 2822
 						<label
2823
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2823
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
2824 2824
 						<textarea <?php echo $placeholder; ?> class="widefat"
2825 2825
 							<?php echo $custom_attributes; ?>
2826
-							                                  id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2827
-							                                  name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
2828
-						><?php echo esc_attr( $value ); ?></textarea>
2826
+							                                  id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2827
+							                                  name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
2828
+						><?php echo esc_attr($value); ?></textarea>
2829 2829
 						<?php
2830 2830
 
2831 2831
 						break;
2832 2832
 					case "hidden":
2833 2833
 						?>
2834
-						<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2835
-						       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
2836
-						       value="<?php echo esc_attr( $value ); ?>">
2834
+						<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2835
+						       name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden"
2836
+						       value="<?php echo esc_attr($value); ?>">
2837 2837
 						<?php
2838 2838
 						break;
2839 2839
 					default:
@@ -2855,14 +2855,14 @@  discard block
 block discarded – undo
2855 2855
 		 * @return string
2856 2856
 		 * @todo, need to make its own tooltip script
2857 2857
 		 */
2858
-		public function widget_field_desc( $args ) {
2858
+		public function widget_field_desc($args) {
2859 2859
 
2860 2860
 			$description = '';
2861
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
2862
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
2863
-					$description = $this->desc_tip( $args['desc'] );
2861
+			if (isset($args['desc']) && $args['desc']) {
2862
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
2863
+					$description = $this->desc_tip($args['desc']);
2864 2864
 				} else {
2865
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
2865
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
2866 2866
 				}
2867 2867
 			}
2868 2868
 
@@ -2877,11 +2877,11 @@  discard block
 block discarded – undo
2877 2877
 		 *
2878 2878
 		 * @return string
2879 2879
 		 */
2880
-		function desc_tip( $tip, $allow_html = false ) {
2881
-			if ( $allow_html ) {
2882
-				$tip = $this->sanitize_tooltip( $tip );
2880
+		function desc_tip($tip, $allow_html = false) {
2881
+			if ($allow_html) {
2882
+				$tip = $this->sanitize_tooltip($tip);
2883 2883
 			} else {
2884
-				$tip = esc_attr( $tip );
2884
+				$tip = esc_attr($tip);
2885 2885
 			}
2886 2886
 
2887 2887
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -2894,8 +2894,8 @@  discard block
 block discarded – undo
2894 2894
 		 *
2895 2895
 		 * @return string
2896 2896
 		 */
2897
-		public function sanitize_tooltip( $var ) {
2898
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
2897
+		public function sanitize_tooltip($var) {
2898
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
2899 2899
 				'br'     => array(),
2900 2900
 				'em'     => array(),
2901 2901
 				'strong' => array(),
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
 				'li'     => array(),
2906 2906
 				'ol'     => array(),
2907 2907
 				'p'      => array(),
2908
-			) ) );
2908
+			)));
2909 2909
 		}
2910 2910
 
2911 2911
 		/**
@@ -2917,23 +2917,23 @@  discard block
 block discarded – undo
2917 2917
 		 * @return array
2918 2918
 		 * @todo we should add some sanitation here.
2919 2919
 		 */
2920
-		public function update( $new_instance, $old_instance ) {
2920
+		public function update($new_instance, $old_instance) {
2921 2921
 
2922 2922
 			//save the widget
2923
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
2923
+			$instance = array_merge((array) $old_instance, (array) $new_instance);
2924 2924
 
2925 2925
 			// set widget instance
2926 2926
 			$this->instance = $instance;
2927 2927
 
2928
-			if ( empty( $this->arguments ) ) {
2928
+			if (empty($this->arguments)) {
2929 2929
 				$this->get_arguments();
2930 2930
 			}
2931 2931
 
2932 2932
 			// check for checkboxes
2933
-			if ( ! empty( $this->arguments ) ) {
2934
-				foreach ( $this->arguments as $argument ) {
2935
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
2936
-						$instance[ $argument['name'] ] = '0';
2933
+			if (!empty($this->arguments)) {
2934
+				foreach ($this->arguments as $argument) {
2935
+					if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
2936
+						$instance[$argument['name']] = '0';
2937 2937
 					}
2938 2938
 				}
2939 2939
 			}
@@ -2951,7 +2951,7 @@  discard block
 block discarded – undo
2951 2951
 		 */
2952 2952
 		public function is_block_content_call() {
2953 2953
 			$result = false;
2954
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
2954
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
2955 2955
 				$result = true;
2956 2956
 			}
2957 2957
 
@@ -2964,9 +2964,9 @@  discard block
 block discarded – undo
2964 2964
 		 * @since 1.0.20
2965 2965
 		 * @return string
2966 2966
 		 */
2967
-		public function get_instance_hash(){
2968
-			$instance_string = $this->base_id.serialize($this->instance);
2969
-			return hash('crc32b',$instance_string);
2967
+		public function get_instance_hash() {
2968
+			$instance_string = $this->base_id . serialize($this->instance);
2969
+			return hash('crc32b', $instance_string);
2970 2970
 		}
2971 2971
 
2972 2972
 		/**
@@ -2977,14 +2977,14 @@  discard block
 block discarded – undo
2977 2977
 		 * @since 1.0.20
2978 2978
 		 * @return string
2979 2979
 		 */
2980
-		public function get_instance_style($rules = array()){
2980
+		public function get_instance_style($rules = array()) {
2981 2981
 			$css = '';
2982 2982
 
2983
-			if(!empty($rules)){
2983
+			if (!empty($rules)) {
2984 2984
 				$rules = array_unique($rules);
2985 2985
 				$instance_hash = $this->get_instance_hash();
2986 2986
 				$css .= "<style>";
2987
-				foreach($rules as $rule){
2987
+				foreach ($rules as $rule) {
2988 2988
 					$css .= ".sdel-$instance_hash $rule";
2989 2989
 				}
2990 2990
 				$css .= "</style>";
Please login to merge, or discard this patch.
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Spacing   +108 added lines, -108 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.
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
 		 * @return WP_Font_Awesome_Settings - Main instance.
88 88
 		 */
89 89
 		public static function instance() {
90
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
90
+			if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) {
91 91
 				self::$instance = new WP_Font_Awesome_Settings;
92 92
 
93
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
93
+				add_action('init', array(self::$instance, 'init')); // set settings
94 94
 
95
-				if ( is_admin() ) {
96
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
97
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
95
+				if (is_admin()) {
96
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
97
+					add_action('admin_init', array(self::$instance, 'register_settings'));
98 98
 				}
99 99
 
100
-				do_action( 'wp_font_awesome_settings_loaded' );
100
+				do_action('wp_font_awesome_settings_loaded');
101 101
 			}
102 102
 
103 103
 			return self::$instance;
@@ -111,30 +111,30 @@  discard block
 block discarded – undo
111 111
 		public function init() {
112 112
 			$this->settings = $this->get_settings();
113 113
 
114
-			if ( $this->settings['type'] == 'CSS' ) {
114
+			if ($this->settings['type'] == 'CSS') {
115 115
 
116
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
117
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
116
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
117
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000);
118 118
 				}
119 119
 
120
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
121
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
120
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
121
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000);
122 122
 				}
123 123
 
124 124
 			} else {
125 125
 
126
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
127
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
126
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
127
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
128 128
 				}
129 129
 
130
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
131
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
130
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
131
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
132 132
 				}
133 133
 			}
134 134
 
135 135
 			// remove font awesome if set to do so
136
-			if ( $this->settings['dequeue'] == '1' ) {
137
-				add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
136
+			if ($this->settings['dequeue'] == '1') {
137
+				add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3);
138 138
 			}
139 139
 
140 140
 		}
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 			// build url
147 147
 			$url = $this->get_url();
148 148
 
149
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
150
-			wp_register_style( 'font-awesome', $url, array(), null );
151
-			wp_enqueue_style( 'font-awesome' );
149
+			wp_deregister_style('font-awesome'); // deregister in case its already there
150
+			wp_register_style('font-awesome', $url, array(), null);
151
+			wp_enqueue_style('font-awesome');
152 152
 
153
-			if ( $this->settings['shims'] ) {
154
-				$url = $this->get_url( true );
155
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
156
-				wp_register_style( 'font-awesome-shims', $url, array(), null );
157
-				wp_enqueue_style( 'font-awesome-shims' );
153
+			if ($this->settings['shims']) {
154
+				$url = $this->get_url(true);
155
+				wp_deregister_style('font-awesome-shims'); // deregister in case its already there
156
+				wp_register_style('font-awesome-shims', $url, array(), null);
157
+				wp_enqueue_style('font-awesome-shims');
158 158
 			}
159 159
 		}
160 160
 
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 			$url = $this->get_url();
167 167
 
168 168
 			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
169
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
170
-			wp_register_script( 'font-awesome', $url, array(), null );
171
-			wp_enqueue_script( 'font-awesome' );
172
-
173
-			if ( $this->settings['shims'] ) {
174
-				$url = $this->get_url( true );
175
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
176
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
177
-				wp_enqueue_script( 'font-awesome-shims' );
169
+			call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there
170
+			wp_register_script('font-awesome', $url, array(), null);
171
+			wp_enqueue_script('font-awesome');
172
+
173
+			if ($this->settings['shims']) {
174
+				$url = $this->get_url(true);
175
+				call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there
176
+				wp_register_script('font-awesome-shims', $url, array(), null);
177
+				wp_enqueue_script('font-awesome-shims');
178 178
 			}
179 179
 		}
180 180
 
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @return string The url to the file.
187 187
 		 */
188
-		public function get_url( $shims = false ) {
188
+		public function get_url($shims = false) {
189 189
 			$script  = $shims ? 'v4-shims' : 'all';
190 190
 			$sub     = $this->settings['pro'] ? 'pro' : 'use';
191 191
 			$type    = $this->settings['type'];
192 192
 			$version = $this->settings['version'];
193
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
193
+			$kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : '';
194 194
 			$url     = '';
195 195
 
196
-			if ( $type == 'KIT' && $kit_url ) {
197
-				if ( $shims ) {
196
+			if ($type == 'KIT' && $kit_url) {
197
+				if ($shims) {
198 198
 					// if its a kit then we don't add shims here
199 199
 					return '';
200 200
 				}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 				$url .= "?wpfas=true"; // set our var so our version is not removed
203 203
 			} else {
204 204
 				$url .= "https://$sub.fontawesome.com/releases/"; // CDN
205
-				$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
205
+				$url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
206 206
 				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
207 207
 				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
208 208
 				$url .= "?wpfas=true"; // set our var so our version is not removed
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
 		 *
223 223
 		 * @return string The filtered url.
224 224
 		 */
225
-		public function remove_font_awesome( $url, $original_url, $_context ) {
225
+		public function remove_font_awesome($url, $original_url, $_context) {
226 226
 
227
-			if ( $_context == 'display'
228
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
229
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
227
+			if ($_context == 'display'
228
+			     && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false)
229
+			     && (strstr($url, ".js") !== false || strstr($url, ".css") !== false)
230 230
 			) {// it's a font-awesome-url (probably)
231 231
 
232
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
233
-					if ( $this->settings['type'] == 'JS' ) {
234
-						if ( $this->settings['js-pseudo'] ) {
232
+				if (strstr($url, "wpfas=true") !== false) {
233
+					if ($this->settings['type'] == 'JS') {
234
+						if ($this->settings['js-pseudo']) {
235 235
 							$url .= "' data-search-pseudo-elements defer='defer";
236 236
 						} else {
237 237
 							$url .= "' defer='defer";
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		 * Register the database settings with WordPress.
251 251
 		 */
252 252
 		public function register_settings() {
253
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
253
+			register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings');
254 254
 		}
255 255
 
256 256
 		/**
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 		 */
260 260
 		public function menu_item() {
261 261
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
262
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
262
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
263 263
 				$this,
264 264
 				'settings_page'
265
-			) );
265
+			));
266 266
 		}
267 267
 
268 268
 		/**
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 */
273 273
 		public function get_settings() {
274 274
 
275
-			$db_settings = get_option( 'wp-font-awesome-settings' );
275
+			$db_settings = get_option('wp-font-awesome-settings');
276 276
 
277 277
 			$defaults = array(
278 278
 				'type'      => 'CSS', // type to use, CSS or JS or KIT
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 				'kit-url'   => '', // the kit url
286 286
 			);
287 287
 
288
-			$settings = wp_parse_args( $db_settings, $defaults );
288
+			$settings = wp_parse_args($db_settings, $defaults);
289 289
 
290 290
 			/**
291 291
 			 * Filter the Font Awesome settings.
292 292
 			 *
293 293
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
294 294
 			 */
295
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
295
+			return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults);
296 296
 		}
297 297
 
298 298
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		 * The settings page html output.
301 301
 		 */
302 302
 		public function settings_page() {
303
-			if ( ! current_user_can( 'manage_options' ) ) {
304
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
303
+			if (!current_user_can('manage_options')) {
304
+				wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings'));
305 305
 			}
306 306
 
307 307
 			// a hidden way to force the update of the verison number vai api instead of waiting the 48 hours
308
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
309
-				$this->get_latest_version( $force_api = true );
308
+			if (isset($_REQUEST['force-version-check'])) {
309
+				$this->get_latest_version($force_api = true);
310 310
 			}
311 311
 			?>
312 312
 			<style>
@@ -326,37 +326,37 @@  discard block
 block discarded – undo
326 326
 				<h1><?php echo $this->name; ?></h1>
327 327
 				<form method="post" action="options.php">
328 328
 					<?php
329
-					settings_fields( 'wp-font-awesome-settings' );
330
-					do_settings_sections( 'wp-font-awesome-settings' );
329
+					settings_fields('wp-font-awesome-settings');
330
+					do_settings_sections('wp-font-awesome-settings');
331 331
 					$kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : '';
332 332
 					?>
333
-					<table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>">
333
+					<table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>">
334 334
 						<tr valign="top">
335 335
 							<th scope="row"><label
336
-									for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th>
336
+									for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th>
337 337
 							<td>
338 338
 								<select name="wp-font-awesome-settings[type]" id="wpfas-type"
339 339
 								        onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}">
340 340
 									<option
341
-										value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option>
342
-									<option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option>
341
+										value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option>
342
+									<option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option>
343 343
 									<option
344
-										value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option>
344
+										value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option>
345 345
 								</select>
346 346
 							</td>
347 347
 						</tr>
348 348
 
349 349
 						<tr valign="top" class="wpfas-kit-show">
350 350
 							<th scope="row"><label
351
-									for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th>
351
+									for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th>
352 352
 							<td>
353 353
 								<input class="regular-text" id="wpfas-kit-url" type="url"
354 354
 								       name="wp-font-awesome-settings[kit-url]"
355
-								       value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>"
356
-								       placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
355
+								       value="<?php echo esc_attr($this->settings['kit-url']); ?>"
356
+								       placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
357 357
 								<span><?php
358 358
 									echo sprintf(
359
-										__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
359
+										__('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'),
360 360
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
361 361
 										'</a>'
362 362
 									);
@@ -366,31 +366,31 @@  discard block
 block discarded – undo
366 366
 
367 367
 						<tr valign="top" class="wpfas-kit-hide">
368 368
 							<th scope="row"><label
369
-									for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th>
369
+									for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th>
370 370
 							<td>
371 371
 								<select name="wp-font-awesome-settings[version]" id="wpfas-version">
372 372
 									<option
373
-										value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?>
373
+										value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?>
374 374
 									</option>
375
-									<option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>
375
+									<option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>
376 376
 										5.6.0
377 377
 									</option>
378
-									<option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>
378
+									<option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>
379 379
 										5.5.0
380 380
 									</option>
381
-									<option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>
381
+									<option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>
382 382
 										5.4.0
383 383
 									</option>
384
-									<option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>
384
+									<option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>
385 385
 										5.3.0
386 386
 									</option>
387
-									<option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>
387
+									<option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>
388 388
 										5.2.0
389 389
 									</option>
390
-									<option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>
390
+									<option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>
391 391
 										5.1.0
392 392
 									</option>
393
-									<option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>
393
+									<option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>
394 394
 										4.7.1 (CSS only)
395 395
 									</option>
396 396
 								</select>
@@ -399,29 +399,29 @@  discard block
 block discarded – undo
399 399
 
400 400
 						<tr valign="top">
401 401
 							<th scope="row"><label
402
-									for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th>
402
+									for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th>
403 403
 							<td>
404 404
 								<select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue">
405 405
 									<option
406
-										value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option>
406
+										value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option>
407 407
 									<option
408
-										value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option>
408
+										value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option>
409 409
 									<option
410
-										value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option>
410
+										value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option>
411 411
 								</select>
412 412
 							</td>
413 413
 						</tr>
414 414
 
415 415
 						<tr valign="top" class="wpfas-kit-hide">
416 416
 							<th scope="row"><label
417
-									for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th>
417
+									for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th>
418 418
 							<td>
419 419
 								<input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
420 420
 								<input type="checkbox" name="wp-font-awesome-settings[pro]"
421
-								       value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/>
421
+								       value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/>
422 422
 								<span><?php
423 423
 									echo sprintf(
424
-										__( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ),
424
+										__('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings'),
425 425
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/pro"><i class="fas fa-external-link-alt"></i>',
426 426
 										'</a>',
427 427
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn"><i class="fas fa-external-link-alt"></i>',
@@ -433,38 +433,38 @@  discard block
 block discarded – undo
433 433
 
434 434
 						<tr valign="top" class="wpfas-kit-hide">
435 435
 							<th scope="row"><label
436
-									for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label>
436
+									for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label>
437 437
 							</th>
438 438
 							<td>
439 439
 								<input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/>
440 440
 								<input type="checkbox" name="wp-font-awesome-settings[shims]"
441
-								       value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/>
442
-								<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>
441
+								       value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/>
442
+								<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>
443 443
 							</td>
444 444
 						</tr>
445 445
 
446 446
 						<tr valign="top" class="wpfas-kit-hide">
447 447
 							<th scope="row"><label
448
-									for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label>
448
+									for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label>
449 449
 							</th>
450 450
 							<td>
451 451
 								<input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/>
452 452
 								<input type="checkbox" name="wp-font-awesome-settings[js-pseudo]"
453
-								       value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?>
453
+								       value="1" <?php checked($this->settings['js-pseudo'], '1'); ?>
454 454
 								       id="wpfas-js-pseudo"/>
455
-								<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>
455
+								<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>
456 456
 							</td>
457 457
 						</tr>
458 458
 
459 459
 						<tr valign="top">
460 460
 							<th scope="row"><label
461
-									for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th>
461
+									for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th>
462 462
 							<td>
463 463
 								<input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/>
464 464
 								<input type="checkbox" name="wp-font-awesome-settings[dequeue]"
465
-								       value="1" <?php checked( $this->settings['dequeue'], '1' ); ?>
465
+								       value="1" <?php checked($this->settings['dequeue'], '1'); ?>
466 466
 								       id="wpfas-dequeue"/>
467
-								<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>
467
+								<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>
468 468
 							</td>
469 469
 						</tr>
470 470
 
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
 		 *
490 490
 		 * @return string Either a valid version number or an empty string.
491 491
 		 */
492
-		public function validate_version_number( $version ) {
492
+		public function validate_version_number($version) {
493 493
 
494
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
494
+			if (version_compare($version, '0.0.1', '>=') >= 0) {
495 495
 				// valid
496 496
 			} else {
497
-				$version = '';// not validated
497
+				$version = ''; // not validated
498 498
 			}
499 499
 
500 500
 			return $version;
@@ -509,19 +509,19 @@  discard block
 block discarded – undo
509 509
 		 * @since 1.0.7
510 510
 		 * @return mixed|string The latest version number found.
511 511
 		 */
512
-		public function get_latest_version( $force_api = false ) {
512
+		public function get_latest_version($force_api = false) {
513 513
 			$latest_version = $this->latest;
514 514
 
515
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
515
+			$cache = get_transient('wp-font-awesome-settings-version');
516 516
 
517
-			if ( $cache === false || $force_api ) { // its not set
517
+			if ($cache === false || $force_api) { // its not set
518 518
 				$api_ver = $this->get_latest_version_from_api();
519
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
519
+				if (version_compare($api_ver, $this->latest, '>=') >= 0) {
520 520
 					$latest_version = $api_ver;
521
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
521
+					set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS);
522 522
 				}
523
-			} elseif ( $this->validate_version_number( $cache ) ) {
524
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
523
+			} elseif ($this->validate_version_number($cache)) {
524
+				if (version_compare($cache, $this->latest, '>=') >= 0) {
525 525
 					$latest_version = $cache;
526 526
 				}
527 527
 			}
@@ -537,10 +537,10 @@  discard block
 block discarded – undo
537 537
 		 */
538 538
 		public function get_latest_version_from_api() {
539 539
 			$version  = "0";
540
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
541
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
542
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
543
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
540
+			$response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest");
541
+			if (!is_wp_error($response) && is_array($response)) {
542
+				$api_response = json_decode(wp_remote_retrieve_body($response), true);
543
+				if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) {
544 544
 					$version = $api_response['tag_name'];
545 545
 				}
546 546
 			}
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 1 patch
Spacing   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function input($args = array()){
21
+	public static function input($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'text',
24 24
 			'name'       => '',
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 		/**
52 52
 		 * Parse incoming $args into an array and merge it with $defaults
53 53
 		 */
54
-		$args   = wp_parse_args( $args, $defaults );
54
+		$args   = wp_parse_args($args, $defaults);
55 55
 		$output = '';
56
-		if ( ! empty( $args['type'] ) ) {
56
+		if (!empty($args['type'])) {
57 57
 			// hidden label option needs to be empty
58 58
 			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
59 59
 
60
-			$type = sanitize_html_class( $args['type'] );
60
+			$type = sanitize_html_class($args['type']);
61 61
 
62 62
 			$help_text = '';
63 63
 			$label = '';
@@ -65,24 +65,24 @@  discard block
 block discarded – undo
65 65
 			$label_args = array(
66 66
 				'title'=> $args['label'],
67 67
 				'for'=> $args['id'],
68
-				'class' => $args['label_class']." ",
68
+				'class' => $args['label_class'] . " ",
69 69
 				'label_type' => $args['label_type']
70 70
 			);
71 71
 
72 72
 			// floating labels need label after
73
-			if( $args['label_type'] == 'floating' && $type != 'checkbox' ){
73
+			if ($args['label_type'] == 'floating' && $type != 'checkbox') {
74 74
 				$label_after = true;
75 75
 				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
76 76
 			}
77 77
 
78 78
 			// Some special sauce for files
79
-			if($type=='file' ){
79
+			if ($type == 'file') {
80 80
 				$label_after = true; // if type file we need the label after
81 81
 				$args['class'] .= ' custom-file-input ';
82
-			}elseif($type=='checkbox'){
82
+			}elseif ($type == 'checkbox') {
83 83
 				$label_after = true; // if type file we need the label after
84 84
 				$args['class'] .= ' custom-control-input ';
85
-			}elseif($type=='datepicker' || $type=='timepicker'){
85
+			}elseif ($type == 'datepicker' || $type == 'timepicker') {
86 86
 				$type = 'text';
87 87
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
88 88
 				$args['class'] .= ' bg-initial ';
@@ -98,65 +98,65 @@  discard block
 block discarded – undo
98 98
 			$output .= '<input type="' . $type . '" ';
99 99
 
100 100
 			// name
101
-			if(!empty($args['name'])){
102
-				$output .= ' name="'.esc_attr($args['name']).'" ';
101
+			if (!empty($args['name'])) {
102
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
103 103
 			}
104 104
 
105 105
 			// id
106
-			if(!empty($args['id'])){
107
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
106
+			if (!empty($args['id'])) {
107
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
108 108
 			}
109 109
 
110 110
 			// placeholder
111
-			if(!empty($args['placeholder'])){
112
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
111
+			if (!empty($args['placeholder'])) {
112
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
113 113
 			}
114 114
 
115 115
 			// title
116
-			if(!empty($args['title'])){
117
-				$output .= ' title="'.esc_attr($args['title']).'" ';
116
+			if (!empty($args['title'])) {
117
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
118 118
 			}
119 119
 
120 120
 			// value
121
-			if(!empty($args['value'])){
122
-				$output .= ' value="'.sanitize_text_field($args['value']).'" ';
121
+			if (!empty($args['value'])) {
122
+				$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
123 123
 			}
124 124
 
125 125
 			// checked, for radio and checkboxes
126
-			if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
126
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
127 127
 				$output .= ' checked ';
128 128
 			}
129 129
 
130 130
 			// validation text
131
-			if(!empty($args['validation_text'])){
132
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
131
+			if (!empty($args['validation_text'])) {
132
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
133 133
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
134 134
 			}
135 135
 
136 136
 			// validation_pattern
137
-			if(!empty($args['validation_pattern'])){
138
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
137
+			if (!empty($args['validation_pattern'])) {
138
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
139 139
 			}
140 140
 
141 141
 			// step (for numbers)
142
-			if(!empty($args['step'])){
143
-				$output .= ' step="'.$args['step'].'" ';
142
+			if (!empty($args['step'])) {
143
+				$output .= ' step="' . $args['step'] . '" ';
144 144
 			}
145 145
 
146 146
 			// required
147
-			if(!empty($args['required'])){
147
+			if (!empty($args['required'])) {
148 148
 				$output .= ' required ';
149 149
 			}
150 150
 
151 151
 			// class
152 152
 			$class = !empty($args['class']) ? $args['class'] : '';
153
-			$output .= ' class="form-control '.$class.'" ';
153
+			$output .= ' class="form-control ' . $class . '" ';
154 154
 
155 155
 			// data-attributes
156 156
 			$output .= AUI_Component_Helper::data_attributes($args);
157 157
 
158 158
 			// extra attributes
159
-			if(!empty($args['extra_attributes'])){
159
+			if (!empty($args['extra_attributes'])) {
160 160
 				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
161 161
 			}
162 162
 
@@ -165,40 +165,40 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
 			// label
168
-			if(!empty($args['label'])){
169
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
170
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
171
-				$label = self::label( $label_args, $type );
168
+			if (!empty($args['label'])) {
169
+				if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; }
170
+				elseif ($type == 'checkbox') {$label_args['class'] .= 'custom-control-label'; }
171
+				$label = self::label($label_args, $type);
172 172
 			}
173 173
 
174 174
 			// help text
175
-			if(!empty($args['help_text'])){
175
+			if (!empty($args['help_text'])) {
176 176
 				$help_text = AUI_Component_Helper::help_text($args['help_text']);
177 177
 			}
178 178
 
179 179
 
180 180
 			// set help text in the correct possition
181
-			if($label_after){
181
+			if ($label_after) {
182 182
 				$output .= $label . $help_text;
183 183
 			}
184 184
 
185 185
 			// some input types need a separate wrap
186
-			if($type == 'file') {
187
-				$output = self::wrap( array(
186
+			if ($type == 'file') {
187
+				$output = self::wrap(array(
188 188
 					'content' => $output,
189 189
 					'class'   => 'form-group custom-file'
190
-				) );
191
-			}elseif($type == 'checkbox'){
190
+				));
191
+			}elseif ($type == 'checkbox') {
192 192
 				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
193
-				$output = self::wrap( array(
193
+				$output = self::wrap(array(
194 194
 					'content' => $output,
195
-					'class'   => 'custom-control '.$wrap_class
196
-				) );
195
+					'class'   => 'custom-control ' . $wrap_class
196
+				));
197 197
 
198
-				if($args['label_type']=='horizontal'){
198
+				if ($args['label_type'] == 'horizontal') {
199 199
 					$output = '<div class="col-sm-2 col-form-label"></div><div class="col-sm-10">' . $output . '</div>';
200 200
 				}
201
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
201
+			}elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
202 202
 
203 203
 
204 204
 				// allow password field to toggle view
@@ -212,48 +212,48 @@  discard block
 block discarded – undo
212 212
 			}
213 213
 
214 214
 			// input group wraps
215
-			if($args['input_group_left'] || $args['input_group_right']){
215
+			if ($args['input_group_left'] || $args['input_group_right']) {
216 216
 				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
217
-				if($args['input_group_left']){
218
-					$output = self::wrap( array(
217
+				if ($args['input_group_left']) {
218
+					$output = self::wrap(array(
219 219
 						'content' => $output,
220
-						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative'.$w100  : 'input-group',
220
+						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
221 221
 						'input_group_left' => $args['input_group_left'],
222 222
 						'input_group_left_inside'    => $args['input_group_left_inside']
223
-					) );
223
+					));
224 224
 				}
225
-				if($args['input_group_right']){
226
-					$output = self::wrap( array(
225
+				if ($args['input_group_right']) {
226
+					$output = self::wrap(array(
227 227
 						'content' => $output,
228
-						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative'.$w100 : 'input-group',
228
+						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
229 229
 						'input_group_right' => $args['input_group_right'],
230 230
 						'input_group_right_inside'    => $args['input_group_right_inside']
231
-					) );
231
+					));
232 232
 				}
233 233
 
234 234
 			}
235 235
 
236
-			if(!$label_after){
236
+			if (!$label_after) {
237 237
 				$output .= $help_text;
238 238
 			}
239 239
 
240 240
 
241
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
242
-				$output = self::wrap( array(
241
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
242
+				$output = self::wrap(array(
243 243
 					'content' => $output,
244 244
 					'class'   => 'col-sm-10',
245
-				) );
245
+				));
246 246
 			}
247 247
 
248
-			if(!$label_after){
248
+			if (!$label_after) {
249 249
 				$output = $label . $output;
250 250
 			}
251 251
 
252 252
 			// wrap
253
-			if(!$args['no_wrap']){
253
+			if (!$args['no_wrap']) {
254 254
 
255
-				$form_group_class = $args['label_type']=='floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
256
-				$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
255
+				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
256
+				$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
257 257
 				$output = self::wrap(array(
258 258
 					'content' => $output,
259 259
 					'class'   => $wrap_class,
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return string The rendered component.
278 278
 	 */
279
-	public static function textarea($args = array()){
279
+	public static function textarea($args = array()) {
280 280
 		$defaults = array(
281 281
 			'name'       => '',
282 282
 			'class'      => '',
@@ -301,43 +301,43 @@  discard block
 block discarded – undo
301 301
 		/**
302 302
 		 * Parse incoming $args into an array and merge it with $defaults
303 303
 		 */
304
-		$args   = wp_parse_args( $args, $defaults );
304
+		$args   = wp_parse_args($args, $defaults);
305 305
 		$output = '';
306 306
 
307 307
 		// hidden label option needs to be empty
308 308
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
309 309
 
310 310
 		// floating labels don't work with wysiwyg so set it as top
311
-		if($args['label_type'] == 'floating' && !empty($args['wysiwyg'])){
311
+		if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) {
312 312
 			$args['label_type'] = 'top';
313 313
 		}
314 314
 
315 315
 		$label_after = $args['label_after'];
316 316
 
317 317
 		// floating labels need label after
318
-		if( $args['label_type'] == 'floating' && empty($args['wysiwyg']) ){
318
+		if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) {
319 319
 			$label_after = true;
320 320
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
321 321
 		}
322 322
 
323 323
 		// label
324
-		if(!empty($args['label']) && is_array($args['label'])){
325
-		}elseif(!empty($args['label']) && !$label_after){
324
+		if (!empty($args['label']) && is_array($args['label'])) {
325
+		}elseif (!empty($args['label']) && !$label_after) {
326 326
 			$label_args = array(
327 327
 				'title'=> $args['label'],
328 328
 				'for'=> $args['id'],
329
-				'class' => $args['label_class']." ",
329
+				'class' => $args['label_class'] . " ",
330 330
 				'label_type' => $args['label_type']
331 331
 			);
332
-			$output .= self::label( $label_args );
332
+			$output .= self::label($label_args);
333 333
 		}
334 334
 
335 335
 		// maybe horizontal label
336
-		if($args['label_type']=='horizontal'){
336
+		if ($args['label_type'] == 'horizontal') {
337 337
 			$output .= '<div class="col-sm-10">';
338 338
 		}
339 339
 
340
-		if(!empty($args['wysiwyg'])){
340
+		if (!empty($args['wysiwyg'])) {
341 341
 			ob_start();
342 342
 			$content = $args['value'];
343 343
 			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
@@ -351,69 +351,69 @@  discard block
 block discarded – undo
351 351
 			);
352 352
 
353 353
 			// maybe set settings if array
354
-			if(is_array($args['wysiwyg'])){
355
-				$settings  = wp_parse_args( $args['wysiwyg'], $settings );
354
+			if (is_array($args['wysiwyg'])) {
355
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
356 356
 			}
357 357
 
358
-			wp_editor( $content, $editor_id, $settings );
358
+			wp_editor($content, $editor_id, $settings);
359 359
 			$output .= ob_get_clean();
360
-		}else{
360
+		} else {
361 361
 
362 362
 			// open
363 363
 			$output .= '<textarea ';
364 364
 
365 365
 			// name
366
-			if(!empty($args['name'])){
367
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
366
+			if (!empty($args['name'])) {
367
+				$output .= ' name="' . sanitize_html_class($args['name']) . '" ';
368 368
 			}
369 369
 
370 370
 			// id
371
-			if(!empty($args['id'])){
372
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
371
+			if (!empty($args['id'])) {
372
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
373 373
 			}
374 374
 
375 375
 			// placeholder
376
-			if(!empty($args['placeholder'])){
377
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
376
+			if (!empty($args['placeholder'])) {
377
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
378 378
 			}
379 379
 
380 380
 			// title
381
-			if(!empty($args['title'])){
382
-				$output .= ' title="'.esc_attr($args['title']).'" ';
381
+			if (!empty($args['title'])) {
382
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
383 383
 			}
384 384
 
385 385
 			// validation text
386
-			if(!empty($args['validation_text'])){
387
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
386
+			if (!empty($args['validation_text'])) {
387
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
388 388
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
389 389
 			}
390 390
 
391 391
 			// validation_pattern
392
-			if(!empty($args['validation_pattern'])){
393
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
392
+			if (!empty($args['validation_pattern'])) {
393
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
394 394
 			}
395 395
 
396 396
 			// required
397
-			if(!empty($args['required'])){
397
+			if (!empty($args['required'])) {
398 398
 				$output .= ' required ';
399 399
 			}
400 400
 
401 401
 			// rows
402
-			if(!empty($args['rows'])){
403
-				$output .= ' rows="'.absint($args['rows']).'" ';
402
+			if (!empty($args['rows'])) {
403
+				$output .= ' rows="' . absint($args['rows']) . '" ';
404 404
 			}
405 405
 
406 406
 
407 407
 			// class
408 408
 			$class = !empty($args['class']) ? $args['class'] : '';
409
-			$output .= ' class="form-control '.$class.'" ';
409
+			$output .= ' class="form-control ' . $class . '" ';
410 410
 
411 411
 
412 412
 			// close tag
413 413
 			$output .= ' >';
414 414
 
415 415
 			// value
416
-			if(!empty($args['value'])){
416
+			if (!empty($args['value'])) {
417 417
 				$output .= sanitize_textarea_field($args['value']);
418 418
 			}
419 419
 
@@ -422,31 +422,31 @@  discard block
 block discarded – undo
422 422
 
423 423
 		}
424 424
 
425
-		if(!empty($args['label']) && $label_after){
425
+		if (!empty($args['label']) && $label_after) {
426 426
 			$label_args = array(
427 427
 				'title'=> $args['label'],
428 428
 				'for'=> $args['id'],
429
-				'class' => $args['label_class']." ",
429
+				'class' => $args['label_class'] . " ",
430 430
 				'label_type' => $args['label_type']
431 431
 			);
432
-			$output .= self::label( $label_args );
432
+			$output .= self::label($label_args);
433 433
 		}
434 434
 
435 435
 		// help text
436
-		if(!empty($args['help_text'])){
436
+		if (!empty($args['help_text'])) {
437 437
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
438 438
 		}
439 439
 
440 440
 		// maybe horizontal label
441
-		if($args['label_type']=='horizontal'){
441
+		if ($args['label_type'] == 'horizontal') {
442 442
 			$output .= '</div>';
443 443
 		}
444 444
 
445 445
 
446 446
 		// wrap
447
-		if(!$args['no_wrap']){
448
-			$form_group_class = $args['label_type']=='floating' ? 'form-label-group' : 'form-group';
449
-			$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
447
+		if (!$args['no_wrap']) {
448
+			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
449
+			$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
450 450
 			$output = self::wrap(array(
451 451
 				'content' => $output,
452 452
 				'class'   => $wrap_class,
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		return $output;
460 460
 	}
461 461
 
462
-	public static function label($args = array(), $type = ''){
462
+	public static function label($args = array(), $type = '') {
463 463
 		//<label for="exampleInputEmail1">Email address</label>
464 464
 		$defaults = array(
465 465
 			'title'       => 'div',
@@ -471,20 +471,20 @@  discard block
 block discarded – undo
471 471
 		/**
472 472
 		 * Parse incoming $args into an array and merge it with $defaults
473 473
 		 */
474
-		$args   = wp_parse_args( $args, $defaults );
474
+		$args   = wp_parse_args($args, $defaults);
475 475
 		$output = '';
476 476
 
477
-		if($args['title']){
477
+		if ($args['title']) {
478 478
 
479 479
 			// maybe hide labels //@todo set a global option for visibility class
480
-			if($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type']) ){
480
+			if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) {
481 481
 				$class = $args['class'];
482
-			}else{
483
-				$class = 'sr-only '.$args['class'];
482
+			} else {
483
+				$class = 'sr-only ' . $args['class'];
484 484
 			}
485 485
 
486 486
 			// maybe horizontal
487
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
487
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
488 488
 				$class .= ' col-sm-2 col-form-label';
489 489
 			}
490 490
 
@@ -492,19 +492,19 @@  discard block
 block discarded – undo
492 492
 			$output .= '<label ';
493 493
 
494 494
 			// for
495
-			if(!empty($args['for'])){
496
-				$output .= ' for="'.sanitize_text_field($args['for']).'" ';
495
+			if (!empty($args['for'])) {
496
+				$output .= ' for="' . sanitize_text_field($args['for']) . '" ';
497 497
 			}
498 498
 
499 499
 			// class
500
-			$output .= ' class="'.$class.'" ';
500
+			$output .= ' class="' . $class . '" ';
501 501
 
502 502
 			// close
503 503
 			$output .= '>';
504 504
 
505 505
 
506 506
 			// title, don't escape fully as can contain html
507
-			if(!empty($args['title'])){
507
+			if (!empty($args['title'])) {
508 508
 				$output .= wp_kses_post($args['title']);
509 509
 			}
510 510
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		return $output;
519 519
 	}
520 520
 
521
-	public static function wrap($args = array()){
521
+	public static function wrap($args = array()) {
522 522
 		$defaults = array(
523 523
 			'type'       => 'div',
524 524
 			'class'      => 'form-group',
@@ -534,55 +534,55 @@  discard block
 block discarded – undo
534 534
 		/**
535 535
 		 * Parse incoming $args into an array and merge it with $defaults
536 536
 		 */
537
-		$args   = wp_parse_args( $args, $defaults );
537
+		$args   = wp_parse_args($args, $defaults);
538 538
 		$output = '';
539
-		if($args['type']){
539
+		if ($args['type']) {
540 540
 
541 541
 			// open
542
-			$output .= '<'.sanitize_html_class($args['type']);
542
+			$output .= '<' . sanitize_html_class($args['type']);
543 543
 
544 544
 			// element require
545
-			if(!empty($args['element_require'])){
545
+			if (!empty($args['element_require'])) {
546 546
 				$output .= AUI_Component_Helper::element_require($args['element_require']);
547 547
 				$args['class'] .= " aui-conditional-field";
548 548
 			}
549 549
 
550 550
 			// argument_id
551
-			if( !empty($args['argument_id']) ){
552
-				$output .= ' data-argument="'.esc_attr($args['argument_id']).'"';
551
+			if (!empty($args['argument_id'])) {
552
+				$output .= ' data-argument="' . esc_attr($args['argument_id']) . '"';
553 553
 			}
554 554
 
555 555
 			// class
556 556
 			$class = !empty($args['class']) ? $args['class'] : '';
557
-			$output .= ' class="'.$class.'" ';
557
+			$output .= ' class="' . $class . '" ';
558 558
 
559 559
 			// close wrap
560 560
 			$output .= ' >';
561 561
 
562 562
 
563 563
 			// Input group left
564
-			if(!empty($args['input_group_left'])){
564
+			if (!empty($args['input_group_left'])) {
565 565
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
566
-				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
567
-				$output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
566
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
567
+				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
568 568
 			}
569 569
 
570 570
 			// content
571 571
 			$output .= $args['content'];
572 572
 
573 573
 			// Input group right
574
-			if(!empty($args['input_group_right'])){
574
+			if (!empty($args['input_group_right'])) {
575 575
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
576
-				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
577
-				$output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
576
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
577
+				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
578 578
 			}
579 579
 
580 580
 
581 581
 			// close wrap
582
-			$output .= '</'.sanitize_html_class($args['type']).'>';
582
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
583 583
 
584 584
 
585
-		}else{
585
+		} else {
586 586
 			$output = $args['content'];
587 587
 		}
588 588
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @return string The rendered component.
598 598
 	 */
599
-	public static function select($args = array()){
599
+	public static function select($args = array()) {
600 600
 		$defaults = array(
601 601
 			'class'      => '',
602 602
 			'id'         => '',
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
 		/**
622 622
 		 * Parse incoming $args into an array and merge it with $defaults
623 623
 		 */
624
-		$args   = wp_parse_args( $args, $defaults );
624
+		$args   = wp_parse_args($args, $defaults);
625 625
 		$output = '';
626 626
 
627 627
 		// for now lets hide floating labels
628
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'hidden';}
628
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'hidden'; }
629 629
 
630 630
 		// hidden label option needs to be empty
631 631
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
@@ -634,47 +634,47 @@  discard block
 block discarded – undo
634 634
 		$label_after = $args['label_after'];
635 635
 
636 636
 		// floating labels need label after
637
-		if( $args['label_type'] == 'floating' ){
637
+		if ($args['label_type'] == 'floating') {
638 638
 			$label_after = true;
639 639
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
640 640
 		}
641 641
 
642 642
 		// Maybe setup select2
643 643
 		$is_select2 = false;
644
-		if(!empty($args['select2'])){
644
+		if (!empty($args['select2'])) {
645 645
 			$args['class'] .= ' aui-select2';
646 646
 			$is_select2 = true;
647
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
647
+		}elseif (strpos($args['class'], 'aui-select2') !== false) {
648 648
 			$is_select2 = true;
649 649
 		}
650 650
 
651 651
 		// select2 tags
652
-		if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equals needed here for some reason
652
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason
653 653
 			$args['data-tags'] = 'true';
654 654
 			$args['data-token-separators'] = "[',']";
655 655
 			$args['multiple'] = true;
656 656
 		}
657 657
 
658 658
 		// select2 placeholder
659
-		if($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])){
659
+		if ($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])) {
660 660
 			$args['data-placeholder'] = esc_attr($args['placeholder']);
661 661
 			$args['data-allow-clear'] = empty($args['data-allow-clear']) ? true : esc_attr($args['data-allow-clear']);
662 662
 		}
663 663
 
664 664
 		// label
665
-		if(!empty($args['label']) && is_array($args['label'])){
666
-		}elseif(!empty($args['label']) && !$label_after){
665
+		if (!empty($args['label']) && is_array($args['label'])) {
666
+		}elseif (!empty($args['label']) && !$label_after) {
667 667
 			$label_args = array(
668 668
 				'title'=> $args['label'],
669 669
 				'for'=> $args['id'],
670
-				'class' => $args['label_class']." ",
670
+				'class' => $args['label_class'] . " ",
671 671
 				'label_type' => $args['label_type']
672 672
 			);
673 673
 			$output .= self::label($label_args);
674 674
 		}
675 675
 
676 676
 		// maybe horizontal label
677
-		if($args['label_type']=='horizontal'){
677
+		if ($args['label_type'] == 'horizontal') {
678 678
 			$output .= '<div class="col-sm-10">';
679 679
 		}
680 680
 
@@ -682,32 +682,32 @@  discard block
 block discarded – undo
682 682
 		$output .= '<select ';
683 683
 
684 684
 		// style
685
-		if($is_select2){
685
+		if ($is_select2) {
686 686
 			$output .= " style='width:100%;' ";
687 687
 		}
688 688
 
689 689
 		// element require
690
-		if(!empty($args['element_require'])){
690
+		if (!empty($args['element_require'])) {
691 691
 			$output .= AUI_Component_Helper::element_require($args['element_require']);
692 692
 			$args['class'] .= " aui-conditional-field";
693 693
 		}
694 694
 
695 695
 		// class
696 696
 		$class = !empty($args['class']) ? $args['class'] : '';
697
-		$output .= AUI_Component_Helper::class_attr('custom-select '.$class);
697
+		$output .= AUI_Component_Helper::class_attr('custom-select ' . $class);
698 698
 
699 699
 		// name
700
-		if(!empty($args['name'])){
701
-			$output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
700
+		if (!empty($args['name'])) {
701
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
702 702
 		}
703 703
 
704 704
 		// id
705
-		if(!empty($args['id'])){
705
+		if (!empty($args['id'])) {
706 706
 			$output .= AUI_Component_Helper::id($args['id']);
707 707
 		}
708 708
 
709 709
 		// title
710
-		if(!empty($args['title'])){
710
+		if (!empty($args['title'])) {
711 711
 			$output .= AUI_Component_Helper::title($args['title']);
712 712
 		}
713 713
 
@@ -718,17 +718,17 @@  discard block
 block discarded – undo
718 718
 		$output .= AUI_Component_Helper::aria_attributes($args);
719 719
 
720 720
 		// extra attributes
721
-		if(!empty($args['extra_attributes'])){
721
+		if (!empty($args['extra_attributes'])) {
722 722
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
723 723
 		}
724 724
 
725 725
 		// required
726
-		if(!empty($args['required'])){
726
+		if (!empty($args['required'])) {
727 727
 			$output .= ' required ';
728 728
 		}
729 729
 
730 730
 		// multiple
731
-		if(!empty($args['multiple'])){
731
+		if (!empty($args['multiple'])) {
732 732
 			$output .= ' multiple ';
733 733
 		}
734 734
 
@@ -736,21 +736,21 @@  discard block
 block discarded – undo
736 736
 		$output .= ' >';
737 737
 
738 738
 		// placeholder
739
-		if(!empty($args['placeholder']) && !$is_select2){
740
-			$output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
741
-		}elseif($is_select2 && !empty($args['placeholder'])){
739
+		if (!empty($args['placeholder']) && !$is_select2) {
740
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
741
+		}elseif ($is_select2 && !empty($args['placeholder'])) {
742 742
 			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
743 743
 		}
744 744
 
745 745
 		// Options
746
-		if(!empty($args['options'])){
746
+		if (!empty($args['options'])) {
747 747
 
748
-			if(!is_array($args['options'])){
748
+			if (!is_array($args['options'])) {
749 749
 				$output .= $args['options']; // not the preferred way but an option
750
-			}else{
751
-				foreach($args['options'] as $val => $name){
750
+			} else {
751
+				foreach ($args['options'] as $val => $name) {
752 752
 					$selected = '';
753
-					if(is_array($name)){
753
+					if (is_array($name)) {
754 754
 						if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
755 755
 							$option_label = isset($name['label']) ? $name['label'] : '';
756 756
 
@@ -758,23 +758,23 @@  discard block
 block discarded – undo
758 758
 						} else {
759 759
 							$option_label = isset($name['label']) ? $name['label'] : '';
760 760
 							$option_value = isset($name['value']) ? $name['value'] : '';
761
-							if(!empty($args['multiple']) && !empty($args['value']) && is_array($args['value']) ){
761
+							if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) {
762 762
 								$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
763
-							} elseif(!empty($args['value'])) {
764
-								$selected = selected($option_value,stripslashes_deep($args['value']), false);
763
+							} elseif (!empty($args['value'])) {
764
+								$selected = selected($option_value, stripslashes_deep($args['value']), false);
765 765
 							}
766 766
 
767 767
 							$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
768 768
 						}
769
-					}else{
770
-						if(!empty($args['value'])){
771
-							if(is_array($args['value'])){
772
-								$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
773
-							} elseif(!empty($args['value'])) {
774
-								$selected = selected( $args['value'], $val, false);
769
+					} else {
770
+						if (!empty($args['value'])) {
771
+							if (is_array($args['value'])) {
772
+								$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
773
+							} elseif (!empty($args['value'])) {
774
+								$selected = selected($args['value'], $val, false);
775 775
 							}
776 776
 						}
777
-						$output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';
777
+						$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';
778 778
 					}
779 779
 				}
780 780
 			}
@@ -784,30 +784,30 @@  discard block
 block discarded – undo
784 784
 		// closing tag
785 785
 		$output .= '</select>';
786 786
 
787
-		if(!empty($args['label']) && $label_after){
787
+		if (!empty($args['label']) && $label_after) {
788 788
 			$label_args = array(
789 789
 				'title'=> $args['label'],
790 790
 				'for'=> $args['id'],
791
-				'class' => $args['label_class']." ",
791
+				'class' => $args['label_class'] . " ",
792 792
 				'label_type' => $args['label_type']
793 793
 			);
794 794
 			$output .= self::label($label_args);
795 795
 		}
796 796
 
797 797
 		// help text
798
-		if(!empty($args['help_text'])){
798
+		if (!empty($args['help_text'])) {
799 799
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
800 800
 		}
801 801
 
802 802
 		// maybe horizontal label
803
-		if($args['label_type']=='horizontal'){
803
+		if ($args['label_type'] == 'horizontal') {
804 804
 			$output .= '</div>';
805 805
 		}
806 806
 
807 807
 
808 808
 		// wrap
809
-		if(!$args['no_wrap']){
810
-			$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
809
+		if (!$args['no_wrap']) {
810
+			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
811 811
 			$output = self::wrap(array(
812 812
 				'content' => $output,
813 813
 				'class'   => $wrap_class,
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 *
828 828
 	 * @return string The rendered component.
829 829
 	 */
830
-	public static function radio($args = array()){
830
+	public static function radio($args = array()) {
831 831
 		$defaults = array(
832 832
 			'class'      => '',
833 833
 			'id'         => '',
@@ -849,14 +849,14 @@  discard block
 block discarded – undo
849 849
 		/**
850 850
 		 * Parse incoming $args into an array and merge it with $defaults
851 851
 		 */
852
-		$args   = wp_parse_args( $args, $defaults );
852
+		$args = wp_parse_args($args, $defaults);
853 853
 
854 854
 		// for now lets use horizontal for floating
855
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'horizontal';}
855
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'horizontal'; }
856 856
 
857 857
 		$label_args = array(
858 858
 			'title'=> $args['label'],
859
-			'class' => $args['label_class']." pt-0 ",
859
+			'class' => $args['label_class'] . " pt-0 ",
860 860
 			'label_type' => $args['label_type']
861 861
 		);
862 862
 
@@ -865,35 +865,35 @@  discard block
 block discarded – undo
865 865
 
866 866
 
867 867
 		// label before
868
-		if(!empty($args['label'])){
869
-			$output .= self::label( $label_args, 'radio' );
868
+		if (!empty($args['label'])) {
869
+			$output .= self::label($label_args, 'radio');
870 870
 		}
871 871
 
872 872
 		// maybe horizontal label
873
-		if($args['label_type']=='horizontal'){
873
+		if ($args['label_type'] == 'horizontal') {
874 874
 			$output .= '<div class="col-sm-10">';
875 875
 		}
876 876
 
877
-		if(!empty($args['options'])){
877
+		if (!empty($args['options'])) {
878 878
 			$count = 0;
879
-			foreach($args['options'] as $value => $label){
879
+			foreach ($args['options'] as $value => $label) {
880 880
 				$option_args = $args;
881 881
 				$option_args['value'] = $value;
882 882
 				$option_args['label'] = $label;
883 883
 				$option_args['checked'] = $value == $args['value'] ? true : false;
884
-				$output .= self::radio_option($option_args,$count);
884
+				$output .= self::radio_option($option_args, $count);
885 885
 				$count++;
886 886
 			}
887 887
 		}
888 888
 
889 889
 		// maybe horizontal label
890
-		if($args['label_type']=='horizontal'){
890
+		if ($args['label_type'] == 'horizontal') {
891 891
 			$output .= '</div>';
892 892
 		}
893 893
 
894 894
 
895 895
 		// wrap
896
-		$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
896
+		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
897 897
 		$output = self::wrap(array(
898 898
 			'content' => $output,
899 899
 			'class'   => $wrap_class,
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 	 *
913 913
 	 * @return string The rendered component.
914 914
 	 */
915
-	public static function radio_option($args = array(),$count = ''){
915
+	public static function radio_option($args = array(), $count = '') {
916 916
 		$defaults = array(
917 917
 			'class'      => '',
918 918
 			'id'         => '',
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 		/**
931 931
 		 * Parse incoming $args into an array and merge it with $defaults
932 932
 		 */
933
-		$args   = wp_parse_args( $args, $defaults );
933
+		$args   = wp_parse_args($args, $defaults);
934 934
 
935 935
 		$output = '';
936 936
 
@@ -941,27 +941,27 @@  discard block
 block discarded – undo
941 941
 		$output .= ' class="form-check-input" ';
942 942
 
943 943
 		// name
944
-		if(!empty($args['name'])){
944
+		if (!empty($args['name'])) {
945 945
 			$output .= AUI_Component_Helper::name($args['name']);
946 946
 		}
947 947
 
948 948
 		// id
949
-		if(!empty($args['id'])){
950
-			$output .= AUI_Component_Helper::id($args['id'].$count);
949
+		if (!empty($args['id'])) {
950
+			$output .= AUI_Component_Helper::id($args['id'] . $count);
951 951
 		}
952 952
 
953 953
 		// title
954
-		if(!empty($args['title'])){
954
+		if (!empty($args['title'])) {
955 955
 			$output .= AUI_Component_Helper::title($args['title']);
956 956
 		}
957 957
 
958 958
 		// value
959
-		if(isset($args['value'])){
960
-			$output .= ' value="'.sanitize_text_field($args['value']).'" ';
959
+		if (isset($args['value'])) {
960
+			$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
961 961
 		}
962 962
 
963 963
 		// checked, for radio and checkboxes
964
-		if( $args['checked'] ){
964
+		if ($args['checked']) {
965 965
 			$output .= ' checked ';
966 966
 		}
967 967
 
@@ -972,12 +972,12 @@  discard block
 block discarded – undo
972 972
 		$output .= AUI_Component_Helper::aria_attributes($args);
973 973
 
974 974
 		// extra attributes
975
-		if(!empty($args['extra_attributes'])){
975
+		if (!empty($args['extra_attributes'])) {
976 976
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
977 977
 		}
978 978
 
979 979
 		// required
980
-		if(!empty($args['required'])){
980
+		if (!empty($args['required'])) {
981 981
 			$output .= ' required ';
982 982
 		}
983 983
 
@@ -985,13 +985,13 @@  discard block
 block discarded – undo
985 985
 		$output .= ' >';
986 986
 
987 987
 		// label
988
-		if(!empty($args['label']) && is_array($args['label'])){
989
-		}elseif(!empty($args['label'])){
990
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id'].$count,'class'=>'form-check-label'),'radio');
988
+		if (!empty($args['label']) && is_array($args['label'])) {
989
+		}elseif (!empty($args['label'])) {
990
+			$output .= self::label(array('title'=>$args['label'], 'for'=>$args['id'] . $count, 'class'=>'form-check-label'), 'radio');
991 991
 		}
992 992
 
993 993
 		// wrap
994
-		if(!$args['no_wrap']){
994
+		if (!$args['no_wrap']) {
995 995
 			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
996 996
 			$output = self::wrap(array(
997 997
 				'content' => $output,
Please login to merge, or discard this patch.
wp-ayecode-ui/includes/components/class-aui-component-pagination.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get( $args = array() ) {
21
+	public static function get($args = array()) {
22 22
 		global $wp_query;
23 23
 
24 24
 		$defaults = array(
@@ -26,57 +26,57 @@  discard block
 block discarded – undo
26 26
 			'mid_size'           => 2,
27 27
 			'prev_text'          => '<i class="fas fa-chevron-left"></i>',
28 28
 			'next_text'          => '<i class="fas fa-chevron-right"></i>',
29
-			'screen_reader_text' => __( 'Posts navigation','aui' ),
29
+			'screen_reader_text' => __('Posts navigation', 'aui'),
30 30
 			'before_paging' => '',
31 31
 			'after_paging'  => '',
32 32
 			'type'               => 'array',
33
-			'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1,
33
+			'total'              => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1,
34 34
 			'links'              => array() // an array of links if using custom links, this includes the a tag.
35 35
 		);
36 36
 
37 37
 		/**
38 38
 		 * Parse incoming $args into an array and merge it with $defaults
39 39
 		 */
40
-		$args = wp_parse_args( $args, $defaults );
40
+		$args = wp_parse_args($args, $defaults);
41 41
 
42 42
 		$output = '';
43 43
 
44 44
 		// Don't print empty markup if there's only one page.
45
-		if ( $args['total'] > 1 ) {
45
+		if ($args['total'] > 1) {
46 46
 
47 47
 			// Set up paginated links.
48
-			$links = !empty(  $args['links'] ) ? $args['links'] :  paginate_links( $args );
48
+			$links = !empty($args['links']) ? $args['links'] : paginate_links($args);
49 49
 
50 50
 			$class = !empty($args['class']) ? $args['class'] : '';
51 51
 
52 52
 			// make the output bootstrap ready
53 53
 			$links_html = "<ul class='pagination m-0 p-0 $class'>";
54
-			if ( ! empty( $links ) ) {
55
-				foreach ( $links as $link ) {
56
-					$active = strpos( $link, 'current' ) !== false ? 'active' : '';
54
+			if (!empty($links)) {
55
+				foreach ($links as $link) {
56
+					$active = strpos($link, 'current') !== false ? 'active' : '';
57 57
 					$links_html .= "<li class='page-item $active'>";
58
-					$links_html .= str_replace( "page-numbers", "page-link", $link );
58
+					$links_html .= str_replace("page-numbers", "page-link", $link);
59 59
 					$links_html .= "</li>";
60 60
 				}
61 61
 			}
62 62
 			$links_html .= "</ul>";
63 63
 
64
-			if ( $links ) {
64
+			if ($links) {
65 65
 				$output .= '<section class="px-0 py-2 w-100">';
66
-				$output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
66
+				$output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']);
67 67
 				$output .= '</section>';
68 68
 			}
69 69
 
70
-			$output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
71
-			$output = str_replace( "nav-links", "aui-nav-links", $output );
70
+			$output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output);
71
+			$output = str_replace("nav-links", "aui-nav-links", $output);
72 72
 		}
73 73
 
74
-		if ( $output ) {
75
-			if ( ! empty( $args['before_paging'] ) ) {
74
+		if ($output) {
75
+			if (!empty($args['before_paging'])) {
76 76
 				$output = $args['before_paging'] . $output;
77 77
 			}
78 78
 
79
-			if ( ! empty( $args['after_paging'] ) ) {
79
+			if (!empty($args['after_paging'])) {
80 80
 				$output = $output . $args['after_paging'];
81 81
 			}
82 82
 		}
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-helper.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string
20 20
 	 */
21
-	public static function name($text,$multiple = false){
21
+	public static function name($text, $multiple = false) {
22 22
 		$output = '';
23 23
 
24
-		if($text){
25
-			$is_multiple = strpos($text, '[]') !== false || (strpos($text, '[]') === false && $multiple ) ? '[]' : '';
26
-			$output = ' name="'.sanitize_html_class($text).$is_multiple.'" ';
24
+		if ($text) {
25
+			$is_multiple = strpos($text, '[]') !== false || (strpos($text, '[]') === false && $multiple) ? '[]' : '';
26
+			$output = ' name="' . sanitize_html_class($text) . $is_multiple . '" ';
27 27
 		}
28 28
 
29 29
 		return $output;
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return string The sanitized item.
38 38
 	 */
39
-	public static function id($text){
39
+	public static function id($text) {
40 40
 		$output = '';
41 41
 
42
-		if($text){
43
-			$output = ' id="'.sanitize_html_class($text).'" ';
42
+		if ($text) {
43
+			$output = ' id="' . sanitize_html_class($text) . '" ';
44 44
 		}
45 45
 
46 46
 		return $output;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return string The sanitized item.
55 55
 	 */
56
-	public static function title($text){
56
+	public static function title($text) {
57 57
 		$output = '';
58 58
 
59
-		if($text){
60
-			$output = ' title="'.esc_attr($text).'" ';
59
+		if ($text) {
60
+			$output = ' title="' . esc_attr($text) . '" ';
61 61
 		}
62 62
 
63 63
 		return $output;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string The sanitized item.
72 72
 	 */
73
-	public static function value($text){
73
+	public static function value($text) {
74 74
 		$output = '';
75 75
 
76
-		if($text){
77
-			$output = ' value="'.sanitize_text_field($text).'" ';
76
+		if ($text) {
77
+			$output = ' value="' . sanitize_text_field($text) . '" ';
78 78
 		}
79 79
 
80 80
 		return $output;
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string The sanitized item.
89 89
 	 */
90
-	public static function class_attr($text){
90
+	public static function class_attr($text) {
91 91
 		$output = '';
92 92
 
93
-		if($text){
93
+		if ($text) {
94 94
 			$classes = self::esc_classes($text);
95
-			if(!empty($classes)){
96
-				$output = ' class="'.$classes.'" ';
95
+			if (!empty($classes)) {
96
+				$output = ' class="' . $classes . '" ';
97 97
 			}
98 98
 		}
99 99
 
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public static function esc_classes($text){
110
+	public static function esc_classes($text) {
111 111
 		$output = '';
112 112
 
113
-		if($text){
114
-			$classes = explode(" ",$text);
115
-			$classes = array_map("trim",$classes);
116
-			$classes = array_map("sanitize_html_class",$classes);
117
-			if(!empty($classes)){
118
-				$output = implode(" ",$classes);
113
+		if ($text) {
114
+			$classes = explode(" ", $text);
115
+			$classes = array_map("trim", $classes);
116
+			$classes = array_map("sanitize_html_class", $classes);
117
+			if (!empty($classes)) {
118
+				$output = implode(" ", $classes);
119 119
 			}
120 120
 		}
121 121
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return string
130 130
 	 */
131
-	public static function data_attributes($args){
131
+	public static function data_attributes($args) {
132 132
 		$output = '';
133 133
 
134
-		if(!empty($args)){
134
+		if (!empty($args)) {
135 135
 
136
-			foreach($args as $key => $val){
137
-				if(substr( $key, 0, 5 ) === "data-"){
138
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
136
+			foreach ($args as $key => $val) {
137
+				if (substr($key, 0, 5) === "data-") {
138
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
139 139
 				}
140 140
 			}
141 141
 		}
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return string
150 150
 	 */
151
-	public static function aria_attributes($args){
151
+	public static function aria_attributes($args) {
152 152
 		$output = '';
153 153
 
154
-		if(!empty($args)){
154
+		if (!empty($args)) {
155 155
 
156
-			foreach($args as $key => $val){
157
-				if(substr( $key, 0, 5 ) === "aria-"){
158
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
156
+			foreach ($args as $key => $val) {
157
+				if (substr($key, 0, 5) === "aria-") {
158
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
159 159
 				}
160 160
 			}
161 161
 		}
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public static function icon($class,$space_after = false, $extra_attributes = array()){
175
+	public static function icon($class, $space_after = false, $extra_attributes = array()) {
176 176
 		$output = '';
177 177
 
178
-		if($class){
178
+		if ($class) {
179 179
 			$classes = self::esc_classes($class);
180
-			if(!empty($classes)){
181
-				$output = '<i class="'.$classes.'" ';
180
+			if (!empty($classes)) {
181
+				$output = '<i class="' . $classes . '" ';
182 182
 				// extra attributes
183
-				if(!empty($extra_attributes)){
183
+				if (!empty($extra_attributes)) {
184 184
 					$output .= AUI_Component_Helper::extra_attributes($extra_attributes);
185 185
 				}
186 186
 				$output .= '></i>';
187
-				if($space_after){
187
+				if ($space_after) {
188 188
 					$output .= " ";
189 189
 				}
190 190
 			}
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return string
200 200
 	 */
201
-	public static function extra_attributes($args){
201
+	public static function extra_attributes($args) {
202 202
 		$output = '';
203 203
 
204
-		if(!empty($args)){
204
+		if (!empty($args)) {
205 205
 
206
-			if( is_array($args) ){
207
-				foreach($args as $key => $val){
208
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
206
+			if (is_array($args)) {
207
+				foreach ($args as $key => $val) {
208
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
209 209
 				}
210
-			}else{
211
-				$output .= ' '.$args.' ';
210
+			} else {
211
+				$output .= ' ' . $args . ' ';
212 212
 			}
213 213
 
214 214
 		}
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return string
223 223
 	 */
224
-	public static function help_text($text){
224
+	public static function help_text($text) {
225 225
 		$output = '';
226 226
 
227
-		if($text){
228
-			$output .= '<small class="form-text text-muted">'.wp_kses_post($text).'</small>';
227
+		if ($text) {
228
+			$output .= '<small class="form-text text-muted">' . wp_kses_post($text) . '</small>';
229 229
 		}
230 230
 
231 231
 
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string|void
241 241
 	 */
242
-	public static function element_require( $input ) {
242
+	public static function element_require($input) {
243 243
 
244
-		$input = str_replace( "'", '"', $input );// we only want double quotes
244
+		$input = str_replace("'", '"', $input); // we only want double quotes
245 245
 
246
-		$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
246
+		$output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array(
247 247
 			"jQuery(form).find('[data-argument=\"",
248 248
 			"\"]').find('input,select,textarea').val()",
249 249
 			"\"]').find('input:checked').val()",
250
-		), $input ) );
250
+		), $input));
251 251
 
252
-		if($output){
253
-			$output = ' data-element-require="'.$output.'" ';
252
+		if ($output) {
253
+			$output = ' data-element-require="' . $output . '" ';
254 254
 		}
255 255
 
256 256
 		return $output;
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 		 * @return AyeCode_UI_Settings - Main instance.
99 99
 		 */
100 100
 		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
101
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
102 102
 
103 103
 				self::$instance = new AyeCode_UI_Settings;
104 104
 
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+				add_action('init', array(self::$instance, 'init')); // set settings
106 106
 
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
107
+				if (is_admin()) {
108
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
109
+					add_action('admin_init', array(self::$instance, 'register_settings'));
110 110
 
111 111
 					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
113 113
 				}
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
117
+				do_action('ayecode_ui_settings_loaded');
118 118
 			}
119 119
 
120 120
 			return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		/**
124 124
 		 * Setup some constants.
125 125
 		 */
126
-		public function constants(){
126
+		public function constants() {
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129 129
 			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
@@ -143,24 +143,24 @@  discard block
 block discarded – undo
143 143
 			 *
144 144
 			 * We load super early in case there is a theme version that might change the colors
145 145
 			 */
146
-			if ( $this->settings['css'] ) {
147
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
146
+			if ($this->settings['css']) {
147
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1);
148 148
 			}
149
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
149
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
150
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
151 151
 			}
152 152
 
153 153
 			// maybe load JS
154
-			if ( $this->settings['js'] ) {
155
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
154
+			if ($this->settings['js']) {
155
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
156 156
 			}
157
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
158
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
157
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
158
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
159 159
 			}
160 160
 
161 161
 			// Maybe set the HTML font size
162
-			if ( $this->settings['html_font_size'] ) {
163
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
162
+			if ($this->settings['html_font_size']) {
163
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
164 164
 			}
165 165
 
166 166
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		 *
172 172
 		 * @return bool
173 173
 		 */
174
-		public function load_admin_scripts(){
174
+		public function load_admin_scripts() {
175 175
 			$result = true;
176 176
 
177
-			if(!empty($this->settings['disable_admin'])){
178
-				$url_parts = explode("\n",$this->settings['disable_admin']);
179
-				foreach($url_parts as $part){
180
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
177
+			if (!empty($this->settings['disable_admin'])) {
178
+				$url_parts = explode("\n", $this->settings['disable_admin']);
179
+				foreach ($url_parts as $part) {
180
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
181 181
 						return false; // return early, no point checking further
182 182
 					}
183 183
 				}
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 		/**
190 190
 		 * Add a html font size to the footer.
191 191
 		 */
192
-		public function html_font_size(){
192
+		public function html_font_size() {
193 193
 			$this->settings = $this->get_settings();
194
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
194
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
195 195
 		}
196 196
 
197 197
 		/**
@@ -201,18 +201,18 @@  discard block
 block discarded – undo
201 201
 
202 202
 			$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
203 203
 
204
-			if($this->settings[$css_setting]){
205
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
206
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
207
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
208
-				wp_enqueue_style( 'ayecode-ui' );
204
+			if ($this->settings[$css_setting]) {
205
+				$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
206
+				$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui.css' : $this->url . 'assets/css/ayecode-ui-compatibility.css';
207
+				wp_register_style('ayecode-ui', $url, array(), $this->latest);
208
+				wp_enqueue_style('ayecode-ui');
209 209
 
210 210
 				// flatpickr
211
-				wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
211
+				wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest);
212 212
 
213 213
 
214 214
 				// fix some wp-admin issues
215
-				if(is_admin()){
215
+				if (is_admin()) {
216 216
 					$custom_css = "
217 217
                 body{
218 218
                     background-color: #f1f1f1;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 						    padding: 0;
256 256
 						}
257 257
 					";
258
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
258
+					wp_add_inline_style('ayecode-ui', $custom_css);
259 259
 				}
260 260
 
261 261
 				// custom changes
262
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
262
+				wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
263 263
 
264 264
 			}
265 265
 		}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * If this remains small then its best to use this than to add another JS file.
271 271
 		 */
272
-		public function inline_script(){
272
+		public function inline_script() {
273 273
 			ob_start();
274 274
 			?>
275 275
 			<script>
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 			/*
764 764
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
765 765
 			 */
766
-			return str_replace( array(
766
+			return str_replace(array(
767 767
 				'<script>',
768 768
 				'</script>'
769
-			), '', $output );
769
+			), '', $output);
770 770
 		}
771 771
 
772 772
 		/**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 		 *
775 775
 		 * If this remains small then its best to use this than to add another JS file.
776 776
 		 */
777
-		public function inline_script_file_browser(){
777
+		public function inline_script_file_browser() {
778 778
 			ob_start();
779 779
 			?>
780 780
 			<script>
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
 			/*
790 790
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
791 791
 			 */
792
-			return str_replace( array(
792
+			return str_replace(array(
793 793
 				'<script>',
794 794
 				'</script>'
795
-			), '', $output );
795
+			), '', $output);
796 796
 		}
797 797
 
798 798
 		/**
@@ -803,40 +803,40 @@  discard block
 block discarded – undo
803 803
 			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
804 804
 
805 805
 			// select2
806
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
806
+			wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
807 807
 
808 808
 			// flatpickr
809
-			wp_register_script( 'flatpickr', $this->url.'assets/js/flatpickr.min.js', array(), $this->latest );
809
+			wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest);
810 810
 
811 811
 			// Bootstrap file browser
812
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
813
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
812
+			wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
813
+			wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
814 814
 
815 815
 			$load_inline = false;
816 816
 
817
-			if($this->settings[$js_setting]=='core-popper'){
817
+			if ($this->settings[$js_setting] == 'core-popper') {
818 818
 				// Bootstrap bundle
819
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
820
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
819
+				$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
820
+				wp_register_script('bootstrap-js-bundle', $url, array('select2', 'jquery'), $this->latest);
821 821
 				// if in admin then add to footer for compatibility.
822
-				is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle');
822
+				is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
823 823
 				$script = $this->inline_script();
824
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
825
-			}elseif($this->settings[$js_setting]=='popper'){
826
-				$url = $this->url.'assets/js/popper.min.js';
827
-				wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
828
-				wp_enqueue_script( 'bootstrap-js-popper' );
824
+				wp_add_inline_script('bootstrap-js-bundle', $script);
825
+			}elseif ($this->settings[$js_setting] == 'popper') {
826
+				$url = $this->url . 'assets/js/popper.min.js';
827
+				wp_register_script('bootstrap-js-popper', $url, array('jquery'), $this->latest);
828
+				wp_enqueue_script('bootstrap-js-popper');
829 829
 				$load_inline = true;
830
-			}else{
830
+			} else {
831 831
 				$load_inline = true;
832 832
 			}
833 833
 
834 834
 			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
835
-			if($load_inline){
836
-				wp_register_script( 'bootstrap-dummy', '',array('jquery') );
837
-				wp_enqueue_script( 'bootstrap-dummy' );
835
+			if ($load_inline) {
836
+				wp_register_script('bootstrap-dummy', '', array('jquery'));
837
+				wp_enqueue_script('bootstrap-dummy');
838 838
 				$script = $this->inline_script();
839
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
839
+				wp_add_inline_script('bootstrap-dummy', $script);
840 840
 			}
841 841
 
842 842
 		}
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 		/**
845 845
 		 * Enqueue flatpickr if called.
846 846
 		 */
847
-		public function enqueue_flatpickr(){
848
-			wp_enqueue_style( 'flatpickr' );
849
-			wp_enqueue_script( 'flatpickr' );
847
+		public function enqueue_flatpickr() {
848
+			wp_enqueue_style('flatpickr');
849
+			wp_enqueue_script('flatpickr');
850 850
 		}
851 851
 
852 852
 		/**
@@ -858,15 +858,15 @@  discard block
 block discarded – undo
858 858
 
859 859
 			$url = '';
860 860
 			// check if we are inside a plugin
861
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
861
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
862 862
 
863 863
 			// add check in-case user has changed wp-content dir name.
864 864
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
865
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
866
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
865
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
866
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
867 867
 
868
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
869
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
868
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
869
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
870 870
 			}
871 871
 
872 872
 			return $url;
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		 * Register the database settings with WordPress.
877 877
 		 */
878 878
 		public function register_settings() {
879
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
879
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
880 880
 		}
881 881
 
882 882
 		/**
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 		 */
886 886
 		public function menu_item() {
887 887
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
888
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
888
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
889 889
 				$this,
890 890
 				'settings_page'
891
-			) );
891
+			));
892 892
 		}
893 893
 
894 894
 		/**
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 		 *
897 897
 		 * @return array
898 898
 		 */
899
-		public function theme_js_settings(){
899
+		public function theme_js_settings() {
900 900
 			return array(
901 901
 				'ayetheme' => 'popper',
902 902
 				'listimia' => 'required',
@@ -912,17 +912,17 @@  discard block
 block discarded – undo
912 912
 		 */
913 913
 		public function get_settings() {
914 914
 
915
-			$db_settings = get_option( 'ayecode-ui-settings' );
915
+			$db_settings = get_option('ayecode-ui-settings');
916 916
 			$js_default = 'core-popper';
917 917
 			$js_default_backend = $js_default;
918 918
 
919 919
 			// maybe set defaults (if no settings set)
920
-			if(empty($db_settings)){
921
-				$active_theme = strtolower( get_template() ); // active parent theme.
920
+			if (empty($db_settings)) {
921
+				$active_theme = strtolower(get_template()); // active parent theme.
922 922
 				$theme_js_settings = self::theme_js_settings();
923
-				if(isset($theme_js_settings[$active_theme])){
923
+				if (isset($theme_js_settings[$active_theme])) {
924 924
 					$js_default = $theme_js_settings[$active_theme];
925
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
925
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
926 926
 				}
927 927
 			}
928 928
 
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 				'disable_admin'     =>  '', // URL snippets to disable loading on admin
936 936
 			);
937 937
 
938
-			$settings = wp_parse_args( $db_settings, $defaults );
938
+			$settings = wp_parse_args($db_settings, $defaults);
939 939
 
940 940
 			/**
941 941
 			 * Filter the Bootstrap settings.
942 942
 			 *
943 943
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
944 944
 			 */
945
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
945
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
946 946
 		}
947 947
 
948 948
 
@@ -950,90 +950,90 @@  discard block
 block discarded – undo
950 950
 		 * The settings page html output.
951 951
 		 */
952 952
 		public function settings_page() {
953
-			if ( ! current_user_can( 'manage_options' ) ) {
954
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
953
+			if (!current_user_can('manage_options')) {
954
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
955 955
 			}
956 956
 			?>
957 957
 			<div class="wrap">
958 958
 				<h1><?php echo $this->name; ?></h1>
959
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
959
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", "aui"); ?></p>
960 960
 				<form method="post" action="options.php">
961 961
 					<?php
962
-					settings_fields( 'ayecode-ui-settings' );
963
-					do_settings_sections( 'ayecode-ui-settings' );
962
+					settings_fields('ayecode-ui-settings');
963
+					do_settings_sections('ayecode-ui-settings');
964 964
 					?>
965 965
 
966
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
966
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
967 967
 					<table class="form-table wpbs-table-settings">
968 968
 						<tr valign="top">
969 969
 							<th scope="row"><label
970
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
970
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
971 971
 							<td>
972 972
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
973
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
974
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
975
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
973
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
974
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
975
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
976 976
 								</select>
977 977
 							</td>
978 978
 						</tr>
979 979
 
980 980
 						<tr valign="top">
981 981
 							<th scope="row"><label
982
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
982
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
983 983
 							<td>
984 984
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
985
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
986
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
987
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
988
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
985
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
986
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
987
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
988
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
989 989
 								</select>
990 990
 							</td>
991 991
 						</tr>
992 992
 
993 993
 						<tr valign="top">
994 994
 							<th scope="row"><label
995
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
995
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
996 996
 							<td>
997
-								<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" />
998
-								<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>
997
+								<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" />
998
+								<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>
999 999
 							</td>
1000 1000
 						</tr>
1001 1001
 
1002 1002
 					</table>
1003 1003
 
1004
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1004
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1005 1005
 					<table class="form-table wpbs-table-settings">
1006 1006
 						<tr valign="top">
1007 1007
 							<th scope="row"><label
1008
-									for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1008
+									for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1009 1009
 							<td>
1010 1010
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1011
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
1012
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1013
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1011
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
1012
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1013
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1014 1014
 								</select>
1015 1015
 							</td>
1016 1016
 						</tr>
1017 1017
 
1018 1018
 						<tr valign="top">
1019 1019
 							<th scope="row"><label
1020
-									for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1020
+									for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1021 1021
 							<td>
1022 1022
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1023
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1024
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1025
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1026
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1023
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1024
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1025
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1026
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1027 1027
 								</select>
1028 1028
 							</td>
1029 1029
 						</tr>
1030 1030
 
1031 1031
 						<tr valign="top">
1032 1032
 							<th scope="row"><label
1033
-									for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1033
+									for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1034 1034
 							<td>
1035
-								<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>
1036
-								<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>
1035
+								<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>
1036
+								<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>
1037 1037
 
1038 1038
 							</td>
1039 1039
 						</tr>
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 			<?php
1052 1052
 		}
1053 1053
 
1054
-		public function customizer_settings($wp_customize){
1054
+		public function customizer_settings($wp_customize) {
1055 1055
 			$wp_customize->add_section('aui_settings', array(
1056
-				'title'    => __('AyeCode UI','aui'),
1056
+				'title'    => __('AyeCode UI', 'aui'),
1057 1057
 				'priority' => 120,
1058 1058
 			));
1059 1059
 
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
 				'type'              => 'option',
1068 1068
 				'transport'         => 'refresh',
1069 1069
 			));
1070
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1071
-				'label'    => __('Primary Color','aui'),
1070
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1071
+				'label'    => __('Primary Color', 'aui'),
1072 1072
 				'section'  => 'aui_settings',
1073 1073
 				'settings' => 'aui_options[color_primary]',
1074 1074
 			)));
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 				'type'              => 'option',
1081 1081
 				'transport'         => 'refresh',
1082 1082
 			));
1083
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1084
-				'label'    => __('Secondary Color','aui'),
1083
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1084
+				'label'    => __('Secondary Color', 'aui'),
1085 1085
 				'section'  => 'aui_settings',
1086 1086
 				'settings' => 'aui_options[color_secondary]',
1087 1087
 			)));
@@ -1099,12 +1099,12 @@  discard block
 block discarded – undo
1099 1099
 			?>
1100 1100
 			<style>
1101 1101
 				<?php
1102
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1103
-						echo self::css_primary($primary_color,$compatibility);
1102
+					if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) {
1103
+						echo self::css_primary($primary_color, $compatibility);
1104 1104
 					}
1105 1105
 
1106
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1107
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1106
+					if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) {
1107
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
1108 1108
 					}
1109 1109
                 ?>
1110 1110
 			</style>
@@ -1114,50 +1114,50 @@  discard block
 block discarded – undo
1114 1114
 			/*
1115 1115
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1116 1116
 			 */
1117
-			return str_replace( array(
1117
+			return str_replace(array(
1118 1118
 				'<style>',
1119 1119
 				'</style>'
1120 1120
 			), '', ob_get_clean());
1121 1121
 		}
1122 1122
 
1123
-		public static function css_primary($color_code,$compatibility){;
1123
+		public static function css_primary($color_code, $compatibility) {;
1124 1124
 			$color_code = sanitize_hex_color($color_code);
1125
-			if(!$color_code){return '';}
1125
+			if (!$color_code) {return ''; }
1126 1126
 			/**
1127 1127
 			 * c = color, b = background color, o = border-color, f = fill
1128 1128
 			 */
1129 1129
 			$selectors = array(
1130 1130
 				'a' => array('c'),
1131
-				'.btn-primary' => array('b','o'),
1132
-				'.btn-primary.disabled' => array('b','o'),
1133
-				'.btn-primary:disabled' => array('b','o'),
1134
-				'.btn-outline-primary' => array('c','o'),
1135
-				'.btn-outline-primary:hover' => array('b','o'),
1136
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1137
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1138
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1131
+				'.btn-primary' => array('b', 'o'),
1132
+				'.btn-primary.disabled' => array('b', 'o'),
1133
+				'.btn-primary:disabled' => array('b', 'o'),
1134
+				'.btn-outline-primary' => array('c', 'o'),
1135
+				'.btn-outline-primary:hover' => array('b', 'o'),
1136
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1137
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1138
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1139 1139
 				'.btn-link' => array('c'),
1140 1140
 				'.dropdown-item.active' => array('b'),
1141
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1142
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1141
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1142
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1143 1143
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1144 1144
 //				'.custom-range::-moz-range-thumb' => array('b'),
1145 1145
 //				'.custom-range::-ms-thumb' => array('b'),
1146 1146
 				'.nav-pills .nav-link.active' => array('b'),
1147 1147
 				'.nav-pills .show>.nav-link' => array('b'),
1148 1148
 				'.page-link' => array('c'),
1149
-				'.page-item.active .page-link' => array('b','o'),
1149
+				'.page-item.active .page-link' => array('b', 'o'),
1150 1150
 				'.badge-primary' => array('b'),
1151
-				'.alert-primary' => array('b','o'),
1151
+				'.alert-primary' => array('b', 'o'),
1152 1152
 				'.progress-bar' => array('b'),
1153
-				'.list-group-item.active' => array('b','o'),
1154
-				'.bg-primary' => array('b','f'),
1153
+				'.list-group-item.active' => array('b', 'o'),
1154
+				'.bg-primary' => array('b', 'f'),
1155 1155
 				'.btn-link.btn-primary' => array('c'),
1156 1156
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1157 1157
 			);
1158 1158
 
1159 1159
 			$important_selectors = array(
1160
-				'.bg-primary' => array('b','f'),
1160
+				'.bg-primary' => array('b', 'f'),
1161 1161
 				'.border-primary' => array('o'),
1162 1162
 				'.text-primary' => array('c'),
1163 1163
 			);
@@ -1174,116 +1174,116 @@  discard block
 block discarded – undo
1174 1174
 			$output = '';
1175 1175
 
1176 1176
 			// build rules into each type
1177
-			foreach($selectors as $selector => $types){
1178
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1179
-				$types = array_combine($types,$types);
1180
-				if(isset($types['c'])){$color[] = $selector;}
1181
-				if(isset($types['b'])){$background[] = $selector;}
1182
-				if(isset($types['o'])){$border[] = $selector;}
1183
-				if(isset($types['f'])){$fill[] = $selector;}
1177
+			foreach ($selectors as $selector => $types) {
1178
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1179
+				$types = array_combine($types, $types);
1180
+				if (isset($types['c'])) {$color[] = $selector; }
1181
+				if (isset($types['b'])) {$background[] = $selector; }
1182
+				if (isset($types['o'])) {$border[] = $selector; }
1183
+				if (isset($types['f'])) {$fill[] = $selector; }
1184 1184
 			}
1185 1185
 
1186 1186
 			// build rules into each type
1187
-			foreach($important_selectors as $selector => $types){
1188
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1189
-				$types = array_combine($types,$types);
1190
-				if(isset($types['c'])){$color_i[] = $selector;}
1191
-				if(isset($types['b'])){$background_i[] = $selector;}
1192
-				if(isset($types['o'])){$border_i[] = $selector;}
1193
-				if(isset($types['f'])){$fill_i[] = $selector;}
1187
+			foreach ($important_selectors as $selector => $types) {
1188
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1189
+				$types = array_combine($types, $types);
1190
+				if (isset($types['c'])) {$color_i[] = $selector; }
1191
+				if (isset($types['b'])) {$background_i[] = $selector; }
1192
+				if (isset($types['o'])) {$border_i[] = $selector; }
1193
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1194 1194
 			}
1195 1195
 
1196 1196
 			// add any color rules
1197
-			if(!empty($color)){
1198
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1197
+			if (!empty($color)) {
1198
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1199 1199
 			}
1200
-			if(!empty($color_i)){
1201
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1200
+			if (!empty($color_i)) {
1201
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1202 1202
 			}
1203 1203
 
1204 1204
 			// add any background color rules
1205
-			if(!empty($background)){
1206
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1205
+			if (!empty($background)) {
1206
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1207 1207
 			}
1208
-			if(!empty($background_i)){
1209
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1208
+			if (!empty($background_i)) {
1209
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1210 1210
 			}
1211 1211
 
1212 1212
 			// add any border color rules
1213
-			if(!empty($border)){
1214
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1213
+			if (!empty($border)) {
1214
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1215 1215
 			}
1216
-			if(!empty($border_i)){
1217
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1216
+			if (!empty($border_i)) {
1217
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1218 1218
 			}
1219 1219
 
1220 1220
 			// add any fill color rules
1221
-			if(!empty($fill)){
1222
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1221
+			if (!empty($fill)) {
1222
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1223 1223
 			}
1224
-			if(!empty($fill_i)){
1225
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1224
+			if (!empty($fill_i)) {
1225
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1226 1226
 			}
1227 1227
 
1228 1228
 
1229 1229
 			$prefix = $compatibility ? ".bsui " : "";
1230 1230
 
1231 1231
 			// darken
1232
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1233
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1234
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1232
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1233
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1234
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1235 1235
 
1236 1236
 			// lighten
1237
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1237
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1238 1238
 
1239 1239
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1240
-			$op_25 = $color_code."40"; // 25% opacity
1240
+			$op_25 = $color_code . "40"; // 25% opacity
1241 1241
 
1242 1242
 
1243 1243
 			// button states
1244
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1245
-			$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;} ";
1246
-			$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.";} ";
1247
-			$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;} ";
1244
+			$output .= $prefix . " .btn-primary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1245
+			$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;} ";
1246
+			$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 . ";} ";
1247
+			$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;} ";
1248 1248
 
1249 1249
 
1250 1250
 			// dropdown's
1251
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1251
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1252 1252
 
1253 1253
 
1254 1254
 			// input states
1255
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1255
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1256 1256
 
1257 1257
 			// page link
1258
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1258
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1259 1259
 
1260 1260
 			return $output;
1261 1261
 		}
1262 1262
 
1263
-		public static function css_secondary($color_code,$compatibility){;
1263
+		public static function css_secondary($color_code, $compatibility) {;
1264 1264
 			$color_code = sanitize_hex_color($color_code);
1265
-			if(!$color_code){return '';}
1265
+			if (!$color_code) {return ''; }
1266 1266
 			/**
1267 1267
 			 * c = color, b = background color, o = border-color, f = fill
1268 1268
 			 */
1269 1269
 			$selectors = array(
1270
-				'.btn-secondary' => array('b','o'),
1271
-				'.btn-secondary.disabled' => array('b','o'),
1272
-				'.btn-secondary:disabled' => array('b','o'),
1273
-				'.btn-outline-secondary' => array('c','o'),
1274
-				'.btn-outline-secondary:hover' => array('b','o'),
1270
+				'.btn-secondary' => array('b', 'o'),
1271
+				'.btn-secondary.disabled' => array('b', 'o'),
1272
+				'.btn-secondary:disabled' => array('b', 'o'),
1273
+				'.btn-outline-secondary' => array('c', 'o'),
1274
+				'.btn-outline-secondary:hover' => array('b', 'o'),
1275 1275
 				'.btn-outline-secondary.disabled' => array('c'),
1276 1276
 				'.btn-outline-secondary:disabled' => array('c'),
1277
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1278
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1279
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1277
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1278
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1279
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
1280 1280
 				'.badge-secondary' => array('b'),
1281
-				'.alert-secondary' => array('b','o'),
1281
+				'.alert-secondary' => array('b', 'o'),
1282 1282
 				'.btn-link.btn-secondary' => array('c'),
1283 1283
 			);
1284 1284
 
1285 1285
 			$important_selectors = array(
1286
-				'.bg-secondary' => array('b','f'),
1286
+				'.bg-secondary' => array('b', 'f'),
1287 1287
 				'.border-secondary' => array('o'),
1288 1288
 				'.text-secondary' => array('c'),
1289 1289
 			);
@@ -1300,77 +1300,77 @@  discard block
 block discarded – undo
1300 1300
 			$output = '';
1301 1301
 
1302 1302
 			// build rules into each type
1303
-			foreach($selectors as $selector => $types){
1304
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1305
-				$types = array_combine($types,$types);
1306
-				if(isset($types['c'])){$color[] = $selector;}
1307
-				if(isset($types['b'])){$background[] = $selector;}
1308
-				if(isset($types['o'])){$border[] = $selector;}
1309
-				if(isset($types['f'])){$fill[] = $selector;}
1303
+			foreach ($selectors as $selector => $types) {
1304
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1305
+				$types = array_combine($types, $types);
1306
+				if (isset($types['c'])) {$color[] = $selector; }
1307
+				if (isset($types['b'])) {$background[] = $selector; }
1308
+				if (isset($types['o'])) {$border[] = $selector; }
1309
+				if (isset($types['f'])) {$fill[] = $selector; }
1310 1310
 			}
1311 1311
 
1312 1312
 			// build rules into each type
1313
-			foreach($important_selectors as $selector => $types){
1314
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1315
-				$types = array_combine($types,$types);
1316
-				if(isset($types['c'])){$color_i[] = $selector;}
1317
-				if(isset($types['b'])){$background_i[] = $selector;}
1318
-				if(isset($types['o'])){$border_i[] = $selector;}
1319
-				if(isset($types['f'])){$fill_i[] = $selector;}
1313
+			foreach ($important_selectors as $selector => $types) {
1314
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1315
+				$types = array_combine($types, $types);
1316
+				if (isset($types['c'])) {$color_i[] = $selector; }
1317
+				if (isset($types['b'])) {$background_i[] = $selector; }
1318
+				if (isset($types['o'])) {$border_i[] = $selector; }
1319
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1320 1320
 			}
1321 1321
 
1322 1322
 			// add any color rules
1323
-			if(!empty($color)){
1324
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1323
+			if (!empty($color)) {
1324
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1325 1325
 			}
1326
-			if(!empty($color_i)){
1327
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1326
+			if (!empty($color_i)) {
1327
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1328 1328
 			}
1329 1329
 
1330 1330
 			// add any background color rules
1331
-			if(!empty($background)){
1332
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1331
+			if (!empty($background)) {
1332
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1333 1333
 			}
1334
-			if(!empty($background_i)){
1335
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1334
+			if (!empty($background_i)) {
1335
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1336 1336
 			}
1337 1337
 
1338 1338
 			// add any border color rules
1339
-			if(!empty($border)){
1340
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1339
+			if (!empty($border)) {
1340
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1341 1341
 			}
1342
-			if(!empty($border_i)){
1343
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1342
+			if (!empty($border_i)) {
1343
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1344 1344
 			}
1345 1345
 
1346 1346
 			// add any fill color rules
1347
-			if(!empty($fill)){
1348
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1347
+			if (!empty($fill)) {
1348
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1349 1349
 			}
1350
-			if(!empty($fill_i)){
1351
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1350
+			if (!empty($fill_i)) {
1351
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1352 1352
 			}
1353 1353
 
1354 1354
 
1355 1355
 			$prefix = $compatibility ? ".bsui " : "";
1356 1356
 
1357 1357
 			// darken
1358
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1359
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1360
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1358
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1359
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1360
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1361 1361
 
1362 1362
 			// lighten
1363
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1363
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1364 1364
 
1365 1365
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1366
-			$op_25 = $color_code."40"; // 25% opacity
1366
+			$op_25 = $color_code . "40"; // 25% opacity
1367 1367
 
1368 1368
 
1369 1369
 			// button states
1370
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1371
-			$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;} ";
1372
-			$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.";} ";
1373
-			$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;} ";
1370
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1371
+			$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;} ";
1372
+			$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 . ";} ";
1373
+			$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;} ";
1374 1374
 
1375 1375
 
1376 1376
 			return $output;
@@ -1406,8 +1406,8 @@  discard block
 block discarded – undo
1406 1406
 		/**
1407 1407
 		 * Check if we should display examples.
1408 1408
 		 */
1409
-		public function maybe_show_examples(){
1410
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1409
+		public function maybe_show_examples() {
1410
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1411 1411
 				echo "<head>";
1412 1412
 				wp_head();
1413 1413
 				echo "</head>";
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 		 *
1424 1424
 		 * @return string
1425 1425
 		 */
1426
-		public function get_examples(){
1426
+		public function get_examples() {
1427 1427
 			$output = '';
1428 1428
 
1429 1429
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @return AUI|null
36 36
 	 */
37 37
 	public static function instance() {
38
-		if ( self::$instance == null ) {
38
+		if (self::$instance == null) {
39 39
 			self::$instance = new AUI();
40 40
 		}
41 41
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @since 1.0.0
49 49
 	 */
50 50
 	private function __construct() {
51
-		if ( function_exists( "__autoload" ) ) {
52
-			spl_autoload_register( "__autoload" );
51
+		if (function_exists("__autoload")) {
52
+			spl_autoload_register("__autoload");
53 53
 		}
54
-		spl_autoload_register( array( $this, 'autoload' ) );
54
+		spl_autoload_register(array($this, 'autoload'));
55 55
 
56 56
 		// load options
57 57
 		self::$options = get_option('aui_options');
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param $classname
66 66
 	 */
67
-	private function autoload( $classname ) {
68
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
69
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
-		if ( $file_path && is_readable( $file_path ) ) {
71
-			include_once( $file_path );
67
+	private function autoload($classname) {
68
+		$class     = str_replace('_', '-', strtolower($classname));
69
+		$file_path = trailingslashit(dirname(__FILE__)) . "components/class-" . $class . '.php';
70
+		if ($file_path && is_readable($file_path)) {
71
+			include_once($file_path);
72 72
 		}
73 73
 	}
74 74
 
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return string|void
81 81
 	 */
82
-	public function get_option( $option ){
82
+	public function get_option($option) {
83 83
 		$result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84 84
 
85
-		if ( ! $result && $option) {
86
-			if( $option == 'color_primary' ){
85
+		if (!$result && $option) {
86
+			if ($option == 'color_primary') {
87 87
 				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
88
+			}elseif ($option == 'color_secondary') {
89 89
 				$result = AUI_SECONDARY_COLOR;
90 90
 			}
91 91
 		}
92 92
 		return $result;
93 93
 	}
94 94
 
95
-	public function render( $items = array() ) {
95
+	public function render($items = array()) {
96 96
 		$output = '';
97 97
 
98
-		if ( ! empty( $items ) ) {
99
-			foreach ( $items as $args ) {
100
-				$render = isset( $args['render'] ) ? $args['render'] : '';
101
-				if ( $render && method_exists( __CLASS__, $render ) ) {
102
-					$output .= $this->$render( $args );
98
+		if (!empty($items)) {
99
+			foreach ($items as $args) {
100
+				$render = isset($args['render']) ? $args['render'] : '';
101
+				if ($render && method_exists(__CLASS__, $render)) {
102
+					$output .= $this->$render($args);
103 103
 				}
104 104
 			}
105 105
 		}
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return string The rendered component.
118 118
 	 */
119
-	public function alert( $args = array() ) {
120
-		return AUI_Component_Alert::get( $args );
119
+	public function alert($args = array()) {
120
+		return AUI_Component_Alert::get($args);
121 121
 	}
122 122
 
123 123
 	/**
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string The rendered component.
131 131
 	 */
132
-	public function input( $args = array() ) {
133
-		return AUI_Component_Input::input( $args );
132
+	public function input($args = array()) {
133
+		return AUI_Component_Input::input($args);
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string The rendered component.
144 144
 	 */
145
-	public function textarea( $args = array() ) {
146
-		return AUI_Component_Input::textarea( $args );
145
+	public function textarea($args = array()) {
146
+		return AUI_Component_Input::textarea($args);
147 147
 	}
148 148
 
149 149
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return string The rendered component.
157 157
 	 */
158
-	public function button( $args = array() ) {
159
-		return AUI_Component_Button::get( $args );
158
+	public function button($args = array()) {
159
+		return AUI_Component_Button::get($args);
160 160
 	}
161 161
 
162 162
 	/**
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string The rendered component.
170 170
 	 */
171
-	public function badge( $args = array() ) {
171
+	public function badge($args = array()) {
172 172
 		$defaults = array(
173 173
 			'class' => 'badge badge-primary align-middle',
174 174
 		);
175 175
 
176 176
 		// maybe set type
177
-		if ( empty( $args['href'] ) ) {
177
+		if (empty($args['href'])) {
178 178
 			$defaults['type'] = 'badge';
179 179
 		}
180 180
 
181 181
 		/**
182 182
 		 * Parse incoming $args into an array and merge it with $defaults
183 183
 		 */
184
-		$args = wp_parse_args( $args, $defaults );
184
+		$args = wp_parse_args($args, $defaults);
185 185
 
186
-		return AUI_Component_Button::get( $args );
186
+		return AUI_Component_Button::get($args);
187 187
 	}
188 188
 
189 189
 	/**
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return string The rendered component.
197 197
 	 */
198
-	public function dropdown( $args = array() ) {
199
-		return AUI_Component_Dropdown::get( $args );
198
+	public function dropdown($args = array()) {
199
+		return AUI_Component_Dropdown::get($args);
200 200
 	}
201 201
 
202 202
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return string The rendered component.
210 210
 	 */
211
-	public function select( $args = array() ) {
212
-		return AUI_Component_Input::select( $args );
211
+	public function select($args = array()) {
212
+		return AUI_Component_Input::select($args);
213 213
 	}
214 214
 
215 215
 	/**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return string The rendered component.
223 223
 	 */
224
-	public function radio( $args = array() ) {
225
-		return AUI_Component_Input::radio( $args );
224
+	public function radio($args = array()) {
225
+		return AUI_Component_Input::radio($args);
226 226
 	}
227 227
 
228 228
 	/**
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @return string The rendered component.
236 236
 	 */
237
-	public function pagination( $args = array() ) {
238
-		return AUI_Component_Pagination::get( $args );
237
+	public function pagination($args = array()) {
238
+		return AUI_Component_Pagination::get($args);
239 239
 	}
240 240
 
241 241
 }
242 242
\ No newline at end of file
Please login to merge, or discard this patch.