Passed
Pull Request — master (#861)
by Kiran
06:26 queued 01:06
created
includes/data/email-settings.php 1 patch
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 // Prepare the due date reminder options.
14 14
 $overdue_days_options       = array();
15
-$overdue_days_options['0']  = __( 'On the Due Date', 'invoicing' );
16
-$overdue_days_options['1']  = __( '1 day after Due Date', 'invoicing' );
15
+$overdue_days_options['0']  = __('On the Due Date', 'invoicing');
16
+$overdue_days_options['1']  = __('1 day after Due Date', 'invoicing');
17 17
 
18
-for ( $i = 2; $i <= 45; $i++ ) {
19
-    $overdue_days_options[ "$i" ] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i );
18
+for ($i = 2; $i <= 45; $i++) {
19
+    $overdue_days_options["$i"] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i);
20 20
 }
21 21
 
22 22
 // Prepare up coming renewal reminder options.
23 23
 $renewal_days_options       = array();
24
-$renewal_days_options['0']  = __( 'On the renewal date', 'invoicing' );
25
-$renewal_days_options['1']  = __( '1 day before the renewal date', 'invoicing' );
24
+$renewal_days_options['0']  = __('On the renewal date', 'invoicing');
25
+$renewal_days_options['1']  = __('1 day before the renewal date', 'invoicing');
26 26
 
27
-for ( $i = 2; $i <= 45; $i++ ) {
28
-    $renewal_days_options[ "$i" ]   = wp_sprintf( __( '%d days before the renewal date', 'invoicing' ), $i );
27
+for ($i = 2; $i <= 45; $i++) {
28
+    $renewal_days_options["$i"] = wp_sprintf(__('%d days before the renewal date', 'invoicing'), $i);
29 29
 }
30 30
 
31 31
 // Default, built-in gateways
@@ -34,45 +34,45 @@  discard block
 block discarded – undo
34 34
 
35 35
         'email_new_invoice_header'  => array(
36 36
             'id'   => 'email_new_invoice_header',
37
-            'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>',
38
-            'desc' => __( 'These emails are sent to the site admin whenever there is a new invoice.', 'invoicing' ),
37
+            'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>',
38
+            'desc' => __('These emails are sent to the site admin whenever there is a new invoice.', 'invoicing'),
39 39
             'type' => 'header',
40 40
         ),
41 41
 
42 42
         'email_new_invoice_active'  => array(
43 43
             'id'   => 'email_new_invoice_active',
44
-            'name' => __( 'Enable/Disable', 'invoicing' ),
45
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
44
+            'name' => __('Enable/Disable', 'invoicing'),
45
+            'desc' => __('Enable this email notification', 'invoicing'),
46 46
             'type' => 'checkbox',
47 47
             'std'  => 1,
48 48
         ),
49 49
 
50 50
         'email_new_invoice_subject' => array(
51 51
             'id'       => 'email_new_invoice_subject',
52
-            'name'     => __( 'Subject', 'invoicing' ),
53
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
52
+            'name'     => __('Subject', 'invoicing'),
53
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
54 54
             'help-tip' => true,
55 55
             'type'     => 'text',
56
-            'std'      => __( '[{site_title}] New invoice ({invoice_number}) for {invoice_total} {invoice_currency}', 'invoicing' ),
56
+            'std'      => __('[{site_title}] New invoice ({invoice_number}) for {invoice_total} {invoice_currency}', 'invoicing'),
57 57
             'size'     => 'large',
58 58
         ),
59 59
 
60 60
         'email_new_invoice_heading' => array(
61 61
             'id'       => 'email_new_invoice_heading',
62
-            'name'     => __( 'Email Heading', 'invoicing' ),
63
-            'desc'     => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
62
+            'name'     => __('Email Heading', 'invoicing'),
63
+            'desc'     => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
64 64
             'help-tip' => true,
65 65
             'type'     => 'text',
66
-            'std'      => __( 'New invoice', 'invoicing' ),
66
+            'std'      => __('New invoice', 'invoicing'),
67 67
             'size'     => 'large',
68 68
         ),
69 69
 
70 70
         'email_new_invoice_body'    => array(
71 71
             'id'    => 'email_new_invoice_body',
72
-            'name'  => __( 'Email Content', 'invoicing' ),
72
+            'name'  => __('Email Content', 'invoicing'),
73 73
             'desc'  => wpinv_get_merge_tags_help_text(),
74 74
             'type'  => 'rich_editor',
75
-            'std'   => __( '<p>A new invoice <a href="{invoice_link}">({invoice_number})</a> to {name} for {invoice_total} {invoice_currency} has been created on your site. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
75
+            'std'   => __('<p>A new invoice <a href="{invoice_link}">({invoice_number})</a> to {name} for {invoice_total} {invoice_currency} has been created on your site. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
76 76
             'class' => 'large',
77 77
             'size'  => '10',
78 78
         ),
@@ -82,53 +82,53 @@  discard block
 block discarded – undo
82 82
 
83 83
         'email_cancelled_invoice_header'    => array(
84 84
             'id'   => 'email_cancelled_invoice_header',
85
-            'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>',
86
-            'desc' => __( 'These emails are sent to customers whenever invoices are cancelled.', 'invoicing' ),
85
+            'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>',
86
+            'desc' => __('These emails are sent to customers whenever invoices are cancelled.', 'invoicing'),
87 87
             'type' => 'header',
88 88
         ),
89 89
 
90 90
         'email_cancelled_invoice_active'    => array(
91 91
             'id'   => 'email_cancelled_invoice_active',
92
-            'name' => __( 'Enable/Disable', 'invoicing' ),
93
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
92
+            'name' => __('Enable/Disable', 'invoicing'),
93
+            'desc' => __('Enable this email notification', 'invoicing'),
94 94
             'type' => 'checkbox',
95 95
             'std'  => 1,
96 96
         ),
97 97
 
98 98
         'email_cancelled_invoice_admin_bcc' => array(
99 99
             'id'   => 'email_cancelled_invoice_admin_bcc',
100
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
101
-            'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
100
+            'name' => __('Enable Admin BCC', 'invoicing'),
101
+            'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
102 102
             'type' => 'checkbox',
103 103
             'std'  => 1,
104 104
         ),
105 105
 
106 106
         'email_cancelled_invoice_subject'   => array(
107 107
             'id'       => 'email_cancelled_invoice_subject',
108
-            'name'     => __( 'Subject', 'invoicing' ),
109
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
108
+            'name'     => __('Subject', 'invoicing'),
109
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
110 110
             'help-tip' => true,
111 111
             'type'     => 'text',
112
-            'std'      => __( '[{site_title}] Invoice ({invoice_number}) Cancelled', 'invoicing' ),
112
+            'std'      => __('[{site_title}] Invoice ({invoice_number}) Cancelled', 'invoicing'),
113 113
             'size'     => 'large',
114 114
         ),
115 115
 
116 116
         'email_cancelled_invoice_heading'   => array(
117 117
             'id'       => 'email_cancelled_invoice_heading',
118
-            'name'     => __( 'Email Heading', 'invoicing' ),
119
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
118
+            'name'     => __('Email Heading', 'invoicing'),
119
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
120 120
             'help-tip' => true,
121 121
             'type'     => 'text',
122
-            'std'      => __( 'Invoice Cancelled', 'invoicing' ),
122
+            'std'      => __('Invoice Cancelled', 'invoicing'),
123 123
             'size'     => 'large',
124 124
         ),
125 125
 
126 126
         'email_cancelled_invoice_body'      => array(
127 127
             'id'    => 'email_cancelled_invoice_body',
128
-            'name'  => __( 'Email Content', 'invoicing' ),
128
+            'name'  => __('Email Content', 'invoicing'),
129 129
             'desc'  => wpinv_get_merge_tags_help_text(),
130 130
             'type'  => 'rich_editor',
131
-            'std'   => __( '<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
131
+            'std'   => __('<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
132 132
             'class' => 'large',
133 133
             'size'  => '10',
134 134
         ),
@@ -139,45 +139,45 @@  discard block
 block discarded – undo
139 139
 
140 140
         'email_failed_invoice_header'  => array(
141 141
             'id'   => 'email_failed_invoice_header',
142
-            'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>',
143
-            'desc' => __( 'Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing' ),
142
+            'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>',
143
+            'desc' => __('Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing'),
144 144
             'type' => 'header',
145 145
         ),
146 146
 
147 147
         'email_failed_invoice_active'  => array(
148 148
             'id'   => 'email_failed_invoice_active',
149
-            'name' => __( 'Enable/Disable', 'invoicing' ),
150
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
149
+            'name' => __('Enable/Disable', 'invoicing'),
150
+            'desc' => __('Enable this email notification', 'invoicing'),
151 151
             'type' => 'checkbox',
152 152
             'std'  => 1,
153 153
         ),
154 154
 
155 155
         'email_failed_invoice_subject' => array(
156 156
             'id'       => 'email_failed_invoice_subject',
157
-            'name'     => __( 'Subject', 'invoicing' ),
158
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
157
+            'name'     => __('Subject', 'invoicing'),
158
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
159 159
             'help-tip' => true,
160 160
             'type'     => 'text',
161
-            'std'      => __( '[{site_title}] Invoice ({invoice_number}) Payment Failed', 'invoicing' ),
161
+            'std'      => __('[{site_title}] Invoice ({invoice_number}) Payment Failed', 'invoicing'),
162 162
             'size'     => 'large',
163 163
         ),
164 164
 
165 165
         'email_failed_invoice_heading' => array(
166 166
             'id'       => 'email_failed_invoice_heading',
167
-            'name'     => __( 'Email Heading', 'invoicing' ),
168
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
167
+            'name'     => __('Email Heading', 'invoicing'),
168
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
169 169
             'help-tip' => true,
170 170
             'type'     => 'text',
171
-            'std'      => __( 'Invoice Payment Failed', 'invoicing' ),
171
+            'std'      => __('Invoice Payment Failed', 'invoicing'),
172 172
             'size'     => 'large',
173 173
         ),
174 174
 
175 175
         'email_failed_invoice_body'    => array(
176 176
             'id'    => 'email_failed_invoice_body',
177
-            'name'  => __( 'Email Content', 'invoicing' ),
177
+            'name'  => __('Email Content', 'invoicing'),
178 178
             'desc'  => wpinv_get_merge_tags_help_text(),
179 179
             'type'  => 'rich_editor',
180
-            'std'   => __( '<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
180
+            'std'   => __('<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
181 181
             'class' => 'large',
182 182
             'size'  => '10',
183 183
         ),
@@ -187,53 +187,53 @@  discard block
 block discarded – undo
187 187
 
188 188
         'email_onhold_invoice_header'    => array(
189 189
             'id'   => 'email_onhold_invoice_header',
190
-            'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>',
191
-            'desc' => __( 'These emails are sent to customers whenever their invoices are held.', 'invoicing' ),
190
+            'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>',
191
+            'desc' => __('These emails are sent to customers whenever their invoices are held.', 'invoicing'),
192 192
             'type' => 'header',
193 193
         ),
194 194
 
195 195
         'email_onhold_invoice_active'    => array(
196 196
             'id'   => 'email_onhold_invoice_active',
197
-            'name' => __( 'Enable/Disable', 'invoicing' ),
198
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
197
+            'name' => __('Enable/Disable', 'invoicing'),
198
+            'desc' => __('Enable this email notification', 'invoicing'),
199 199
             'type' => 'checkbox',
200 200
             'std'  => 1,
201 201
         ),
202 202
 
203 203
         'email_onhold_invoice_admin_bcc' => array(
204 204
             'id'   => 'email_onhold_invoice_admin_bcc',
205
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
206
-            'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
205
+            'name' => __('Enable Admin BCC', 'invoicing'),
206
+            'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
207 207
             'type' => 'checkbox',
208 208
             'std'  => 1,
209 209
         ),
210 210
 
211 211
         'email_onhold_invoice_subject'   => array(
212 212
             'id'       => 'email_onhold_invoice_subject',
213
-            'name'     => __( 'Subject', 'invoicing' ),
214
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
213
+            'name'     => __('Subject', 'invoicing'),
214
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
215 215
             'help-tip' => true,
216 216
             'type'     => 'text',
217
-            'std'      => __( '[{site_title}] Your invoice is on hold', 'invoicing' ),
217
+            'std'      => __('[{site_title}] Your invoice is on hold', 'invoicing'),
218 218
             'size'     => 'large',
219 219
         ),
220 220
 
221 221
         'email_onhold_invoice_heading'   => array(
222 222
             'id'       => 'email_onhold_invoice_heading',
223
-            'name'     => __( 'Email Heading', 'invoicing' ),
224
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
223
+            'name'     => __('Email Heading', 'invoicing'),
224
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
225 225
             'help-tip' => true,
226 226
             'type'     => 'text',
227
-            'std'      => __( 'Your invoice is on hold', 'invoicing' ),
227
+            'std'      => __('Your invoice is on hold', 'invoicing'),
228 228
             'size'     => 'large',
229 229
         ),
230 230
 
231 231
         'email_onhold_invoice_body'      => array(
232 232
             'id'    => 'email_onhold_invoice_body',
233
-            'name'  => __( 'Email Content', 'invoicing' ),
233
+            'name'  => __('Email Content', 'invoicing'),
234 234
             'desc'  => wpinv_get_merge_tags_help_text(),
235 235
             'type'  => 'rich_editor',
236
-            'std'   => __( '<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
236
+            'std'   => __('<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
237 237
             'class' => 'large',
238 238
             'size'  => '10',
239 239
         ),
@@ -244,53 +244,53 @@  discard block
 block discarded – undo
244 244
 
245 245
         'email_processing_invoice_header'    => array(
246 246
             'id'   => 'email_processing_invoice_header',
247
-            'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>',
248
-            'desc' => __( 'These emails are sent to users whenever payments for their invoices are processing.', 'invoicing' ),
247
+            'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>',
248
+            'desc' => __('These emails are sent to users whenever payments for their invoices are processing.', 'invoicing'),
249 249
             'type' => 'header',
250 250
         ),
251 251
 
252 252
         'email_processing_invoice_active'    => array(
253 253
             'id'   => 'email_processing_invoice_active',
254
-            'name' => __( 'Enable/Disable', 'invoicing' ),
255
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
254
+            'name' => __('Enable/Disable', 'invoicing'),
255
+            'desc' => __('Enable this email notification', 'invoicing'),
256 256
             'type' => 'checkbox',
257 257
             'std'  => 1,
258 258
         ),
259 259
 
260 260
         'email_processing_invoice_admin_bcc' => array(
261 261
             'id'   => 'email_processing_invoice_admin_bcc',
262
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
263
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
262
+            'name' => __('Enable Admin BCC', 'invoicing'),
263
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
264 264
             'type' => 'checkbox',
265 265
             'std'  => 1,
266 266
         ),
267 267
 
268 268
         'email_processing_invoice_subject'   => array(
269 269
             'id'       => 'email_processing_invoice_subject',
270
-            'name'     => __( 'Subject', 'invoicing' ),
271
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
270
+            'name'     => __('Subject', 'invoicing'),
271
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
272 272
             'help-tip' => true,
273 273
             'type'     => 'text',
274
-            'std'      => __( '[{site_title}] Your payment is being processed', 'invoicing' ),
274
+            'std'      => __('[{site_title}] Your payment is being processed', 'invoicing'),
275 275
             'size'     => 'large',
276 276
         ),
277 277
 
278 278
         'email_processing_invoice_heading'   => array(
279 279
             'id'       => 'email_processing_invoice_heading',
280
-            'name'     => __( 'Email Heading', 'invoicing' ),
281
-            'desc'     => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
280
+            'name'     => __('Email Heading', 'invoicing'),
281
+            'desc'     => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
282 282
             'help-tip' => true,
283 283
             'type'     => 'text',
284
-            'std'      => __( 'Your payment is being processed', 'invoicing' ),
284
+            'std'      => __('Your payment is being processed', 'invoicing'),
285 285
             'size'     => 'large',
286 286
         ),
287 287
 
288 288
         'email_processing_invoice_body'      => array(
289 289
             'id'    => 'email_processing_invoice_body',
290
-            'name'  => __( 'Email Content', 'invoicing' ),
290
+            'name'  => __('Email Content', 'invoicing'),
291 291
             'desc'  => wpinv_get_merge_tags_help_text(),
292 292
             'type'  => 'rich_editor',
293
-            'std'   => __( '<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
293
+            'std'   => __('<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
294 294
             'class' => 'large',
295 295
             'size'  => '10',
296 296
         ),
@@ -301,61 +301,61 @@  discard block
 block discarded – undo
301 301
 
302 302
         'email_completed_invoice_header'         => array(
303 303
             'id'   => 'email_completed_invoice_header',
304
-            'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>',
305
-            'desc' => __( 'These emails are sent to customers when their invoices are marked as paid.', 'invoicing' ),
304
+            'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>',
305
+            'desc' => __('These emails are sent to customers when their invoices are marked as paid.', 'invoicing'),
306 306
             'type' => 'header',
307 307
         ),
308 308
 
309 309
         'email_completed_invoice_active'         => array(
310 310
             'id'   => 'email_completed_invoice_active',
311
-            'name' => __( 'Enable/Disable', 'invoicing' ),
312
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
311
+            'name' => __('Enable/Disable', 'invoicing'),
312
+            'desc' => __('Enable this email notification', 'invoicing'),
313 313
             'type' => 'checkbox',
314 314
             'std'  => 1,
315 315
         ),
316 316
 
317 317
         'email_completed_invoice_renewal_active' => array(
318 318
             'id'   => 'email_completed_invoice_renewal_active',
319
-            'name' => __( 'Enable renewal notification', 'invoicing' ),
320
-            'desc' => __( 'Should this email be sent for renewals too?', 'invoicing' ),
319
+            'name' => __('Enable renewal notification', 'invoicing'),
320
+            'desc' => __('Should this email be sent for renewals too?', 'invoicing'),
321 321
             'type' => 'checkbox',
322 322
             'std'  => 1,
323 323
         ),
324 324
 
325 325
         'email_completed_invoice_admin_bcc'      => array(
326 326
             'id'   => 'email_completed_invoice_admin_bcc',
327
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
328
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
327
+            'name' => __('Enable Admin BCC', 'invoicing'),
328
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
329 329
             'type' => 'checkbox',
330 330
             'std'  => 1,
331 331
         ),
332 332
 
333 333
         'email_completed_invoice_subject'        => array(
334 334
             'id'       => 'email_completed_invoice_subject',
335
-            'name'     => __( 'Subject', 'invoicing' ),
336
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
335
+            'name'     => __('Subject', 'invoicing'),
336
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
337 337
             'help-tip' => true,
338 338
             'type'     => 'text',
339
-            'std'      => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ),
339
+            'std'      => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'),
340 340
             'size'     => 'large',
341 341
         ),
342 342
 
343 343
         'email_completed_invoice_heading'        => array(
344 344
             'id'       => 'email_completed_invoice_heading',
345
-            'name'     => __( 'Email Heading', 'invoicing' ),
346
-            'desc'     => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
345
+            'name'     => __('Email Heading', 'invoicing'),
346
+            'desc'     => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
347 347
             'help-tip' => true,
348 348
             'type'     => 'text',
349
-            'std'      => __( 'Your invoice has been paid', 'invoicing' ),
349
+            'std'      => __('Your invoice has been paid', 'invoicing'),
350 350
             'size'     => 'large',
351 351
         ),
352 352
 
353 353
         'email_completed_invoice_body'           => array(
354 354
             'id'    => 'email_completed_invoice_body',
355
-            'name'  => __( 'Email Content', 'invoicing' ),
355
+            'name'  => __('Email Content', 'invoicing'),
356 356
             'desc'  => wpinv_get_merge_tags_help_text(),
357 357
             'type'  => 'rich_editor',
358
-            'std'   => __( '<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
358
+            'std'   => __('<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
359 359
             'class' => 'large',
360 360
             'size'  => '10',
361 361
         ),
@@ -366,53 +366,53 @@  discard block
 block discarded – undo
366 366
 
367 367
         'email_refunded_invoice_header'    => array(
368 368
             'id'   => 'email_refunded_invoice_header',
369
-            'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>',
370
-            'desc' => __( 'These emails are sent to users when their invoices are marked as refunded.', 'invoicing' ),
369
+            'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>',
370
+            'desc' => __('These emails are sent to users when their invoices are marked as refunded.', 'invoicing'),
371 371
             'type' => 'header',
372 372
         ),
373 373
 
374 374
         'email_refunded_invoice_active'    => array(
375 375
             'id'   => 'email_refunded_invoice_active',
376
-            'name' => __( 'Enable/Disable', 'invoicing' ),
377
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
376
+            'name' => __('Enable/Disable', 'invoicing'),
377
+            'desc' => __('Enable this email notification', 'invoicing'),
378 378
             'type' => 'checkbox',
379 379
             'std'  => 1,
380 380
         ),
381 381
 
382 382
         'email_refunded_invoice_admin_bcc' => array(
383 383
             'id'   => 'email_refunded_invoice_admin_bcc',
384
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
385
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
384
+            'name' => __('Enable Admin BCC', 'invoicing'),
385
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
386 386
             'type' => 'checkbox',
387 387
             'std'  => 1,
388 388
         ),
389 389
 
390 390
         'email_refunded_invoice_subject'   => array(
391 391
             'id'       => 'email_refunded_invoice_subject',
392
-            'name'     => __( 'Subject', 'invoicing' ),
393
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
392
+            'name'     => __('Subject', 'invoicing'),
393
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
394 394
             'help-tip' => true,
395 395
             'type'     => 'text',
396
-            'std'      => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ),
396
+            'std'      => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'),
397 397
             'size'     => 'large',
398 398
         ),
399 399
 
400 400
         'email_refunded_invoice_heading'   => array(
401 401
             'id'       => 'email_refunded_invoice_heading',
402
-            'name'     => __( 'Email Heading', 'invoicing' ),
403
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
402
+            'name'     => __('Email Heading', 'invoicing'),
403
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
404 404
             'help-tip' => true,
405 405
             'type'     => 'text',
406
-            'std'      => __( 'Your invoice has been refunded', 'invoicing' ),
406
+            'std'      => __('Your invoice has been refunded', 'invoicing'),
407 407
             'size'     => 'large',
408 408
         ),
409 409
 
410 410
         'email_refunded_invoice_body'      => array(
411 411
             'id'    => 'email_refunded_invoice_body',
412
-            'name'  => __( 'Email Content', 'invoicing' ),
412
+            'name'  => __('Email Content', 'invoicing'),
413 413
             'desc'  => wpinv_get_merge_tags_help_text(),
414 414
             'type'  => 'rich_editor',
415
-            'std'   => __( '<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing' ),
415
+            'std'   => __('<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded. <a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a></p>', 'invoicing'),
416 416
             'class' => 'large',
417 417
             'size'  => '10',
418 418
         ),
@@ -423,53 +423,53 @@  discard block
 block discarded – undo
423 423
 
424 424
         'email_user_invoice_header'    => array(
425 425
             'id'   => 'email_user_invoice_header',
426
-            'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>',
427
-            'desc' => __( 'These emails are sent to customers containing their invoice information and payment links.', 'invoicing' ),
426
+            'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>',
427
+            'desc' => __('These emails are sent to customers containing their invoice information and payment links.', 'invoicing'),
428 428
             'type' => 'header',
429 429
         ),
430 430
 
431 431
         'email_user_invoice_active'    => array(
432 432
             'id'   => 'email_user_invoice_active',
433
-            'name' => __( 'Enable/Disable', 'invoicing' ),
434
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
433
+            'name' => __('Enable/Disable', 'invoicing'),
434
+            'desc' => __('Enable this email notification', 'invoicing'),
435 435
             'type' => 'checkbox',
436 436
             'std'  => 1,
437 437
         ),
438 438
 
439 439
         'email_user_invoice_admin_bcc' => array(
440 440
             'id'   => 'email_user_invoice_admin_bcc',
441
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
442
-            'desc' => __( 'Check if you want to send a copy of this notification email to to the site admin.', 'invoicing' ),
441
+            'name' => __('Enable Admin BCC', 'invoicing'),
442
+            'desc' => __('Check if you want to send a copy of this notification email to to the site admin.', 'invoicing'),
443 443
             'type' => 'checkbox',
444 444
             'std'  => 0,
445 445
         ),
446 446
 
447 447
         'email_user_invoice_subject'   => array(
448 448
             'id'       => 'email_user_invoice_subject',
449
-            'name'     => __( 'Subject', 'invoicing' ),
450
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
449
+            'name'     => __('Subject', 'invoicing'),
450
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
451 451
             'help-tip' => true,
452 452
             'type'     => 'text',
453
-            'std'      => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ),
453
+            'std'      => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'),
454 454
             'size'     => 'large',
455 455
         ),
456 456
 
457 457
         'email_user_invoice_heading'   => array(
458 458
             'id'       => 'email_user_invoice_heading',
459
-            'name'     => __( 'Email Heading', 'invoicing' ),
460
-            'desc'     => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
459
+            'name'     => __('Email Heading', 'invoicing'),
460
+            'desc'     => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
461 461
             'help-tip' => true,
462 462
             'type'     => 'text',
463
-            'std'      => __( 'Your invoice {invoice_number} details', 'invoicing' ),
463
+            'std'      => __('Your invoice {invoice_number} details', 'invoicing'),
464 464
             'size'     => 'large',
465 465
         ),
466 466
 
467 467
         'email_user_invoice_body'      => array(
468 468
             'id'    => 'email_user_invoice_body',
469
-            'name'  => __( 'Email Content', 'invoicing' ),
469
+            'name'  => __('Email Content', 'invoicing'),
470 470
             'desc'  => wpinv_get_merge_tags_help_text(),
471 471
             'type'  => 'rich_editor',
472
-            'std'   => __( '<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing' ),
472
+            'std'   => __('<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing'),
473 473
             'class' => 'large',
474 474
             'size'  => '10',
475 475
         ),
@@ -479,53 +479,53 @@  discard block
 block discarded – undo
479 479
 
480 480
         'email_user_note_header'    => array(
481 481
             'id'   => 'email_user_note_header',
482
-            'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>',
483
-            'desc' => __( 'These emails are sent when you add a customer note to an invoice/quote.', 'invoicing' ),
482
+            'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>',
483
+            'desc' => __('These emails are sent when you add a customer note to an invoice/quote.', 'invoicing'),
484 484
             'type' => 'header',
485 485
         ),
486 486
 
487 487
         'email_user_note_active'    => array(
488 488
             'id'   => 'email_user_note_active',
489
-            'name' => __( 'Enable/Disable', 'invoicing' ),
490
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
489
+            'name' => __('Enable/Disable', 'invoicing'),
490
+            'desc' => __('Enable this email notification', 'invoicing'),
491 491
             'type' => 'checkbox',
492 492
             'std'  => 1,
493 493
         ),
494 494
 
495 495
         'email_user_note_admin_bcc' => array(
496 496
             'id'   => 'email_user_note_admin_bcc',
497
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
498
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
497
+            'name' => __('Enable Admin BCC', 'invoicing'),
498
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
499 499
             'type' => 'checkbox',
500 500
             'std'  => 0,
501 501
         ),
502 502
 
503 503
         'email_user_note_subject'   => array(
504 504
             'id'       => 'email_user_note_subject',
505
-            'name'     => __( 'Subject', 'invoicing' ),
506
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
505
+            'name'     => __('Subject', 'invoicing'),
506
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
507 507
             'help-tip' => true,
508 508
             'type'     => 'text',
509
-            'std'      => __( '[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing' ),
509
+            'std'      => __('[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing'),
510 510
             'size'     => 'large',
511 511
         ),
512 512
 
513 513
         'email_user_note_heading'   => array(
514 514
             'id'       => 'email_user_note_heading',
515
-            'name'     => __( 'Email Heading', 'invoicing' ),
516
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
515
+            'name'     => __('Email Heading', 'invoicing'),
516
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
517 517
             'help-tip' => true,
518 518
             'type'     => 'text',
519
-            'std'      => __( 'A note has been added to your {invoice_label}', 'invoicing' ),
519
+            'std'      => __('A note has been added to your {invoice_label}', 'invoicing'),
520 520
             'size'     => 'large',
521 521
         ),
522 522
 
523 523
         'email_user_note_body'      => array(
524 524
             'id'    => 'email_user_note_body',
525
-            'name'  => __( 'Email Content', 'invoicing' ),
525
+            'name'  => __('Email Content', 'invoicing'),
526 526
             'desc'  => wpinv_get_merge_tags_help_text(),
527 527
             'type'  => 'rich_editor',
528
-            'std'   => __( '<p>Hi {name},</p><p>The following note has been added to your {invoice_label} <a href="{invoice_link}">#{invoice_number}</a>:</p><blockquote class="wpinv-note">{customer_note}</blockquote><a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a>', 'invoicing' ),
528
+            'std'   => __('<p>Hi {name},</p><p>The following note has been added to your {invoice_label} <a href="{invoice_link}">#{invoice_number}</a>:</p><blockquote class="wpinv-note">{customer_note}</blockquote><a class="btn btn-success" href="{invoice_link}">View / Print Invoice</a>', 'invoicing'),
529 529
             'class' => 'large',
530 530
             'size'  => '10',
531 531
         ),
@@ -535,63 +535,63 @@  discard block
 block discarded – undo
535 535
 
536 536
         'email_overdue_header'    => array(
537 537
             'id'   => 'email_overdue_header',
538
-            'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>',
539
-            'desc' => __( 'Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing' ),
538
+            'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>',
539
+            'desc' => __('Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing'),
540 540
             'type' => 'header',
541 541
         ),
542 542
 
543 543
         'email_overdue_active'    => array(
544 544
             'id'   => 'email_overdue_active',
545
-            'name' => __( 'Enable/Disable', 'invoicing' ),
546
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
545
+            'name' => __('Enable/Disable', 'invoicing'),
546
+            'desc' => __('Enable this email notification', 'invoicing'),
547 547
             'type' => 'checkbox',
548 548
             'std'  => 1,
549 549
         ),
550 550
 
551 551
         'email_overdue_admin_bcc' => array(
552 552
             'id'   => 'email_overdue_admin_bcc',
553
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
554
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
553
+            'name' => __('Enable Admin BCC', 'invoicing'),
554
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
555 555
             'type' => 'checkbox',
556 556
             'std'  => 0,
557 557
         ),
558 558
 
559 559
         'email_overdue_days'      => array(
560 560
             'id'       => 'email_overdue_days',
561
-            'name'     => __( 'When to Send', 'invoicing' ),
562
-            'desc'     => __( 'Check when you would like payment reminders sent out.', 'invoicing' ),
561
+            'name'     => __('When to Send', 'invoicing'),
562
+            'desc'     => __('Check when you would like payment reminders sent out.', 'invoicing'),
563 563
             'help-tip' => true,
564
-            'std'      => array( '1' ),
564
+            'std'      => array('1'),
565 565
             'type'     => 'multicheck',
566 566
             'options'  => $overdue_days_options,
567 567
         ),
568 568
 
569 569
         'email_overdue_subject'   => array(
570 570
             'id'       => 'email_overdue_subject',
571
-            'name'     => __( 'Subject', 'invoicing' ),
572
-            'desc'     => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
571
+            'name'     => __('Subject', 'invoicing'),
572
+            'desc'     => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
573 573
             'help-tip' => true,
574 574
             'type'     => 'text',
575
-            'std'      => __( '[{site_title}] Payment Reminder', 'invoicing' ),
575
+            'std'      => __('[{site_title}] Payment Reminder', 'invoicing'),
576 576
             'size'     => 'large',
577 577
         ),
578 578
 
579 579
         'email_overdue_heading'   => array(
580 580
             'id'       => 'email_overdue_heading',
581
-            'name'     => __( 'Email Heading', 'invoicing' ),
582
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
581
+            'name'     => __('Email Heading', 'invoicing'),
582
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
583 583
             'help-tip' => true,
584 584
             'type'     => 'text',
585
-            'std'      => __( 'Payment reminder for your invoice', 'invoicing' ),
585
+            'std'      => __('Payment reminder for your invoice', 'invoicing'),
586 586
             'size'     => 'large',
587 587
         ),
588 588
 
589 589
         'email_overdue_body'      => array(
590 590
             'id'    => 'email_overdue_body',
591
-            'name'  => __( 'Email Content', 'invoicing' ),
591
+            'name'  => __('Email Content', 'invoicing'),
592 592
             'desc'  => wpinv_get_merge_tags_help_text(),
593 593
             'type'  => 'rich_editor',
594
-            'std'   => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ),
594
+            'std'   => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'),
595 595
             'class' => 'large',
596 596
             'size'  => 10,
597 597
         ),
@@ -602,63 +602,63 @@  discard block
 block discarded – undo
602 602
 
603 603
         'email_renewal_reminder_header'    => array(
604 604
             'id'   => 'email_renewal_reminder_header',
605
-            'name' => '<h3>' . __( 'Renewal Reminder', 'invoicing' ) . '</h3>',
606
-            'desc' => __( 'These emails are sent to customers whenever their subscription is about to renew.', 'invoicing' ),
605
+            'name' => '<h3>' . __('Renewal Reminder', 'invoicing') . '</h3>',
606
+            'desc' => __('These emails are sent to customers whenever their subscription is about to renew.', 'invoicing'),
607 607
             'type' => 'header',
608 608
         ),
609 609
 
610 610
         'email_renewal_reminder_active'    => array(
611 611
             'id'   => 'email_renewal_reminder_active',
612
-            'name' => __( 'Enable/Disable', 'invoicing' ),
613
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
612
+            'name' => __('Enable/Disable', 'invoicing'),
613
+            'desc' => __('Enable this email notification', 'invoicing'),
614 614
             'type' => 'checkbox',
615 615
             'std'  => 0,
616 616
         ),
617 617
 
618 618
         'email_renewal_reminder_admin_bcc' => array(
619 619
             'id'   => 'email_renewal_reminder_admin_bcc',
620
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
621
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
620
+            'name' => __('Enable Admin BCC', 'invoicing'),
621
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
622 622
             'type' => 'checkbox',
623 623
             'std'  => 0,
624 624
         ),
625 625
 
626 626
         'email_renewal_reminder_days'      => array(
627 627
             'id'       => 'email_renewal_reminder_days',
628
-            'name'     => __( 'When to Send', 'invoicing' ),
629
-            'desc'     => __( 'Check when you would like renewal reminders sent out.', 'invoicing' ),
628
+            'name'     => __('When to Send', 'invoicing'),
629
+            'desc'     => __('Check when you would like renewal reminders sent out.', 'invoicing'),
630 630
             'help-tip' => true,
631
-            'std'      => array( '1', '5', '10' ),
631
+            'std'      => array('1', '5', '10'),
632 632
             'type'     => 'multicheck',
633 633
             'options'  => $renewal_days_options,
634 634
         ),
635 635
 
636 636
         'email_renewal_reminder_subject'   => array(
637 637
             'id'       => 'email_renewal_reminder_subject',
638
-            'name'     => __( 'Subject', 'invoicing' ),
639
-            'desc'     => __( 'Enter the subject line for the email.', 'invoicing' ),
638
+            'name'     => __('Subject', 'invoicing'),
639
+            'desc'     => __('Enter the subject line for the email.', 'invoicing'),
640 640
             'help-tip' => true,
641 641
             'type'     => 'text',
642
-            'std'      => __( '[{site_title}] Renewal Reminder', 'invoicing' ),
642
+            'std'      => __('[{site_title}] Renewal Reminder', 'invoicing'),
643 643
             'size'     => 'large',
644 644
         ),
645 645
 
646 646
         'email_renewal_reminder_heading'   => array(
647 647
             'id'       => 'email_renewal_reminder_heading',
648
-            'name'     => __( 'Email Heading', 'invoicing' ),
649
-            'desc'     => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
648
+            'name'     => __('Email Heading', 'invoicing'),
649
+            'desc'     => __('Enter the main heading contained within the email notification.', 'invoicing'),
650 650
             'help-tip' => true,
651 651
             'type'     => 'text',
652
-            'std'      => __( 'Upcoming renewal reminder', 'invoicing' ),
652
+            'std'      => __('Upcoming renewal reminder', 'invoicing'),
653 653
             'size'     => 'large',
654 654
         ),
655 655
 
656 656
         'email_renewal_reminder_body'      => array(
657 657
             'id'    => 'email_renewal_reminder_body',
658
-            'name'  => __( 'Email Content', 'invoicing' ),
659
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
658
+            'name'  => __('Email Content', 'invoicing'),
659
+            'desc'  => wpinv_get_merge_tags_help_text(true),
660 660
             'type'  => 'rich_editor',
661
-            'std'   => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date} for amount {subscription_recurring_amount}.</p>', 'invoicing' ),
661
+            'std'   => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date} for amount {subscription_recurring_amount}.</p>', 'invoicing'),
662 662
             'class' => 'large',
663 663
             'size'  => 10,
664 664
         ),
@@ -669,53 +669,53 @@  discard block
 block discarded – undo
669 669
 
670 670
         'email_subscription_active_header'    => array(
671 671
             'id'   => 'email_subscription_active_header',
672
-            'name' => '<h3>' . __( 'Subscription Active', 'invoicing' ) . '</h3>',
673
-            'desc' => __( 'This email is sent when a subscription is activated.', 'invoicing' ),
672
+            'name' => '<h3>' . __('Subscription Active', 'invoicing') . '</h3>',
673
+            'desc' => __('This email is sent when a subscription is activated.', 'invoicing'),
674 674
             'type' => 'header',
675 675
         ),
676 676
 
677 677
         'email_subscription_active_active'    => array(
678 678
             'id'   => 'email_subscription_active_active',
679
-            'name' => __( 'Enable/Disable', 'invoicing' ),
680
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
679
+            'name' => __('Enable/Disable', 'invoicing'),
680
+            'desc' => __('Enable this email notification', 'invoicing'),
681 681
             'type' => 'checkbox',
682 682
             'std'  => 1,
683 683
         ),
684 684
 
685 685
         'email_subscription_active_admin_bcc' => array(
686 686
             'id'   => 'email_subscription_active_admin_bcc',
687
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
688
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
687
+            'name' => __('Enable Admin BCC', 'invoicing'),
688
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
689 689
             'type' => 'checkbox',
690 690
             'std'  => 1,
691 691
         ),
692 692
 
693 693
         'email_subscription_active_subject'   => array(
694 694
             'id'       => 'email_subscription_active_subject',
695
-            'name'     => __( 'Subject', 'invoicing' ),
696
-            'desc'     => __( 'Enter the subject line for the subscription active email.', 'invoicing' ),
695
+            'name'     => __('Subject', 'invoicing'),
696
+            'desc'     => __('Enter the subject line for the subscription active email.', 'invoicing'),
697 697
             'help-tip' => true,
698 698
             'type'     => 'text',
699
-            'std'      => __( '[{site_title}] Your subscription #{subscription_id} has been activated', 'invoicing' ),
699
+            'std'      => __('[{site_title}] Your subscription #{subscription_id} has been activated', 'invoicing'),
700 700
             'size'     => 'large',
701 701
         ),
702 702
 
703 703
         'email_subscription_active_heading'   => array(
704 704
             'id'       => 'email_subscription_active_heading',
705
-            'name'     => __( 'Email Heading', 'invoicing' ),
706
-            'desc'     => __( 'Enter the main heading of this email.', 'invoicing' ),
705
+            'name'     => __('Email Heading', 'invoicing'),
706
+            'desc'     => __('Enter the main heading of this email.', 'invoicing'),
707 707
             'help-tip' => true,
708 708
             'type'     => 'text',
709
-            'std'      => __( 'Subscription Activated', 'invoicing' ),
709
+            'std'      => __('Subscription Activated', 'invoicing'),
710 710
             'size'     => 'large',
711 711
         ),
712 712
 
713 713
         'email_subscription_active_body'      => array(
714 714
             'id'    => 'email_subscription_active_body',
715
-            'name'  => __( 'Email Content', 'invoicing' ),
716
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
715
+            'name'  => __('Email Content', 'invoicing'),
716
+            'desc'  => wpinv_get_merge_tags_help_text(true),
717 717
             'type'  => 'rich_editor',
718
-            'std'   => __( '<p>Hi {first_name},</p><p>Your subscription #{subscription_id} for {subscription_name} has been activated.</p>', 'invoicing' ),
718
+            'std'   => __('<p>Hi {first_name},</p><p>Your subscription #{subscription_id} for {subscription_name} has been activated.</p>', 'invoicing'),
719 719
             'class' => 'large',
720 720
             'size'  => 10,
721 721
         ),
@@ -725,53 +725,53 @@  discard block
 block discarded – undo
725 725
 
726 726
         'email_subscription_trial_header'    => array(
727 727
             'id'   => 'email_subscription_trial_header',
728
-            'name' => '<h3>' . __( 'Trial Started', 'invoicing' ) . '</h3>',
729
-            'desc' => __( 'These emails are sent when a customer starts a subscription trial.', 'invoicing' ),
728
+            'name' => '<h3>' . __('Trial Started', 'invoicing') . '</h3>',
729
+            'desc' => __('These emails are sent when a customer starts a subscription trial.', 'invoicing'),
730 730
             'type' => 'header',
731 731
         ),
732 732
 
733 733
         'email_subscription_trial_active'    => array(
734 734
             'id'   => 'email_subscription_trial_active',
735
-            'name' => __( 'Enable/Disable', 'invoicing' ),
736
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
735
+            'name' => __('Enable/Disable', 'invoicing'),
736
+            'desc' => __('Enable this email notification', 'invoicing'),
737 737
             'type' => 'checkbox',
738 738
             'std'  => 0,
739 739
         ),
740 740
 
741 741
         'email_subscription_trial_admin_bcc' => array(
742 742
             'id'   => 'email_subscription_trial_admin_bcc',
743
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
744
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
743
+            'name' => __('Enable Admin BCC', 'invoicing'),
744
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
745 745
             'type' => 'checkbox',
746 746
             'std'  => 0,
747 747
         ),
748 748
 
749 749
         'email_subscription_trial_subject'   => array(
750 750
             'id'       => 'email_subscription_trial_subject',
751
-            'name'     => __( 'Subject', 'invoicing' ),
752
-            'desc'     => __( 'Enter the subject line for the subscription trial email.', 'invoicing' ),
751
+            'name'     => __('Subject', 'invoicing'),
752
+            'desc'     => __('Enter the subject line for the subscription trial email.', 'invoicing'),
753 753
             'help-tip' => true,
754 754
             'type'     => 'text',
755
-            'std'      => __( '[{site_title}] Trial Started', 'invoicing' ),
755
+            'std'      => __('[{site_title}] Trial Started', 'invoicing'),
756 756
             'size'     => 'large',
757 757
         ),
758 758
 
759 759
         'email_subscription_trial_heading'   => array(
760 760
             'id'       => 'email_subscription_trial_heading',
761
-            'name'     => __( 'Email Heading', 'invoicing' ),
762
-            'desc'     => __( 'Enter the main heading of this email.', 'invoicing' ),
761
+            'name'     => __('Email Heading', 'invoicing'),
762
+            'desc'     => __('Enter the main heading of this email.', 'invoicing'),
763 763
             'help-tip' => true,
764 764
             'type'     => 'text',
765
-            'std'      => __( 'Trial Started', 'invoicing' ),
765
+            'std'      => __('Trial Started', 'invoicing'),
766 766
             'size'     => 'large',
767 767
         ),
768 768
 
769 769
         'email_subscription_trial_body'      => array(
770 770
             'id'    => 'email_subscription_trial_body',
771
-            'name'  => __( 'Email Content', 'invoicing' ),
772
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
771
+            'name'  => __('Email Content', 'invoicing'),
772
+            'desc'  => wpinv_get_merge_tags_help_text(true),
773 773
             'type'  => 'rich_editor',
774
-            'std'   => __( '<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will renew on {subscription_renewal_date}.</p>', 'invoicing' ),
774
+            'std'   => __('<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will renew on {subscription_renewal_date}.</p>', 'invoicing'),
775 775
             'class' => 'large',
776 776
             'size'  => 10,
777 777
         ),
@@ -781,53 +781,53 @@  discard block
 block discarded – undo
781 781
 
782 782
         'email_subscription_cancelled_header'    => array(
783 783
             'id'   => 'email_subscription_cancelled_header',
784
-            'name' => '<h3>' . __( 'Subscription Cancelled', 'invoicing' ) . '</h3>',
785
-            'desc' => __( 'These emails are sent when a customer cancels their subscription.', 'invoicing' ),
784
+            'name' => '<h3>' . __('Subscription Cancelled', 'invoicing') . '</h3>',
785
+            'desc' => __('These emails are sent when a customer cancels their subscription.', 'invoicing'),
786 786
             'type' => 'header',
787 787
         ),
788 788
 
789 789
         'email_subscription_cancelled_active'    => array(
790 790
             'id'   => 'email_subscription_cancelled_active',
791
-            'name' => __( 'Enable/Disable', 'invoicing' ),
792
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
791
+            'name' => __('Enable/Disable', 'invoicing'),
792
+            'desc' => __('Enable this email notification', 'invoicing'),
793 793
             'type' => 'checkbox',
794 794
             'std'  => 1,
795 795
         ),
796 796
 
797 797
         'email_subscription_cancelled_admin_bcc' => array(
798 798
             'id'   => 'email_subscription_cancelled_admin_bcc',
799
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
800
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
799
+            'name' => __('Enable Admin BCC', 'invoicing'),
800
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
801 801
             'type' => 'checkbox',
802 802
             'std'  => 1,
803 803
         ),
804 804
 
805 805
         'email_subscription_cancelled_subject'   => array(
806 806
             'id'       => 'email_subscription_cancelled_subject',
807
-            'name'     => __( 'Subject', 'invoicing' ),
808
-            'desc'     => __( 'Enter the subject line for the subscription cancelled email.', 'invoicing' ),
807
+            'name'     => __('Subject', 'invoicing'),
808
+            'desc'     => __('Enter the subject line for the subscription cancelled email.', 'invoicing'),
809 809
             'help-tip' => true,
810 810
             'type'     => 'text',
811
-            'std'      => __( '[{site_title}] Subscription Cancelled', 'invoicing' ),
811
+            'std'      => __('[{site_title}] Subscription Cancelled', 'invoicing'),
812 812
             'size'     => 'large',
813 813
         ),
814 814
 
815 815
         'email_subscription_cancelled_heading'   => array(
816 816
             'id'       => 'email_subscription_cancelled_heading',
817
-            'name'     => __( 'Email Heading', 'invoicing' ),
818
-            'desc'     => __( 'Enter the main heading of this email.', 'invoicing' ),
817
+            'name'     => __('Email Heading', 'invoicing'),
818
+            'desc'     => __('Enter the main heading of this email.', 'invoicing'),
819 819
             'help-tip' => true,
820 820
             'type'     => 'text',
821
-            'std'      => __( 'Subscription Cancelled', 'invoicing' ),
821
+            'std'      => __('Subscription Cancelled', 'invoicing'),
822 822
             'size'     => 'large',
823 823
         ),
824 824
 
825 825
         'email_subscription_cancelled_body'      => array(
826 826
             'id'    => 'email_subscription_cancelled_body',
827
-            'name'  => __( 'Email Content', 'invoicing' ),
828
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
827
+            'name'  => __('Email Content', 'invoicing'),
828
+            'desc'  => wpinv_get_merge_tags_help_text(true),
829 829
             'type'  => 'rich_editor',
830
-            'std'   => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing' ),
830
+            'std'   => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing'),
831 831
             'class' => 'large',
832 832
             'size'  => 10,
833 833
         ),
@@ -837,53 +837,53 @@  discard block
 block discarded – undo
837 837
 
838 838
         'email_subscription_expired_header'    => array(
839 839
             'id'   => 'email_subscription_expired_header',
840
-            'name' => '<h3>' . __( 'Subscription Expired', 'invoicing' ) . '</h3>',
841
-            'desc' => __( "These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing' ),
840
+            'name' => '<h3>' . __('Subscription Expired', 'invoicing') . '</h3>',
841
+            'desc' => __("These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing'),
842 842
             'type' => 'header',
843 843
         ),
844 844
 
845 845
         'email_subscription_expired_active'    => array(
846 846
             'id'   => 'email_subscription_expired_active',
847
-            'name' => __( 'Enable/Disable', 'invoicing' ),
848
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
847
+            'name' => __('Enable/Disable', 'invoicing'),
848
+            'desc' => __('Enable this email notification', 'invoicing'),
849 849
             'type' => 'checkbox',
850 850
             'std'  => 1,
851 851
         ),
852 852
 
853 853
         'email_subscription_expired_admin_bcc' => array(
854 854
             'id'   => 'email_subscription_expired_admin_bcc',
855
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
856
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
855
+            'name' => __('Enable Admin BCC', 'invoicing'),
856
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
857 857
             'type' => 'checkbox',
858 858
             'std'  => 1,
859 859
         ),
860 860
 
861 861
         'email_subscription_expired_subject'   => array(
862 862
             'id'       => 'email_subscription_expired_subject',
863
-            'name'     => __( 'Subject', 'invoicing' ),
864
-            'desc'     => __( 'Enter the subject line for the subscription expired email.', 'invoicing' ),
863
+            'name'     => __('Subject', 'invoicing'),
864
+            'desc'     => __('Enter the subject line for the subscription expired email.', 'invoicing'),
865 865
             'help-tip' => true,
866 866
             'type'     => 'text',
867
-            'std'      => __( '[{site_title}] Subscription Expired', 'invoicing' ),
867
+            'std'      => __('[{site_title}] Subscription Expired', 'invoicing'),
868 868
             'size'     => 'large',
869 869
         ),
870 870
 
871 871
         'email_subscription_expired_heading'   => array(
872 872
             'id'       => 'email_subscription_expired_heading',
873
-            'name'     => __( 'Email Heading', 'invoicing' ),
874
-            'desc'     => __( 'Enter the main heading of this email.', 'invoicing' ),
873
+            'name'     => __('Email Heading', 'invoicing'),
874
+            'desc'     => __('Enter the main heading of this email.', 'invoicing'),
875 875
             'type'     => 'text',
876
-            'std'      => __( 'Subscription Expired', 'invoicing' ),
876
+            'std'      => __('Subscription Expired', 'invoicing'),
877 877
             'help-tip' => true,
878 878
             'size'     => 'large',
879 879
         ),
880 880
 
881 881
         'email_subscription_expired_body'      => array(
882 882
             'id'    => 'email_subscription_expired_body',
883
-            'name'  => __( 'Email Content', 'invoicing' ),
884
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
883
+            'name'  => __('Email Content', 'invoicing'),
884
+            'desc'  => wpinv_get_merge_tags_help_text(true),
885 885
             'type'  => 'rich_editor',
886
-            'std'   => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing' ),
886
+            'std'   => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing'),
887 887
             'class' => 'large',
888 888
             'size'  => 10,
889 889
         ),
@@ -893,53 +893,53 @@  discard block
 block discarded – undo
893 893
 
894 894
         'email_subscription_complete_header'    => array(
895 895
             'id'   => 'email_subscription_complete_header',
896
-            'name' => '<h3>' . __( 'Subscription Complete', 'invoicing' ) . '</h3>',
897
-            'desc' => __( 'These emails are sent when a customer completes their subscription.', 'invoicing' ),
896
+            'name' => '<h3>' . __('Subscription Complete', 'invoicing') . '</h3>',
897
+            'desc' => __('These emails are sent when a customer completes their subscription.', 'invoicing'),
898 898
             'type' => 'header',
899 899
         ),
900 900
 
901 901
         'email_subscription_complete_active'    => array(
902 902
             'id'   => 'email_subscription_complete_active',
903
-            'name' => __( 'Enable/Disable', 'invoicing' ),
904
-            'desc' => __( 'Enable this email notification', 'invoicing' ),
903
+            'name' => __('Enable/Disable', 'invoicing'),
904
+            'desc' => __('Enable this email notification', 'invoicing'),
905 905
             'type' => 'checkbox',
906 906
             'std'  => 1,
907 907
         ),
908 908
 
909 909
         'email_subscription_complete_admin_bcc' => array(
910 910
             'id'   => 'email_subscription_complete_admin_bcc',
911
-            'name' => __( 'Enable Admin BCC', 'invoicing' ),
912
-            'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ),
911
+            'name' => __('Enable Admin BCC', 'invoicing'),
912
+            'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'),
913 913
             'type' => 'checkbox',
914 914
             'std'  => 1,
915 915
         ),
916 916
 
917 917
         'email_subscription_complete_subject'   => array(
918 918
             'id'       => 'email_subscription_complete_subject',
919
-            'name'     => __( 'Subject', 'invoicing' ),
920
-            'desc'     => __( 'Enter the subject line for the subscription complete email.', 'invoicing' ),
919
+            'name'     => __('Subject', 'invoicing'),
920
+            'desc'     => __('Enter the subject line for the subscription complete email.', 'invoicing'),
921 921
             'help-tip' => true,
922 922
             'type'     => 'text',
923
-            'std'      => __( '[{site_title}] Subscription Complete', 'invoicing' ),
923
+            'std'      => __('[{site_title}] Subscription Complete', 'invoicing'),
924 924
             'size'     => 'large',
925 925
         ),
926 926
 
927 927
         'email_subscription_complete_heading'   => array(
928 928
             'id'       => 'email_subscription_complete_heading',
929
-            'name'     => __( 'Email Heading', 'invoicing' ),
930
-            'desc'     => __( 'Enter the main heading of this email.', 'invoicing' ),
929
+            'name'     => __('Email Heading', 'invoicing'),
930
+            'desc'     => __('Enter the main heading of this email.', 'invoicing'),
931 931
             'help-tip' => true,
932 932
             'type'     => 'text',
933
-            'std'      => __( 'Subscription Complete', 'invoicing' ),
933
+            'std'      => __('Subscription Complete', 'invoicing'),
934 934
             'size'     => 'large',
935 935
         ),
936 936
 
937 937
         'email_subscription_complete_body'      => array(
938 938
             'id'    => 'email_subscription_complete_body',
939
-            'name'  => __( 'Email Content', 'invoicing' ),
940
-            'desc'  => wpinv_get_merge_tags_help_text( true ),
939
+            'name'  => __('Email Content', 'invoicing'),
940
+            'desc'  => wpinv_get_merge_tags_help_text(true),
941 941
             'type'  => 'rich_editor',
942
-            'std'   => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing' ),
942
+            'std'   => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing'),
943 943
             'class' => 'large',
944 944
             'size'  => 10,
945 945
         ),
Please login to merge, or discard this patch.
templates/emails/wpinv-email-renewal_reminder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  * @var WPInv_Subscription $object
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $invoice = $object->get_parent_payment();
14 14
 
15 15
 // Print the email header.
16
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
17 17
 
18 18
 // Generate the custom message body.
19
-echo wp_kses_post( $message_body );
19
+echo wp_kses_post($message_body);
20 20
 
21 21
 // Print the billing details.
22
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
22
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
23 23
 
24 24
 // Print the email footer.
25
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
25
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/inc/bs5-js.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1075,8 +1075,8 @@
 block discarded – undo
1075 1075
     aui_flip_color_scheme_on_scroll();
1076 1076
 
1077 1077
 	<?php
1078
-	// FSE tweaks.
1079
-	if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1078
+    // FSE tweaks.
1079
+    if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1080 1080
     function aui_fse_set_data_scroll() {
1081 1081
         console.log('init scroll');
1082 1082
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     function aui_init_flatpickr(){
261 261
         if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
262 262
             $aui_doing_init_flatpickr = true;
263
-			<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
263
+			<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
264 264
             jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
265 265
         }
266 266
         $aui_doing_init_flatpickr = false;
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
 	<?php
1078 1078
 	// FSE tweaks.
1079
-	if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1079
+	if (!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas'])) { ?>
1080 1080
     function aui_fse_set_data_scroll() {
1081 1081
         console.log('init scroll');
1082 1082
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
Switch Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php // @todo eventually we need to convert this to non jQuery ?>
1
+    <?php // @todo eventually we need to convert this to non jQuery ?>
2 2
 <script>
3 3
     /**
4 4
      * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
     aui_flip_color_scheme_on_scroll();
1076 1076
 
1077 1077
 	<?php
1078
-	// FSE tweaks.
1079
-	if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1078
+	    // FSE tweaks.
1079
+	    if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1080 1080
     function aui_fse_set_data_scroll() {
1081 1081
         console.log('init scroll');
1082 1082
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/inc/bs4-js.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -962,8 +962,8 @@
 block discarded – undo
962 962
     aui_flip_color_scheme_on_scroll();
963 963
 
964 964
 	<?php
965
-	// FSE tweaks.
966
-	if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
965
+    // FSE tweaks.
966
+    if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
967 967
     function aui_fse_set_data_scroll() {
968 968
         console.log('init scroll');
969 969
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     function aui_init_flatpickr(){
243 243
         if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
244 244
             $aui_doing_init_flatpickr = true;
245
-			<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
245
+			<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
246 246
             jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
247 247
         }
248 248
         $aui_doing_init_flatpickr = false;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 
964 964
 	<?php
965 965
 	// FSE tweaks.
966
-	if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
966
+	if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template' || !empty($_REQUEST['canvas'])) { ?>
967 967
     function aui_fse_set_data_scroll() {
968 968
         console.log('init scroll');
969 969
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -962,8 +962,8 @@
 block discarded – undo
962 962
     aui_flip_color_scheme_on_scroll();
963 963
 
964 964
 	<?php
965
-	// FSE tweaks.
966
-	if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
965
+	    // FSE tweaks.
966
+	    if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
967 967
     function aui_fse_set_data_scroll() {
968 968
         console.log('init scroll');
969 969
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
templates/subscriptions/subscriptions-table-row.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -13,47 +13,47 @@
 block discarded – undo
13 13
 
14 14
 foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) :
15 15
 
16
-	$class = sanitize_html_class( $column );
17
-	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
16
+    $class = sanitize_html_class( $column );
17
+    echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
18 18
 
19
-		do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
19
+        do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
20 20
 
21
-		switch ( $column ) :
21
+        switch ( $column ) :
22 22
 
23
-		case 'subscription':
24
-			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
26
-			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
-				(int) $subscription->get_id()
29
-			);
23
+        case 'subscription':
24
+            $subscription_id = (int) $subscription->get_id();
25
+            $url             = esc_url( $subscription->get_view_url() );
26
+            $id_label        = sprintf(
27
+                esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
+                (int) $subscription->get_id()
29
+            );
30 30
 
31
-			echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
32
-			break;
31
+            echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
32
+            break;
33 33
 
34
-		case 'status':
35
-			echo wp_kses_post( $subscription->get_status_label_html() );
36
-			break;
34
+        case 'status':
35
+            echo wp_kses_post( $subscription->get_status_label_html() );
36
+            break;
37 37
 
38
-		case 'renewal-date':
39
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
41
-			break;
38
+        case 'renewal-date':
39
+            $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
+            echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
41
+            break;
42 42
 
43
-		case 'amount':
44
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
47
-			break;
43
+        case 'amount':
44
+            $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
+            $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
+            echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
47
+            break;
48 48
 
49
-		case 'actions':
50
-			echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
51
-			break;
49
+        case 'actions':
50
+            echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
51
+            break;
52 52
 
53
-		endswitch;
53
+        endswitch;
54 54
 
55
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
55
+        do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
56 56
 
57
-	echo '</td>';
57
+    echo '</td>';
58 58
 
59 59
 endforeach;
Please login to merge, or discard this patch.
Switch Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,40 +20,40 @@
 block discarded – undo
20 20
 
21 21
 		switch ( $column ) :
22 22
 
23
-		case 'subscription':
24
-			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
26
-			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
-				(int) $subscription->get_id()
29
-			);
23
+		    case 'subscription':
24
+			    $subscription_id = (int) $subscription->get_id();
25
+			    $url             = esc_url( $subscription->get_view_url() );
26
+			    $id_label        = sprintf(
27
+				    esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
+				    (int) $subscription->get_id()
29
+			    );
30 30
 
31
-			echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
32
-			break;
31
+			    echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
32
+			    break;
33 33
 
34
-		case 'status':
35
-			echo wp_kses_post( $subscription->get_status_label_html() );
36
-			break;
34
+		    case 'status':
35
+			    echo wp_kses_post( $subscription->get_status_label_html() );
36
+			    break;
37 37
 
38
-		case 'renewal-date':
39
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
41
-			break;
38
+		    case 'renewal-date':
39
+			    $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
+			    echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
41
+			    break;
42 42
 
43
-		case 'amount':
44
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
47
-			break;
43
+		    case 'amount':
44
+			    $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
+			    $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
+			    echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
47
+			    break;
48 48
 
49
-		case 'actions':
50
-			echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
51
-			break;
49
+		    case 'actions':
50
+			    echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
51
+			    break;
52 52
 
53
-		endswitch;
53
+		    endswitch;
54 54
 
55
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
55
+		    do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
56 56
 
57
-	echo '</td>';
57
+	    echo '</td>';
58 58
 
59
-endforeach;
59
+    endforeach;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@
 block discarded – undo
9 9
  * @var WPInv_Subscriptions_Widget $widget
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) :
14
+foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) :
15 15
 
16
-	$class = sanitize_html_class( $column );
17
-	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
16
+	$class = sanitize_html_class($column);
17
+	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr($class) . "'>";
18 18
 
19
-		do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
19
+		do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription);
20 20
 
21
-		switch ( $column ) :
21
+		switch ($column) :
22 22
 
23 23
 		case 'subscription':
24 24
 			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
25
+			$url             = esc_url($subscription->get_view_url());
26 26
 			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
27
+				esc_attr_x('#%s', 'subscription id', 'invoicing'),
28 28
 				(int) $subscription->get_id()
29 29
 			);
30 30
 
31
-			echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
31
+			echo wp_kses_post("<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>");
32 32
 			break;
33 33
 
34 34
 		case 'status':
35
-			echo wp_kses_post( $subscription->get_status_label_html() );
35
+			echo wp_kses_post($subscription->get_status_label_html());
36 36
 			break;
37 37
 
38 38
 		case 'renewal-date':
39
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
39
+			$renewal = getpaid_format_date_value($subscription->get_next_renewal_date());
40
+			echo $subscription->is_active() ? esc_html($renewal) : '&mdash;';
41 41
 			break;
42 42
 
43 43
 		case 'amount':
44
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
44
+			$frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), '');
45
+			$amount    = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency());
46
+			echo wp_kses_post("<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>");
47 47
 			break;
48 48
 
49 49
 		case 'actions':
50
-			echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
50
+			echo wp_kses_post($widget->add_row_actions('', $subscription));
51 51
 			break;
52 52
 
53 53
 		endswitch;
54 54
 
55
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
55
+		do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription);
56 56
 
57 57
 	echo '</td>';
58 58
 
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 2 patches
Indentation   +2763 added lines, -2763 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
 class WPInv_Invoice extends GetPaid_Data {
15 15
 
16 16
     /**
17
-	 * Which data store to load.
18
-	 *
19
-	 * @var string
20
-	 */
17
+     * Which data store to load.
18
+     *
19
+     * @var string
20
+     */
21 21
     protected $data_store_name = 'invoice';
22 22
 
23 23
     /**
24
-	 * This is the name of this object type.
25
-	 *
26
-	 * @var string
27
-	 */
24
+     * This is the name of this object type.
25
+     *
26
+     * @var string
27
+     */
28 28
     protected $object_type = 'invoice';
29 29
 
30 30
     /**
31
-	 * Item Data array. This is the core item data exposed in APIs.
32
-	 *
33
-	 * @since 1.0.19
34
-	 * @var array
35
-	 */
36
-	protected $data = array(
37
-		'parent_id'              => 0,
38
-		'customer_id'            => 0,
39
-		'status'                 => 'wpi-pending',
40
-		'version'                => '',
41
-		'date_created'           => null,
31
+     * Item Data array. This is the core item data exposed in APIs.
32
+     *
33
+     * @since 1.0.19
34
+     * @var array
35
+     */
36
+    protected $data = array(
37
+        'parent_id'              => 0,
38
+        'customer_id'            => 0,
39
+        'status'                 => 'wpi-pending',
40
+        'version'                => '',
41
+        'date_created'           => null,
42 42
         'date_modified'          => null,
43 43
         'due_date'               => null,
44 44
         'completed_date'         => null,
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
         'state'                  => null,
62 62
         'zip'                    => null,
63 63
         'company'                => null,
64
-		'company_id'             => null,
64
+        'company_id'             => null,
65 65
         'vat_number'             => null,
66 66
         'vat_rate'               => null,
67 67
         'address'                => null,
68 68
         'address_confirmed'      => false,
69 69
         'shipping'               => null,
70
-		'subtotal'               => 0,
70
+        'subtotal'               => 0,
71 71
         'total_discount'         => 0,
72 72
         'total_tax'              => 0,
73
-		'total_fees'             => 0,
74
-		'total'                  => 0,
73
+        'total_fees'             => 0,
74
+        'total'                  => 0,
75 75
         'fees'                   => array(),
76 76
         'discounts'              => array(),
77 77
         'taxes'                  => array(),
@@ -83,23 +83,23 @@  discard block
 block discarded – undo
83 83
         'transaction_id'         => '',
84 84
         'currency'               => '',
85 85
         'disable_taxes'          => false,
86
-		'subscription_id'        => null,
87
-		'remote_subscription_id' => null,
88
-		'is_anonymized'          => false,
89
-		'is_viewed'              => false,
90
-		'email_cc'               => '',
91
-		'template'               => 'quantity', // hours, amount only
92
-		'created_via'            => null,
86
+        'subscription_id'        => null,
87
+        'remote_subscription_id' => null,
88
+        'is_anonymized'          => false,
89
+        'is_viewed'              => false,
90
+        'email_cc'               => '',
91
+        'template'               => 'quantity', // hours, amount only
92
+        'created_via'            => null,
93 93
     );
94 94
 
95 95
     /**
96
-	 * Stores meta in cache for future reads.
97
-	 *
98
-	 * A group must be set to to enable caching.
99
-	 *
100
-	 * @var string
101
-	 */
102
-	protected $cache_group = 'getpaid_invoices';
96
+     * Stores meta in cache for future reads.
97
+     *
98
+     * A group must be set to to enable caching.
99
+     *
100
+     * @var string
101
+     */
102
+    protected $cache_group = 'getpaid_invoices';
103 103
 
104 104
     /**
105 105
      * Stores a reference to the original WP_Post object
@@ -113,122 +113,122 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @var int
115 115
      */
116
-	protected $recurring_item = null;
116
+    protected $recurring_item = null;
117 117
 
118
-	/**
118
+    /**
119 119
      * Stores an array of item totals.
120
-	 *
121
-	 * e.g $totals['discount'] = array(
122
-	 *      'initial'   => 10,
123
-	 *      'recurring' => 10,
124
-	 * )
120
+     *
121
+     * e.g $totals['discount'] = array(
122
+     *      'initial'   => 10,
123
+     *      'recurring' => 10,
124
+     * )
125 125
      *
126 126
      * @var array
127 127
      */
128
-	protected $totals = array();
128
+    protected $totals = array();
129 129
 
130
-	/**
130
+    /**
131 131
      * Tax rate.
132
-	 *
132
+     *
133 133
      * @var float
134 134
      */
135
-	protected $tax_rate = 0;
135
+    protected $tax_rate = 0;
136 136
 
137
-	/**
138
-	 * Stores the status transition information.
139
-	 *
140
-	 * @since 1.0.19
141
-	 * @var bool|array
142
-	 */
143
-	protected $status_transition = false;
137
+    /**
138
+     * Stores the status transition information.
139
+     *
140
+     * @since 1.0.19
141
+     * @var bool|array
142
+     */
143
+    protected $status_transition = false;
144 144
 
145 145
     /**
146
-	 * Get the invoice if ID is passed, otherwise the invoice is new and empty.
147
-	 *
148
-	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
149
-	 */
146
+     * Get the invoice if ID is passed, otherwise the invoice is new and empty.
147
+     *
148
+     * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
149
+     */
150 150
     public function __construct( $invoice = 0 ) {
151 151
 
152 152
         parent::__construct( $invoice );
153 153
 
154
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
155
-			$this->set_id( (int) $invoice );
156
-		} elseif ( $invoice instanceof self ) {
157
-			$this->set_id( $invoice->get_id() );
158
-		} elseif ( ! empty( $invoice->ID ) ) {
159
-			$this->set_id( $invoice->ID );
160
-		} elseif ( is_array( $invoice ) ) {
161
-			$this->set_props( $invoice );
162
-
163
-			if ( isset( $invoice['ID'] ) ) {
164
-				$this->set_id( $invoice['ID'] );
165
-			}
154
+        if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
155
+            $this->set_id( (int) $invoice );
156
+        } elseif ( $invoice instanceof self ) {
157
+            $this->set_id( $invoice->get_id() );
158
+        } elseif ( ! empty( $invoice->ID ) ) {
159
+            $this->set_id( $invoice->ID );
160
+        } elseif ( is_array( $invoice ) ) {
161
+            $this->set_props( $invoice );
162
+
163
+            if ( isset( $invoice['ID'] ) ) {
164
+                $this->set_id( $invoice['ID'] );
165
+            }
166 166
 } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
169
-			$this->set_id( $invoice_id );
170
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
171
-			$this->set_id( $invoice_id );
172
-		} else {
173
-			$this->set_object_read( true );
174
-		}
167
+            $this->set_id( $invoice_id );
168
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
169
+            $this->set_id( $invoice_id );
170
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
171
+            $this->set_id( $invoice_id );
172
+        } else {
173
+            $this->set_object_read( true );
174
+        }
175 175
 
176 176
         // Load the datastore.
177
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
177
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
178 178
 
179
-		if ( $this->get_id() > 0 ) {
179
+        if ( $this->get_id() > 0 ) {
180 180
             $this->post = get_post( $this->get_id() );
181 181
             $this->ID   = $this->get_id();
182
-			$this->data_store->read( $this );
182
+            $this->data_store->read( $this );
183 183
         }
184 184
 
185 185
     }
186 186
 
187 187
     /**
188
-	 * Given an invoice key/number, it returns its id.
189
-	 *
190
-	 *
191
-	 * @static
192
-	 * @param string $value The invoice key or number
193
-	 * @param string $field Either key, transaction_id or number.
194
-	 * @since 1.0.15
195
-	 * @return int
196
-	 */
197
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
188
+     * Given an invoice key/number, it returns its id.
189
+     *
190
+     *
191
+     * @static
192
+     * @param string $value The invoice key or number
193
+     * @param string $field Either key, transaction_id or number.
194
+     * @since 1.0.15
195
+     * @return int
196
+     */
197
+    public static function get_invoice_id_by_field( $value, $field = 'key' ) {
198 198
         global $wpdb;
199 199
 
200
-		// Trim the value.
201
-		$value = trim( $value );
200
+        // Trim the value.
201
+        $value = trim( $value );
202 202
 
203
-		if ( empty( $value ) ) {
204
-			return 0;
205
-		}
203
+        if ( empty( $value ) ) {
204
+            return 0;
205
+        }
206 206
 
207 207
         // Valid fields.
208 208
         $fields = array( 'key', 'number', 'transaction_id' );
209 209
 
210
-		// Ensure a field has been passed.
211
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
212
-			return 0;
213
-		}
210
+        // Ensure a field has been passed.
211
+        if ( empty( $field ) || ! in_array( $field, $fields ) ) {
212
+            return 0;
213
+        }
214 214
 
215
-		// Maybe retrieve from the cache.
216
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
217
-		if ( false !== $invoice_id ) {
218
-			return $invoice_id;
219
-		}
215
+        // Maybe retrieve from the cache.
216
+        $invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
217
+        if ( false !== $invoice_id ) {
218
+            return $invoice_id;
219
+        }
220 220
 
221 221
         // Fetch from the db.
222 222
         $table       = $wpdb->prefix . 'getpaid_invoices';
223
-		$db_field    = 'key' === $field ? 'invoice_key' : $field;
223
+        $db_field    = 'key' === $field ? 'invoice_key' : $field;
224 224
         $invoice_id  = (int) $wpdb->get_var(
225 225
             $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$db_field`=%s LIMIT 1", $value )
226 226
         );
227 227
 
228
-		// Update the cache with our data
229
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
228
+        // Update the cache with our data
229
+        wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
230 230
 
231
-		return $invoice_id;
231
+        return $invoice_id;
232 232
     }
233 233
 
234 234
     /**
@@ -254,83 +254,83 @@  discard block
 block discarded – undo
254 254
     */
255 255
 
256 256
     /**
257
-	 * Get parent invoice ID.
258
-	 *
259
-	 * @since 1.0.19
260
-	 * @param  string $context View or edit context.
261
-	 * @return int
262
-	 */
263
-	public function get_parent_id( $context = 'view' ) {
264
-		return (int) $this->get_prop( 'parent_id', $context );
257
+     * Get parent invoice ID.
258
+     *
259
+     * @since 1.0.19
260
+     * @param  string $context View or edit context.
261
+     * @return int
262
+     */
263
+    public function get_parent_id( $context = 'view' ) {
264
+        return (int) $this->get_prop( 'parent_id', $context );
265 265
     }
266 266
 
267 267
     /**
268
-	 * Get parent invoice.
269
-	 *
270
-	 * @since 1.0.19
271
-	 * @return WPInv_Invoice
272
-	 */
268
+     * Get parent invoice.
269
+     *
270
+     * @since 1.0.19
271
+     * @return WPInv_Invoice
272
+     */
273 273
     public function get_parent_payment() {
274 274
         return new WPInv_Invoice( $this->get_parent_id() );
275 275
     }
276 276
 
277 277
     /**
278
-	 * Alias for self::get_parent_payment().
279
-	 *
280
-	 * @since 1.0.19
281
-	 * @return WPInv_Invoice
282
-	 */
278
+     * Alias for self::get_parent_payment().
279
+     *
280
+     * @since 1.0.19
281
+     * @return WPInv_Invoice
282
+     */
283 283
     public function get_parent() {
284 284
         return $this->get_parent_payment();
285 285
     }
286 286
 
287 287
     /**
288
-	 * Get invoice status.
289
-	 *
290
-	 * @since 1.0.19
291
-	 * @param  string $context View or edit context.
292
-	 * @return string
293
-	 */
294
-	public function get_status( $context = 'view' ) {
295
-		return $this->get_prop( 'status', $context );
296
-	}
288
+     * Get invoice status.
289
+     *
290
+     * @since 1.0.19
291
+     * @param  string $context View or edit context.
292
+     * @return string
293
+     */
294
+    public function get_status( $context = 'view' ) {
295
+        return $this->get_prop( 'status', $context );
296
+    }
297 297
 
298
-	/**
299
-	 * Retrieves an array of possible invoice statuses.
300
-	 *
301
-	 * @since 1.0.19
302
-	 * @return array
303
-	 */
304
-	public function get_all_statuses() {
305
-		return wpinv_get_invoice_statuses( true, true, $this );
298
+    /**
299
+     * Retrieves an array of possible invoice statuses.
300
+     *
301
+     * @since 1.0.19
302
+     * @return array
303
+     */
304
+    public function get_all_statuses() {
305
+        return wpinv_get_invoice_statuses( true, true, $this );
306 306
     }
307 307
 
308 308
     /**
309
-	 * Get invoice status nice name.
310
-	 *
311
-	 * @since 1.0.19
312
-	 * @return string
313
-	 */
309
+     * Get invoice status nice name.
310
+     *
311
+     * @since 1.0.19
312
+     * @return string
313
+     */
314 314
     public function get_status_nicename() {
315
-		$statuses = $this->get_all_statuses();
315
+        $statuses = $this->get_all_statuses();
316 316
 
317 317
         $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
318 318
 
319 319
         return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
320 320
     }
321 321
 
322
-	/**
323
-	 * Retrieves the invoice status class
324
-	 *
325
-	 * @since  1.0.19
326
-	 * @return string
327
-	 */
328
-	public function get_status_class() {
329
-		$statuses = getpaid_get_invoice_status_classes();
330
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'bg-dark text-white';
331
-	}
322
+    /**
323
+     * Retrieves the invoice status class
324
+     *
325
+     * @since  1.0.19
326
+     * @return string
327
+     */
328
+    public function get_status_class() {
329
+        $statuses = getpaid_get_invoice_status_classes();
330
+        return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'bg-dark text-white';
331
+    }
332 332
 
333
-	/**
333
+    /**
334 334
      * Retrieves the invoice status label html
335 335
      *
336 336
      * @since  1.0.0
@@ -338,263 +338,263 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function get_status_label_html() {
340 340
 
341
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
342
-		$status       = sanitize_html_class( $this->get_status() );
343
-		$class        = esc_attr( $this->get_status_class() );
344
-
345
-		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
346
-	}
347
-
348
-    /**
349
-	 * Get plugin version when the invoice was created.
350
-	 *
351
-	 * @since 1.0.19
352
-	 * @param  string $context View or edit context.
353
-	 * @return string
354
-	 */
355
-	public function get_version( $context = 'view' ) {
356
-		return $this->get_prop( 'version', $context );
357
-	}
358
-
359
-	/**
360
-	 * @deprecated
361
-	 */
362
-	public function get_invoice_date( $format = true ) {
363
-		$date      = getpaid_format_date( $this->get_date_completed() );
364
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
365
-		$formatted = getpaid_format_date( $date );
366
-
367
-		if ( $format ) {
368
-			return $formatted;
369
-		}
370
-
371
-		return empty( $formatted ) ? '' : $date;
372
-
373
-    }
374
-
375
-    /**
376
-	 * Get date when the invoice was created.
377
-	 *
378
-	 * @since 1.0.19
379
-	 * @param  string $context View or edit context.
380
-	 * @return string
381
-	 */
382
-	public function get_date_created( $context = 'view' ) {
383
-		return $this->get_prop( 'date_created', $context );
384
-	}
385
-
386
-	/**
387
-	 * Alias for self::get_date_created().
388
-	 *
389
-	 * @since 1.0.19
390
-	 * @param  string $context View or edit context.
391
-	 * @return string
392
-	 */
393
-	public function get_created_date( $context = 'view' ) {
394
-		return $this->get_date_created( $context );
395
-    }
396
-
397
-    /**
398
-	 * Get GMT date when the invoice was created.
399
-	 *
400
-	 * @since 1.0.19
401
-	 * @param  string $context View or edit context.
402
-	 * @return string
403
-	 */
404
-	public function get_date_created_gmt( $context = 'view' ) {
341
+        $status_label = sanitize_text_field( $this->get_status_nicename() );
342
+        $status       = sanitize_html_class( $this->get_status() );
343
+        $class        = esc_attr( $this->get_status_class() );
344
+
345
+        return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
346
+    }
347
+
348
+    /**
349
+     * Get plugin version when the invoice was created.
350
+     *
351
+     * @since 1.0.19
352
+     * @param  string $context View or edit context.
353
+     * @return string
354
+     */
355
+    public function get_version( $context = 'view' ) {
356
+        return $this->get_prop( 'version', $context );
357
+    }
358
+
359
+    /**
360
+     * @deprecated
361
+     */
362
+    public function get_invoice_date( $format = true ) {
363
+        $date      = getpaid_format_date( $this->get_date_completed() );
364
+        $date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
365
+        $formatted = getpaid_format_date( $date );
366
+
367
+        if ( $format ) {
368
+            return $formatted;
369
+        }
370
+
371
+        return empty( $formatted ) ? '' : $date;
372
+
373
+    }
374
+
375
+    /**
376
+     * Get date when the invoice was created.
377
+     *
378
+     * @since 1.0.19
379
+     * @param  string $context View or edit context.
380
+     * @return string
381
+     */
382
+    public function get_date_created( $context = 'view' ) {
383
+        return $this->get_prop( 'date_created', $context );
384
+    }
385
+
386
+    /**
387
+     * Alias for self::get_date_created().
388
+     *
389
+     * @since 1.0.19
390
+     * @param  string $context View or edit context.
391
+     * @return string
392
+     */
393
+    public function get_created_date( $context = 'view' ) {
394
+        return $this->get_date_created( $context );
395
+    }
396
+
397
+    /**
398
+     * Get GMT date when the invoice was created.
399
+     *
400
+     * @since 1.0.19
401
+     * @param  string $context View or edit context.
402
+     * @return string
403
+     */
404
+    public function get_date_created_gmt( $context = 'view' ) {
405 405
         $date = $this->get_date_created( $context );
406 406
 
407 407
         if ( $date ) {
408 408
             $date = get_gmt_from_date( $date );
409 409
         }
410
-		return $date;
411
-    }
412
-
413
-    /**
414
-	 * Get date when the invoice was last modified.
415
-	 *
416
-	 * @since 1.0.19
417
-	 * @param  string $context View or edit context.
418
-	 * @return string
419
-	 */
420
-	public function get_date_modified( $context = 'view' ) {
421
-		return $this->get_prop( 'date_modified', $context );
422
-	}
423
-
424
-	/**
425
-	 * Alias for self::get_date_modified().
426
-	 *
427
-	 * @since 1.0.19
428
-	 * @param  string $context View or edit context.
429
-	 * @return string
430
-	 */
431
-	public function get_modified_date( $context = 'view' ) {
432
-		return $this->get_date_modified( $context );
433
-    }
434
-
435
-    /**
436
-	 * Get GMT date when the invoice was last modified.
437
-	 *
438
-	 * @since 1.0.19
439
-	 * @param  string $context View or edit context.
440
-	 * @return string
441
-	 */
442
-	public function get_date_modified_gmt( $context = 'view' ) {
410
+        return $date;
411
+    }
412
+
413
+    /**
414
+     * Get date when the invoice was last modified.
415
+     *
416
+     * @since 1.0.19
417
+     * @param  string $context View or edit context.
418
+     * @return string
419
+     */
420
+    public function get_date_modified( $context = 'view' ) {
421
+        return $this->get_prop( 'date_modified', $context );
422
+    }
423
+
424
+    /**
425
+     * Alias for self::get_date_modified().
426
+     *
427
+     * @since 1.0.19
428
+     * @param  string $context View or edit context.
429
+     * @return string
430
+     */
431
+    public function get_modified_date( $context = 'view' ) {
432
+        return $this->get_date_modified( $context );
433
+    }
434
+
435
+    /**
436
+     * Get GMT date when the invoice was last modified.
437
+     *
438
+     * @since 1.0.19
439
+     * @param  string $context View or edit context.
440
+     * @return string
441
+     */
442
+    public function get_date_modified_gmt( $context = 'view' ) {
443 443
         $date = $this->get_date_modified( $context );
444 444
 
445 445
         if ( $date ) {
446 446
             $date = get_gmt_from_date( $date );
447 447
         }
448
-		return $date;
448
+        return $date;
449 449
     }
450 450
 
451 451
     /**
452
-	 * Get the invoice due date.
453
-	 *
454
-	 * @since 1.0.19
455
-	 * @param  string $context View or edit context.
456
-	 * @return string
457
-	 */
458
-	public function get_due_date( $context = 'view' ) {
459
-		return $this->get_prop( 'due_date', $context );
452
+     * Get the invoice due date.
453
+     *
454
+     * @since 1.0.19
455
+     * @param  string $context View or edit context.
456
+     * @return string
457
+     */
458
+    public function get_due_date( $context = 'view' ) {
459
+        return $this->get_prop( 'due_date', $context );
460 460
     }
461 461
 
462 462
     /**
463
-	 * Alias for self::get_due_date().
464
-	 *
465
-	 * @since 1.0.19
466
-	 * @param  string $context View or edit context.
467
-	 * @return string
468
-	 */
469
-	public function get_date_due( $context = 'view' ) {
470
-		return $this->get_due_date( $context );
463
+     * Alias for self::get_due_date().
464
+     *
465
+     * @since 1.0.19
466
+     * @param  string $context View or edit context.
467
+     * @return string
468
+     */
469
+    public function get_date_due( $context = 'view' ) {
470
+        return $this->get_due_date( $context );
471 471
     }
472 472
 
473 473
     /**
474
-	 * Get the invoice GMT due date.
475
-	 *
476
-	 * @since 1.0.19
477
-	 * @param  string $context View or edit context.
478
-	 * @return string
479
-	 */
480
-	public function get_due_date_gmt( $context = 'view' ) {
474
+     * Get the invoice GMT due date.
475
+     *
476
+     * @since 1.0.19
477
+     * @param  string $context View or edit context.
478
+     * @return string
479
+     */
480
+    public function get_due_date_gmt( $context = 'view' ) {
481 481
         $date = $this->get_due_date( $context );
482 482
 
483 483
         if ( $date ) {
484 484
             $date = get_gmt_from_date( $date );
485 485
         }
486
-		return $date;
486
+        return $date;
487 487
     }
488 488
 
489 489
     /**
490
-	 * Alias for self::get_due_date_gmt().
491
-	 *
492
-	 * @since 1.0.19
493
-	 * @param  string $context View or edit context.
494
-	 * @return string
495
-	 */
496
-	public function get_gmt_date_due( $context = 'view' ) {
497
-		return $this->get_due_date_gmt( $context );
490
+     * Alias for self::get_due_date_gmt().
491
+     *
492
+     * @since 1.0.19
493
+     * @param  string $context View or edit context.
494
+     * @return string
495
+     */
496
+    public function get_gmt_date_due( $context = 'view' ) {
497
+        return $this->get_due_date_gmt( $context );
498 498
     }
499 499
 
500 500
     /**
501
-	 * Get date when the invoice was completed.
502
-	 *
503
-	 * @since 1.0.19
504
-	 * @param  string $context View or edit context.
505
-	 * @return string
506
-	 */
507
-	public function get_completed_date( $context = 'view' ) {
508
-		return $this->get_prop( 'completed_date', $context );
501
+     * Get date when the invoice was completed.
502
+     *
503
+     * @since 1.0.19
504
+     * @param  string $context View or edit context.
505
+     * @return string
506
+     */
507
+    public function get_completed_date( $context = 'view' ) {
508
+        return $this->get_prop( 'completed_date', $context );
509 509
     }
510 510
 
511 511
     /**
512
-	 * Alias for self::get_completed_date().
513
-	 *
514
-	 * @since 1.0.19
515
-	 * @param  string $context View or edit context.
516
-	 * @return string
517
-	 */
518
-	public function get_date_completed( $context = 'view' ) {
519
-		return $this->get_completed_date( $context );
512
+     * Alias for self::get_completed_date().
513
+     *
514
+     * @since 1.0.19
515
+     * @param  string $context View or edit context.
516
+     * @return string
517
+     */
518
+    public function get_date_completed( $context = 'view' ) {
519
+        return $this->get_completed_date( $context );
520 520
     }
521 521
 
522 522
     /**
523
-	 * Get GMT date when the invoice was was completed.
524
-	 *
525
-	 * @since 1.0.19
526
-	 * @param  string $context View or edit context.
527
-	 * @return string
528
-	 */
529
-	public function get_completed_date_gmt( $context = 'view' ) {
523
+     * Get GMT date when the invoice was was completed.
524
+     *
525
+     * @since 1.0.19
526
+     * @param  string $context View or edit context.
527
+     * @return string
528
+     */
529
+    public function get_completed_date_gmt( $context = 'view' ) {
530 530
         $date = $this->get_completed_date( $context );
531 531
 
532 532
         if ( $date ) {
533 533
             $date = get_gmt_from_date( $date );
534 534
         }
535
-		return $date;
535
+        return $date;
536 536
     }
537 537
 
538 538
     /**
539
-	 * Alias for self::get_completed_date_gmt().
540
-	 *
541
-	 * @since 1.0.19
542
-	 * @param  string $context View or edit context.
543
-	 * @return string
544
-	 */
545
-	public function get_gmt_completed_date( $context = 'view' ) {
546
-		return $this->get_completed_date_gmt( $context );
539
+     * Alias for self::get_completed_date_gmt().
540
+     *
541
+     * @since 1.0.19
542
+     * @param  string $context View or edit context.
543
+     * @return string
544
+     */
545
+    public function get_gmt_completed_date( $context = 'view' ) {
546
+        return $this->get_completed_date_gmt( $context );
547 547
     }
548 548
 
549 549
     /**
550
-	 * Get the invoice number.
551
-	 *
552
-	 * @since 1.0.19
553
-	 * @param  string $context View or edit context.
554
-	 * @return string
555
-	 */
556
-	public function get_number( $context = 'view' ) {
557
-		$number = $this->get_prop( 'number', $context );
550
+     * Get the invoice number.
551
+     *
552
+     * @since 1.0.19
553
+     * @param  string $context View or edit context.
554
+     * @return string
555
+     */
556
+    public function get_number( $context = 'view' ) {
557
+        $number = $this->get_prop( 'number', $context );
558 558
 
559
-		if ( empty( $number ) ) {
560
-			$number = $this->generate_number();
561
-			$this->set_number( $this->generate_number() );
562
-		}
559
+        if ( empty( $number ) ) {
560
+            $number = $this->generate_number();
561
+            $this->set_number( $this->generate_number() );
562
+        }
563 563
 
564
-		return $number;
564
+        return $number;
565 565
     }
566 566
 
567
-	/**
568
-	 * Set the invoice number.
569
-	 *
570
-	 * @since 1.0.19
571
-	 */
572
-	public function maybe_set_number() {
567
+    /**
568
+     * Set the invoice number.
569
+     *
570
+     * @since 1.0.19
571
+     */
572
+    public function maybe_set_number() {
573 573
         $number = $this->get_number();
574 574
 
575 575
         if ( empty( $number ) || $this->get_id() == $number ) {
576
-			$this->set_number( $this->generate_number() );
576
+            $this->set_number( $this->generate_number() );
577 577
         }
578 578
 
579
-	}
579
+    }
580 580
 
581 581
     /**
582
-	 * Get the invoice key.
583
-	 *
584
-	 * @since 1.0.19
585
-	 * @param  string $context View or edit context.
586
-	 * @return string
587
-	 */
588
-	public function get_key( $context = 'view' ) {
582
+     * Get the invoice key.
583
+     *
584
+     * @since 1.0.19
585
+     * @param  string $context View or edit context.
586
+     * @return string
587
+     */
588
+    public function get_key( $context = 'view' ) {
589 589
         return $this->get_prop( 'key', $context );
590
-	}
591
-
592
-	/**
593
-	 * Set the invoice key.
594
-	 *
595
-	 * @since 1.0.19
596
-	 */
597
-	public function maybe_set_key() {
590
+    }
591
+
592
+    /**
593
+     * Set the invoice key.
594
+     *
595
+     * @since 1.0.19
596
+     */
597
+    public function maybe_set_key() {
598 598
         $key = $this->get_key();
599 599
 
600 600
         if ( empty( $key ) ) {
@@ -605,140 +605,140 @@  discard block
 block discarded – undo
605 605
     }
606 606
 
607 607
     /**
608
-	 * Get the invoice type.
609
-	 *
610
-	 * @since 1.0.19
611
-	 * @param  string $context View or edit context.
612
-	 * @return string
613
-	 */
614
-	public function get_type( $context = 'view' ) {
608
+     * Get the invoice type.
609
+     *
610
+     * @since 1.0.19
611
+     * @param  string $context View or edit context.
612
+     * @return string
613
+     */
614
+    public function get_type( $context = 'view' ) {
615 615
         return $this->get_prop( 'type', $context );
616
-	}
617
-
618
-	/**
619
-	 * Returns the post type name.
620
-	 *
621
-	 * @since 1.0.19
622
-	 * @return string
623
-	 */
624
-	public function get_invoice_quote_type() {
616
+    }
617
+
618
+    /**
619
+     * Returns the post type name.
620
+     *
621
+     * @since 1.0.19
622
+     * @return string
623
+     */
624
+    public function get_invoice_quote_type() {
625 625
         return getpaid_get_post_type_label( $this->get_post_type(), false );
626 626
     }
627 627
 
628 628
     /**
629
-	 * Get the invoice post type label.
630
-	 *
631
-	 * @since 1.0.19
632
-	 * @param  string $context View or edit context.
633
-	 * @return string
634
-	 */
635
-	public function get_label( $context = 'view' ) {
629
+     * Get the invoice post type label.
630
+     *
631
+     * @since 1.0.19
632
+     * @param  string $context View or edit context.
633
+     * @return string
634
+     */
635
+    public function get_label( $context = 'view' ) {
636 636
         return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
637
-	}
638
-
639
-	/**
640
-	 * Get the invoice post type.
641
-	 *
642
-	 * @since 1.0.19
643
-	 * @param  string $context View or edit context.
644
-	 * @return string
645
-	 */
646
-	public function get_post_type( $context = 'view' ) {
637
+    }
638
+
639
+    /**
640
+     * Get the invoice post type.
641
+     *
642
+     * @since 1.0.19
643
+     * @param  string $context View or edit context.
644
+     * @return string
645
+     */
646
+    public function get_post_type( $context = 'view' ) {
647 647
         return $this->get_prop( 'post_type', $context );
648 648
     }
649 649
 
650 650
     /**
651
-	 * Get the invoice mode.
652
-	 *
653
-	 * @since 1.0.19
654
-	 * @param  string $context View or edit context.
655
-	 * @return string
656
-	 */
657
-	public function get_mode( $context = 'view' ) {
651
+     * Get the invoice mode.
652
+     *
653
+     * @since 1.0.19
654
+     * @param  string $context View or edit context.
655
+     * @return string
656
+     */
657
+    public function get_mode( $context = 'view' ) {
658 658
         return $this->get_prop( 'mode', $context );
659 659
     }
660 660
 
661 661
     /**
662
-	 * Get the invoice path.
663
-	 *
664
-	 * @since 1.0.19
665
-	 * @param  string $context View or edit context.
666
-	 * @return string
667
-	 */
668
-	public function get_path( $context = 'view' ) {
662
+     * Get the invoice path.
663
+     *
664
+     * @since 1.0.19
665
+     * @param  string $context View or edit context.
666
+     * @return string
667
+     */
668
+    public function get_path( $context = 'view' ) {
669 669
         $path   = $this->get_prop( 'path', $context );
670
-		$prefix = $this->get_type();
670
+        $prefix = $this->get_type();
671 671
 
672
-		if ( 0 !== strpos( $path, $prefix ) ) {
673
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
674
-			$this->set_path( $path );
675
-		}
672
+        if ( 0 !== strpos( $path, $prefix ) ) {
673
+            $path = sanitize_title( $prefix . '-' . $this->get_id() );
674
+            $this->set_path( $path );
675
+        }
676 676
 
677
-		return $path;
677
+        return $path;
678 678
     }
679 679
 
680 680
     /**
681
-	 * Get the invoice name/title.
682
-	 *
683
-	 * @since 1.0.19
684
-	 * @param  string $context View or edit context.
685
-	 * @return string
686
-	 */
687
-	public function get_name( $context = 'view' ) {
681
+     * Get the invoice name/title.
682
+     *
683
+     * @since 1.0.19
684
+     * @param  string $context View or edit context.
685
+     * @return string
686
+     */
687
+    public function get_name( $context = 'view' ) {
688 688
         return $this->get_prop( 'title', $context );
689 689
     }
690 690
 
691 691
     /**
692
-	 * Alias of self::get_name().
693
-	 *
694
-	 * @since 1.0.19
695
-	 * @param  string $context View or edit context.
696
-	 * @return string
697
-	 */
698
-	public function get_title( $context = 'view' ) {
699
-		return $this->get_name( $context );
692
+     * Alias of self::get_name().
693
+     *
694
+     * @since 1.0.19
695
+     * @param  string $context View or edit context.
696
+     * @return string
697
+     */
698
+    public function get_title( $context = 'view' ) {
699
+        return $this->get_name( $context );
700 700
     }
701 701
 
702 702
     /**
703
-	 * Get the invoice description.
704
-	 *
705
-	 * @since 1.0.19
706
-	 * @param  string $context View or edit context.
707
-	 * @return string
708
-	 */
709
-	public function get_description( $context = 'view' ) {
710
-		return $this->get_prop( 'description', $context );
703
+     * Get the invoice description.
704
+     *
705
+     * @since 1.0.19
706
+     * @param  string $context View or edit context.
707
+     * @return string
708
+     */
709
+    public function get_description( $context = 'view' ) {
710
+        return $this->get_prop( 'description', $context );
711 711
     }
712 712
 
713 713
     /**
714
-	 * Alias of self::get_description().
715
-	 *
716
-	 * @since 1.0.19
717
-	 * @param  string $context View or edit context.
718
-	 * @return string
719
-	 */
720
-	public function get_excerpt( $context = 'view' ) {
721
-		return $this->get_description( $context );
714
+     * Alias of self::get_description().
715
+     *
716
+     * @since 1.0.19
717
+     * @param  string $context View or edit context.
718
+     * @return string
719
+     */
720
+    public function get_excerpt( $context = 'view' ) {
721
+        return $this->get_description( $context );
722 722
     }
723 723
 
724 724
     /**
725
-	 * Alias of self::get_description().
726
-	 *
727
-	 * @since 1.0.19
728
-	 * @param  string $context View or edit context.
729
-	 * @return string
730
-	 */
731
-	public function get_summary( $context = 'view' ) {
732
-		return $this->get_description( $context );
725
+     * Alias of self::get_description().
726
+     *
727
+     * @since 1.0.19
728
+     * @param  string $context View or edit context.
729
+     * @return string
730
+     */
731
+    public function get_summary( $context = 'view' ) {
732
+        return $this->get_description( $context );
733 733
     }
734 734
 
735 735
     /**
736
-	 * Returns the user info.
737
-	 *
738
-	 * @since 1.0.19
736
+     * Returns the user info.
737
+     *
738
+     * @since 1.0.19
739 739
      * @param  string $context View or edit context.
740
-	 * @return array
741
-	 */
740
+     * @return array
741
+     */
742 742
     public function get_user_info( $context = 'view' ) {
743 743
 
744 744
         $user_info = array(
@@ -753,683 +753,683 @@  discard block
 block discarded – undo
753 753
             'state'      => $this->get_state( $context ),
754 754
             'zip'        => $this->get_zip( $context ),
755 755
             'company'    => $this->get_company( $context ),
756
-			'company_id' => $this->get_company_id( $context ),
756
+            'company_id' => $this->get_company_id( $context ),
757 757
             'vat_number' => $this->get_vat_number( $context ),
758 758
             'discount'   => $this->get_discount_code( $context ),
759
-		);
759
+        );
760 760
 
761
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
761
+        return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
762 762
 
763 763
     }
764 764
 
765 765
     /**
766
-	 * Get the user id.
767
-	 *
768
-	 * @since 1.0.19
769
-	 * @param  string $context View or edit context.
770
-	 * @return int
771
-	 */
772
-	public function get_author( $context = 'view' ) {
773
-		return (int) $this->get_prop( 'author', $context );
766
+     * Get the user id.
767
+     *
768
+     * @since 1.0.19
769
+     * @param  string $context View or edit context.
770
+     * @return int
771
+     */
772
+    public function get_author( $context = 'view' ) {
773
+        return (int) $this->get_prop( 'author', $context );
774 774
     }
775 775
 
776 776
     /**
777
-	 * Alias of self::get_author().
778
-	 *
779
-	 * @since 1.0.19
780
-	 * @param  string $context View or edit context.
781
-	 * @return int
782
-	 */
783
-	public function get_user_id( $context = 'view' ) {
784
-		return $this->get_author( $context );
777
+     * Alias of self::get_author().
778
+     *
779
+     * @since 1.0.19
780
+     * @param  string $context View or edit context.
781
+     * @return int
782
+     */
783
+    public function get_user_id( $context = 'view' ) {
784
+        return $this->get_author( $context );
785 785
     }
786 786
 
787
-     /**
788
-	 * Get customer ID.
789
-	 *
790
-	 * @since 1.0.19
791
-	 * @param  string $context View or edit context.
792
-	 * @return int
793
-	 */
794
-	public function get_customer_id( $context = 'view' ) {
795
-		return (int) $this->get_prop( 'customer_id', $context );
787
+        /**
788
+         * Get customer ID.
789
+         *
790
+         * @since 1.0.19
791
+         * @param  string $context View or edit context.
792
+         * @return int
793
+         */
794
+    public function get_customer_id( $context = 'view' ) {
795
+        return (int) $this->get_prop( 'customer_id', $context );
796 796
     }
797 797
 
798 798
     /**
799
-	 * Get the customer's ip.
800
-	 *
801
-	 * @since 1.0.19
802
-	 * @param  string $context View or edit context.
803
-	 * @return string
804
-	 */
805
-	public function get_ip( $context = 'view' ) {
806
-		return $this->get_prop( 'user_ip', $context );
799
+     * Get the customer's ip.
800
+     *
801
+     * @since 1.0.19
802
+     * @param  string $context View or edit context.
803
+     * @return string
804
+     */
805
+    public function get_ip( $context = 'view' ) {
806
+        return $this->get_prop( 'user_ip', $context );
807 807
     }
808 808
 
809 809
     /**
810
-	 * Alias of self::get_ip().
811
-	 *
812
-	 * @since 1.0.19
813
-	 * @param  string $context View or edit context.
814
-	 * @return string
815
-	 */
816
-	public function get_user_ip( $context = 'view' ) {
817
-		return $this->get_ip( $context );
810
+     * Alias of self::get_ip().
811
+     *
812
+     * @since 1.0.19
813
+     * @param  string $context View or edit context.
814
+     * @return string
815
+     */
816
+    public function get_user_ip( $context = 'view' ) {
817
+        return $this->get_ip( $context );
818 818
     }
819 819
 
820
-     /**
821
-	 * Alias of self::get_ip().
822
-	 *
823
-	 * @since 1.0.19
824
-	 * @param  string $context View or edit context.
825
-	 * @return string
826
-	 */
827
-	public function get_customer_ip( $context = 'view' ) {
828
-		return $this->get_ip( $context );
820
+        /**
821
+         * Alias of self::get_ip().
822
+         *
823
+         * @since 1.0.19
824
+         * @param  string $context View or edit context.
825
+         * @return string
826
+         */
827
+    public function get_customer_ip( $context = 'view' ) {
828
+        return $this->get_ip( $context );
829 829
     }
830 830
 
831 831
     /**
832
-	 * Get the customer's first name.
833
-	 *
834
-	 * @since 1.0.19
835
-	 * @param  string $context View or edit context.
836
-	 * @return string
837
-	 */
838
-	public function get_first_name( $context = 'view' ) {
839
-		return $this->get_prop( 'first_name', $context );
832
+     * Get the customer's first name.
833
+     *
834
+     * @since 1.0.19
835
+     * @param  string $context View or edit context.
836
+     * @return string
837
+     */
838
+    public function get_first_name( $context = 'view' ) {
839
+        return $this->get_prop( 'first_name', $context );
840 840
     }
841 841
 
842 842
     /**
843
-	 * Alias of self::get_first_name().
844
-	 *
845
-	 * @since 1.0.19
846
-	 * @param  string $context View or edit context.
847
-	 * @return string
848
-	 */
849
-	public function get_user_first_name( $context = 'view' ) {
850
-		return $this->get_first_name( $context );
843
+     * Alias of self::get_first_name().
844
+     *
845
+     * @since 1.0.19
846
+     * @param  string $context View or edit context.
847
+     * @return string
848
+     */
849
+    public function get_user_first_name( $context = 'view' ) {
850
+        return $this->get_first_name( $context );
851 851
     }
852 852
 
853
-     /**
854
-	 * Alias of self::get_first_name().
855
-	 *
856
-	 * @since 1.0.19
857
-	 * @param  string $context View or edit context.
858
-	 * @return string
859
-	 */
860
-	public function get_customer_first_name( $context = 'view' ) {
861
-		return $this->get_first_name( $context );
853
+        /**
854
+         * Alias of self::get_first_name().
855
+         *
856
+         * @since 1.0.19
857
+         * @param  string $context View or edit context.
858
+         * @return string
859
+         */
860
+    public function get_customer_first_name( $context = 'view' ) {
861
+        return $this->get_first_name( $context );
862 862
     }
863 863
 
864 864
     /**
865
-	 * Get the customer's last name.
866
-	 *
867
-	 * @since 1.0.19
868
-	 * @param  string $context View or edit context.
869
-	 * @return string
870
-	 */
871
-	public function get_last_name( $context = 'view' ) {
872
-		return $this->get_prop( 'last_name', $context );
865
+     * Get the customer's last name.
866
+     *
867
+     * @since 1.0.19
868
+     * @param  string $context View or edit context.
869
+     * @return string
870
+     */
871
+    public function get_last_name( $context = 'view' ) {
872
+        return $this->get_prop( 'last_name', $context );
873 873
     }
874 874
 
875 875
     /**
876
-	 * Alias of self::get_last_name().
877
-	 *
878
-	 * @since 1.0.19
879
-	 * @param  string $context View or edit context.
880
-	 * @return string
881
-	 */
882
-	public function get_user_last_name( $context = 'view' ) {
883
-		return $this->get_last_name( $context );
876
+     * Alias of self::get_last_name().
877
+     *
878
+     * @since 1.0.19
879
+     * @param  string $context View or edit context.
880
+     * @return string
881
+     */
882
+    public function get_user_last_name( $context = 'view' ) {
883
+        return $this->get_last_name( $context );
884 884
     }
885 885
 
886 886
     /**
887
-	 * Alias of self::get_last_name().
888
-	 *
889
-	 * @since 1.0.19
890
-	 * @param  string $context View or edit context.
891
-	 * @return string
892
-	 */
893
-	public function get_customer_last_name( $context = 'view' ) {
894
-		return $this->get_last_name( $context );
887
+     * Alias of self::get_last_name().
888
+     *
889
+     * @since 1.0.19
890
+     * @param  string $context View or edit context.
891
+     * @return string
892
+     */
893
+    public function get_customer_last_name( $context = 'view' ) {
894
+        return $this->get_last_name( $context );
895 895
     }
896 896
 
897 897
     /**
898
-	 * Get the customer's full name.
899
-	 *
900
-	 * @since 1.0.19
901
-	 * @param  string $context View or edit context.
902
-	 * @return string
903
-	 */
904
-	public function get_full_name( $context = 'view' ) {
905
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
898
+     * Get the customer's full name.
899
+     *
900
+     * @since 1.0.19
901
+     * @param  string $context View or edit context.
902
+     * @return string
903
+     */
904
+    public function get_full_name( $context = 'view' ) {
905
+        $name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
906 906
 
907
-		if ( ! $name ) {
908
-			$user = get_userdata( $this->get_author( $context ) );
907
+        if ( ! $name ) {
908
+            $user = get_userdata( $this->get_author( $context ) );
909 909
 
910
-			if ( $user ) {
911
-				$name = $user->display_name;
912
-			}
913
-		}
910
+            if ( $user ) {
911
+                $name = $user->display_name;
912
+            }
913
+        }
914 914
 
915
-		if ( ! $name ) {
916
-			$name = $this->get_email( $context );
917
-		}
915
+        if ( ! $name ) {
916
+            $name = $this->get_email( $context );
917
+        }
918 918
 
919
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
919
+        return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
920 920
     }
921 921
 
922 922
     /**
923
-	 * Alias of self::get_full_name().
924
-	 *
925
-	 * @since 1.0.19
926
-	 * @param  string $context View or edit context.
927
-	 * @return string
928
-	 */
929
-	public function get_user_full_name( $context = 'view' ) {
930
-		return $this->get_full_name( $context );
931
-    }
923
+     * Alias of self::get_full_name().
924
+     *
925
+     * @since 1.0.19
926
+     * @param  string $context View or edit context.
927
+     * @return string
928
+     */
929
+    public function get_user_full_name( $context = 'view' ) {
930
+        return $this->get_full_name( $context );
931
+    }
932
+
933
+    /**
934
+     * Alias of self::get_full_name().
935
+     *
936
+     * @since 1.0.19
937
+     * @param  string $context View or edit context.
938
+     * @return string
939
+     */
940
+    public function get_customer_full_name( $context = 'view' ) {
941
+        return $this->get_full_name( $context );
942
+    }
943
+
944
+    /**
945
+     * Get the customer's phone number.
946
+     *
947
+     * @since 1.0.19
948
+     * @param  string $context View or edit context.
949
+     * @return string
950
+     */
951
+    public function get_phone( $context = 'view' ) {
952
+        return $this->get_prop( 'phone', $context );
953
+    }
954
+
955
+    /**
956
+     * Alias of self::get_phone().
957
+     *
958
+     * @since 1.0.19
959
+     * @param  string $context View or edit context.
960
+     * @return string
961
+     */
962
+    public function get_phone_number( $context = 'view' ) {
963
+        return $this->get_phone( $context );
964
+    }
965
+
966
+    /**
967
+     * Alias of self::get_phone().
968
+     *
969
+     * @since 1.0.19
970
+     * @param  string $context View or edit context.
971
+     * @return string
972
+     */
973
+    public function get_user_phone( $context = 'view' ) {
974
+        return $this->get_phone( $context );
975
+    }
976
+
977
+    /**
978
+     * Alias of self::get_phone().
979
+     *
980
+     * @since 1.0.19
981
+     * @param  string $context View or edit context.
982
+     * @return string
983
+     */
984
+    public function get_customer_phone( $context = 'view' ) {
985
+        return $this->get_phone( $context );
986
+    }
987
+
988
+    /**
989
+     * Get the customer's email address.
990
+     *
991
+     * @since 1.0.19
992
+     * @param  string $context View or edit context.
993
+     * @return string
994
+     */
995
+    public function get_email( $context = 'view' ) {
996
+        return $this->get_prop( 'email', $context );
997
+    }
932 998
 
933 999
     /**
934
-	 * Alias of self::get_full_name().
935
-	 *
936
-	 * @since 1.0.19
937
-	 * @param  string $context View or edit context.
938
-	 * @return string
939
-	 */
940
-	public function get_customer_full_name( $context = 'view' ) {
941
-		return $this->get_full_name( $context );
1000
+     * Alias of self::get_email().
1001
+     *
1002
+     * @since 1.0.19
1003
+     * @param  string $context View or edit context.
1004
+     * @return string
1005
+     */
1006
+    public function get_email_address( $context = 'view' ) {
1007
+        return $this->get_email( $context );
1008
+    }
1009
+
1010
+    /**
1011
+     * Alias of self::get_email().
1012
+     *
1013
+     * @since 1.0.19
1014
+     * @param  string $context View or edit context.
1015
+     * @return string
1016
+     */
1017
+    public function get_user_email( $context = 'view' ) {
1018
+        return $this->get_email( $context );
942 1019
     }
943 1020
 
944 1021
     /**
945
-	 * Get the customer's phone number.
946
-	 *
947
-	 * @since 1.0.19
948
-	 * @param  string $context View or edit context.
949
-	 * @return string
950
-	 */
951
-	public function get_phone( $context = 'view' ) {
952
-		return $this->get_prop( 'phone', $context );
1022
+     * Alias of self::get_email().
1023
+     *
1024
+     * @since 1.0.19
1025
+     * @param  string $context View or edit context.
1026
+     * @return string
1027
+     */
1028
+    public function get_customer_email( $context = 'view' ) {
1029
+        return $this->get_email( $context );
953 1030
     }
954 1031
 
955 1032
     /**
956
-	 * Alias of self::get_phone().
957
-	 *
958
-	 * @since 1.0.19
959
-	 * @param  string $context View or edit context.
960
-	 * @return string
961
-	 */
962
-	public function get_phone_number( $context = 'view' ) {
963
-		return $this->get_phone( $context );
1033
+     * Get the customer's country.
1034
+     *
1035
+     * @since 1.0.19
1036
+     * @param  string $context View or edit context.
1037
+     * @return string
1038
+     */
1039
+    public function get_country( $context = 'view' ) {
1040
+        $country = $this->get_prop( 'country', $context );
1041
+        return empty( $country ) ? wpinv_get_default_country() : $country;
964 1042
     }
965 1043
 
966 1044
     /**
967
-	 * Alias of self::get_phone().
968
-	 *
969
-	 * @since 1.0.19
970
-	 * @param  string $context View or edit context.
971
-	 * @return string
972
-	 */
973
-	public function get_user_phone( $context = 'view' ) {
974
-		return $this->get_phone( $context );
1045
+     * Alias of self::get_country().
1046
+     *
1047
+     * @since 1.0.19
1048
+     * @param  string $context View or edit context.
1049
+     * @return string
1050
+     */
1051
+    public function get_user_country( $context = 'view' ) {
1052
+        return $this->get_country( $context );
975 1053
     }
976 1054
 
977 1055
     /**
978
-	 * Alias of self::get_phone().
979
-	 *
980
-	 * @since 1.0.19
981
-	 * @param  string $context View or edit context.
982
-	 * @return string
983
-	 */
984
-	public function get_customer_phone( $context = 'view' ) {
985
-		return $this->get_phone( $context );
1056
+     * Alias of self::get_country().
1057
+     *
1058
+     * @since 1.0.19
1059
+     * @param  string $context View or edit context.
1060
+     * @return string
1061
+     */
1062
+    public function get_customer_country( $context = 'view' ) {
1063
+        return $this->get_country( $context );
1064
+    }
1065
+
1066
+    /**
1067
+     * Get the customer's state.
1068
+     *
1069
+     * @since 1.0.19
1070
+     * @param  string $context View or edit context.
1071
+     * @return string
1072
+     */
1073
+    public function get_state( $context = 'view' ) {
1074
+        $state = $this->get_prop( 'state', $context );
1075
+        return empty( $state ) ? wpinv_get_default_state() : $state;
1076
+    }
1077
+
1078
+    /**
1079
+     * Alias of self::get_state().
1080
+     *
1081
+     * @since 1.0.19
1082
+     * @param  string $context View or edit context.
1083
+     * @return string
1084
+     */
1085
+    public function get_user_state( $context = 'view' ) {
1086
+        return $this->get_state( $context );
1087
+    }
1088
+
1089
+    /**
1090
+     * Alias of self::get_state().
1091
+     *
1092
+     * @since 1.0.19
1093
+     * @param  string $context View or edit context.
1094
+     * @return string
1095
+     */
1096
+    public function get_customer_state( $context = 'view' ) {
1097
+        return $this->get_state( $context );
986 1098
     }
987 1099
 
988 1100
     /**
989
-	 * Get the customer's email address.
990
-	 *
991
-	 * @since 1.0.19
992
-	 * @param  string $context View or edit context.
993
-	 * @return string
994
-	 */
995
-	public function get_email( $context = 'view' ) {
996
-		return $this->get_prop( 'email', $context );
1101
+     * Get the customer's city.
1102
+     *
1103
+     * @since 1.0.19
1104
+     * @param  string $context View or edit context.
1105
+     * @return string
1106
+     */
1107
+    public function get_city( $context = 'view' ) {
1108
+        return $this->get_prop( 'city', $context );
997 1109
     }
998 1110
 
999 1111
     /**
1000
-	 * Alias of self::get_email().
1001
-	 *
1002
-	 * @since 1.0.19
1003
-	 * @param  string $context View or edit context.
1004
-	 * @return string
1005
-	 */
1006
-	public function get_email_address( $context = 'view' ) {
1007
-		return $this->get_email( $context );
1112
+     * Alias of self::get_city().
1113
+     *
1114
+     * @since 1.0.19
1115
+     * @param  string $context View or edit context.
1116
+     * @return string
1117
+     */
1118
+    public function get_user_city( $context = 'view' ) {
1119
+        return $this->get_city( $context );
1008 1120
     }
1009 1121
 
1010 1122
     /**
1011
-	 * Alias of self::get_email().
1012
-	 *
1013
-	 * @since 1.0.19
1014
-	 * @param  string $context View or edit context.
1015
-	 * @return string
1016
-	 */
1017
-	public function get_user_email( $context = 'view' ) {
1018
-		return $this->get_email( $context );
1123
+     * Alias of self::get_city().
1124
+     *
1125
+     * @since 1.0.19
1126
+     * @param  string $context View or edit context.
1127
+     * @return string
1128
+     */
1129
+    public function get_customer_city( $context = 'view' ) {
1130
+        return $this->get_city( $context );
1019 1131
     }
1020 1132
 
1021 1133
     /**
1022
-	 * Alias of self::get_email().
1023
-	 *
1024
-	 * @since 1.0.19
1025
-	 * @param  string $context View or edit context.
1026
-	 * @return string
1027
-	 */
1028
-	public function get_customer_email( $context = 'view' ) {
1029
-		return $this->get_email( $context );
1134
+     * Get the customer's zip.
1135
+     *
1136
+     * @since 1.0.19
1137
+     * @param  string $context View or edit context.
1138
+     * @return string
1139
+     */
1140
+    public function get_zip( $context = 'view' ) {
1141
+        return $this->get_prop( 'zip', $context );
1030 1142
     }
1031 1143
 
1032 1144
     /**
1033
-	 * Get the customer's country.
1034
-	 *
1035
-	 * @since 1.0.19
1036
-	 * @param  string $context View or edit context.
1037
-	 * @return string
1038
-	 */
1039
-	public function get_country( $context = 'view' ) {
1040
-		$country = $this->get_prop( 'country', $context );
1041
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1145
+     * Alias of self::get_zip().
1146
+     *
1147
+     * @since 1.0.19
1148
+     * @param  string $context View or edit context.
1149
+     * @return string
1150
+     */
1151
+    public function get_user_zip( $context = 'view' ) {
1152
+        return $this->get_zip( $context );
1042 1153
     }
1043 1154
 
1044 1155
     /**
1045
-	 * Alias of self::get_country().
1046
-	 *
1047
-	 * @since 1.0.19
1048
-	 * @param  string $context View or edit context.
1049
-	 * @return string
1050
-	 */
1051
-	public function get_user_country( $context = 'view' ) {
1052
-		return $this->get_country( $context );
1156
+     * Alias of self::get_zip().
1157
+     *
1158
+     * @since 1.0.19
1159
+     * @param  string $context View or edit context.
1160
+     * @return string
1161
+     */
1162
+    public function get_customer_zip( $context = 'view' ) {
1163
+        return $this->get_zip( $context );
1053 1164
     }
1054 1165
 
1055 1166
     /**
1056
-	 * Alias of self::get_country().
1057
-	 *
1058
-	 * @since 1.0.19
1059
-	 * @param  string $context View or edit context.
1060
-	 * @return string
1061
-	 */
1062
-	public function get_customer_country( $context = 'view' ) {
1063
-		return $this->get_country( $context );
1167
+     * Get the customer's company.
1168
+     *
1169
+     * @since 1.0.19
1170
+     * @param  string $context View or edit context.
1171
+     * @return string
1172
+     */
1173
+    public function get_company( $context = 'view' ) {
1174
+        return $this->get_prop( 'company', $context );
1064 1175
     }
1065 1176
 
1066 1177
     /**
1067
-	 * Get the customer's state.
1068
-	 *
1069
-	 * @since 1.0.19
1070
-	 * @param  string $context View or edit context.
1071
-	 * @return string
1072
-	 */
1073
-	public function get_state( $context = 'view' ) {
1074
-		$state = $this->get_prop( 'state', $context );
1075
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1178
+     * Alias of self::get_company().
1179
+     *
1180
+     * @since 1.0.19
1181
+     * @param  string $context View or edit context.
1182
+     * @return string
1183
+     */
1184
+    public function get_user_company( $context = 'view' ) {
1185
+        return $this->get_company( $context );
1076 1186
     }
1077 1187
 
1078 1188
     /**
1079
-	 * Alias of self::get_state().
1080
-	 *
1081
-	 * @since 1.0.19
1082
-	 * @param  string $context View or edit context.
1083
-	 * @return string
1084
-	 */
1085
-	public function get_user_state( $context = 'view' ) {
1086
-		return $this->get_state( $context );
1189
+     * Alias of self::get_company().
1190
+     *
1191
+     * @since 1.0.19
1192
+     * @param  string $context View or edit context.
1193
+     * @return string
1194
+     */
1195
+    public function get_customer_company( $context = 'view' ) {
1196
+        return $this->get_company( $context );
1087 1197
     }
1088 1198
 
1089 1199
     /**
1090
-	 * Alias of self::get_state().
1091
-	 *
1092
-	 * @since 1.0.19
1093
-	 * @param  string $context View or edit context.
1094
-	 * @return string
1095
-	 */
1096
-	public function get_customer_state( $context = 'view' ) {
1097
-		return $this->get_state( $context );
1200
+     * Get the customer's company id.
1201
+     *
1202
+     * @since 1.0.19
1203
+     * @param  string $context View or edit context.
1204
+     * @return string
1205
+     */
1206
+    public function get_company_id( $context = 'view' ) {
1207
+        return $this->get_prop( 'company_id', $context );
1098 1208
     }
1099 1209
 
1100 1210
     /**
1101
-	 * Get the customer's city.
1102
-	 *
1103
-	 * @since 1.0.19
1104
-	 * @param  string $context View or edit context.
1105
-	 * @return string
1106
-	 */
1107
-	public function get_city( $context = 'view' ) {
1108
-		return $this->get_prop( 'city', $context );
1211
+     * Get the customer's vat number.
1212
+     *
1213
+     * @since 1.0.19
1214
+     * @param  string $context View or edit context.
1215
+     * @return string
1216
+     */
1217
+    public function get_vat_number( $context = 'view' ) {
1218
+        return $this->get_prop( 'vat_number', $context );
1109 1219
     }
1110 1220
 
1111 1221
     /**
1112
-	 * Alias of self::get_city().
1113
-	 *
1114
-	 * @since 1.0.19
1115
-	 * @param  string $context View or edit context.
1116
-	 * @return string
1117
-	 */
1118
-	public function get_user_city( $context = 'view' ) {
1119
-		return $this->get_city( $context );
1222
+     * Alias of self::get_vat_number().
1223
+     *
1224
+     * @since 1.0.19
1225
+     * @param  string $context View or edit context.
1226
+     * @return string
1227
+     */
1228
+    public function get_user_vat_number( $context = 'view' ) {
1229
+        return $this->get_vat_number( $context );
1120 1230
     }
1121 1231
 
1122 1232
     /**
1123
-	 * Alias of self::get_city().
1124
-	 *
1125
-	 * @since 1.0.19
1126
-	 * @param  string $context View or edit context.
1127
-	 * @return string
1128
-	 */
1129
-	public function get_customer_city( $context = 'view' ) {
1130
-		return $this->get_city( $context );
1233
+     * Alias of self::get_vat_number().
1234
+     *
1235
+     * @since 1.0.19
1236
+     * @param  string $context View or edit context.
1237
+     * @return string
1238
+     */
1239
+    public function get_customer_vat_number( $context = 'view' ) {
1240
+        return $this->get_vat_number( $context );
1131 1241
     }
1132 1242
 
1133 1243
     /**
1134
-	 * Get the customer's zip.
1135
-	 *
1136
-	 * @since 1.0.19
1137
-	 * @param  string $context View or edit context.
1138
-	 * @return string
1139
-	 */
1140
-	public function get_zip( $context = 'view' ) {
1141
-		return $this->get_prop( 'zip', $context );
1244
+     * Get the customer's vat rate.
1245
+     *
1246
+     * @since 1.0.19
1247
+     * @param  string $context View or edit context.
1248
+     * @return string
1249
+     */
1250
+    public function get_vat_rate( $context = 'view' ) {
1251
+        return $this->get_prop( 'vat_rate', $context );
1142 1252
     }
1143 1253
 
1144 1254
     /**
1145
-	 * Alias of self::get_zip().
1146
-	 *
1147
-	 * @since 1.0.19
1148
-	 * @param  string $context View or edit context.
1149
-	 * @return string
1150
-	 */
1151
-	public function get_user_zip( $context = 'view' ) {
1152
-		return $this->get_zip( $context );
1255
+     * Alias of self::get_vat_rate().
1256
+     *
1257
+     * @since 1.0.19
1258
+     * @param  string $context View or edit context.
1259
+     * @return string
1260
+     */
1261
+    public function get_user_vat_rate( $context = 'view' ) {
1262
+        return $this->get_vat_rate( $context );
1153 1263
     }
1154 1264
 
1155 1265
     /**
1156
-	 * Alias of self::get_zip().
1157
-	 *
1158
-	 * @since 1.0.19
1159
-	 * @param  string $context View or edit context.
1160
-	 * @return string
1161
-	 */
1162
-	public function get_customer_zip( $context = 'view' ) {
1163
-		return $this->get_zip( $context );
1266
+     * Alias of self::get_vat_rate().
1267
+     *
1268
+     * @since 1.0.19
1269
+     * @param  string $context View or edit context.
1270
+     * @return string
1271
+     */
1272
+    public function get_customer_vat_rate( $context = 'view' ) {
1273
+        return $this->get_vat_rate( $context );
1164 1274
     }
1165 1275
 
1166 1276
     /**
1167
-	 * Get the customer's company.
1168
-	 *
1169
-	 * @since 1.0.19
1170
-	 * @param  string $context View or edit context.
1171
-	 * @return string
1172
-	 */
1173
-	public function get_company( $context = 'view' ) {
1174
-		return $this->get_prop( 'company', $context );
1277
+     * Get the customer's address.
1278
+     *
1279
+     * @since 1.0.19
1280
+     * @param  string $context View or edit context.
1281
+     * @return string
1282
+     */
1283
+    public function get_address( $context = 'view' ) {
1284
+        return $this->get_prop( 'address', $context );
1175 1285
     }
1176 1286
 
1177 1287
     /**
1178
-	 * Alias of self::get_company().
1179
-	 *
1180
-	 * @since 1.0.19
1181
-	 * @param  string $context View or edit context.
1182
-	 * @return string
1183
-	 */
1184
-	public function get_user_company( $context = 'view' ) {
1185
-		return $this->get_company( $context );
1288
+     * Alias of self::get_address().
1289
+     *
1290
+     * @since 1.0.19
1291
+     * @param  string $context View or edit context.
1292
+     * @return string
1293
+     */
1294
+    public function get_user_address( $context = 'view' ) {
1295
+        return $this->get_address( $context );
1186 1296
     }
1187 1297
 
1188 1298
     /**
1189
-	 * Alias of self::get_company().
1190
-	 *
1191
-	 * @since 1.0.19
1192
-	 * @param  string $context View or edit context.
1193
-	 * @return string
1194
-	 */
1195
-	public function get_customer_company( $context = 'view' ) {
1196
-		return $this->get_company( $context );
1299
+     * Alias of self::get_address().
1300
+     *
1301
+     * @since 1.0.19
1302
+     * @param  string $context View or edit context.
1303
+     * @return string
1304
+     */
1305
+    public function get_customer_address( $context = 'view' ) {
1306
+        return $this->get_address( $context );
1197 1307
     }
1198 1308
 
1199
-	/**
1200
-	 * Get the customer's company id.
1201
-	 *
1202
-	 * @since 1.0.19
1203
-	 * @param  string $context View or edit context.
1204
-	 * @return string
1205
-	 */
1206
-	public function get_company_id( $context = 'view' ) {
1207
-		return $this->get_prop( 'company_id', $context );
1309
+    /**
1310
+     * Get whether the customer has viewed the invoice or not.
1311
+     *
1312
+     * @since 1.0.19
1313
+     * @param  string $context View or edit context.
1314
+     * @return bool
1315
+     */
1316
+    public function get_is_viewed( $context = 'view' ) {
1317
+        return (bool) $this->get_prop( 'is_viewed', $context );
1208 1318
     }
1209 1319
 
1210 1320
     /**
1211
-	 * Get the customer's vat number.
1212
-	 *
1213
-	 * @since 1.0.19
1214
-	 * @param  string $context View or edit context.
1215
-	 * @return string
1216
-	 */
1217
-	public function get_vat_number( $context = 'view' ) {
1218
-		return $this->get_prop( 'vat_number', $context );
1321
+     * Get other recipients for invoice communications.
1322
+     *
1323
+     * @since 1.0.19
1324
+     * @param  string $context View or edit context.
1325
+     * @return bool
1326
+     */
1327
+    public function get_email_cc( $context = 'view' ) {
1328
+        return $this->get_prop( 'email_cc', $context );
1219 1329
     }
1220 1330
 
1221 1331
     /**
1222
-	 * Alias of self::get_vat_number().
1223
-	 *
1224
-	 * @since 1.0.19
1225
-	 * @param  string $context View or edit context.
1226
-	 * @return string
1227
-	 */
1228
-	public function get_user_vat_number( $context = 'view' ) {
1229
-		return $this->get_vat_number( $context );
1332
+     * Get invoice template.
1333
+     *
1334
+     * @since 1.0.19
1335
+     * @param  string $context View or edit context.
1336
+     * @return bool
1337
+     */
1338
+    public function get_template( $context = 'view' ) {
1339
+        return $this->get_prop( 'template', $context );
1230 1340
     }
1231 1341
 
1232 1342
     /**
1233
-	 * Alias of self::get_vat_number().
1234
-	 *
1235
-	 * @since 1.0.19
1236
-	 * @param  string $context View or edit context.
1237
-	 * @return string
1238
-	 */
1239
-	public function get_customer_vat_number( $context = 'view' ) {
1240
-		return $this->get_vat_number( $context );
1343
+     * Get invoice source.
1344
+     *
1345
+     * @since 1.0.19
1346
+     * @param  string $context View or edit context.
1347
+     * @return bool
1348
+     */
1349
+    public function get_created_via( $context = 'view' ) {
1350
+        return $this->get_prop( 'created_via', $context );
1241 1351
     }
1242 1352
 
1243
-    /**
1244
-	 * Get the customer's vat rate.
1245
-	 *
1246
-	 * @since 1.0.19
1247
-	 * @param  string $context View or edit context.
1248
-	 * @return string
1249
-	 */
1250
-	public function get_vat_rate( $context = 'view' ) {
1251
-		return $this->get_prop( 'vat_rate', $context );
1252
-    }
1253
-
1254
-    /**
1255
-	 * Alias of self::get_vat_rate().
1256
-	 *
1257
-	 * @since 1.0.19
1258
-	 * @param  string $context View or edit context.
1259
-	 * @return string
1260
-	 */
1261
-	public function get_user_vat_rate( $context = 'view' ) {
1262
-		return $this->get_vat_rate( $context );
1263
-    }
1264
-
1265
-    /**
1266
-	 * Alias of self::get_vat_rate().
1267
-	 *
1268
-	 * @since 1.0.19
1269
-	 * @param  string $context View or edit context.
1270
-	 * @return string
1271
-	 */
1272
-	public function get_customer_vat_rate( $context = 'view' ) {
1273
-		return $this->get_vat_rate( $context );
1274
-    }
1275
-
1276
-    /**
1277
-	 * Get the customer's address.
1278
-	 *
1279
-	 * @since 1.0.19
1280
-	 * @param  string $context View or edit context.
1281
-	 * @return string
1282
-	 */
1283
-	public function get_address( $context = 'view' ) {
1284
-		return $this->get_prop( 'address', $context );
1285
-    }
1286
-
1287
-    /**
1288
-	 * Alias of self::get_address().
1289
-	 *
1290
-	 * @since 1.0.19
1291
-	 * @param  string $context View or edit context.
1292
-	 * @return string
1293
-	 */
1294
-	public function get_user_address( $context = 'view' ) {
1295
-		return $this->get_address( $context );
1296
-    }
1297
-
1298
-    /**
1299
-	 * Alias of self::get_address().
1300
-	 *
1301
-	 * @since 1.0.19
1302
-	 * @param  string $context View or edit context.
1303
-	 * @return string
1304
-	 */
1305
-	public function get_customer_address( $context = 'view' ) {
1306
-		return $this->get_address( $context );
1307
-    }
1308
-
1309
-    /**
1310
-	 * Get whether the customer has viewed the invoice or not.
1311
-	 *
1312
-	 * @since 1.0.19
1313
-	 * @param  string $context View or edit context.
1314
-	 * @return bool
1315
-	 */
1316
-	public function get_is_viewed( $context = 'view' ) {
1317
-		return (bool) $this->get_prop( 'is_viewed', $context );
1318
-	}
1319
-
1320
-	/**
1321
-	 * Get other recipients for invoice communications.
1322
-	 *
1323
-	 * @since 1.0.19
1324
-	 * @param  string $context View or edit context.
1325
-	 * @return bool
1326
-	 */
1327
-	public function get_email_cc( $context = 'view' ) {
1328
-		return $this->get_prop( 'email_cc', $context );
1329
-	}
1330
-
1331
-	/**
1332
-	 * Get invoice template.
1333
-	 *
1334
-	 * @since 1.0.19
1335
-	 * @param  string $context View or edit context.
1336
-	 * @return bool
1337
-	 */
1338
-	public function get_template( $context = 'view' ) {
1339
-		return $this->get_prop( 'template', $context );
1340
-	}
1341
-
1342
-	/**
1343
-	 * Get invoice source.
1344
-	 *
1345
-	 * @since 1.0.19
1346
-	 * @param  string $context View or edit context.
1347
-	 * @return bool
1348
-	 */
1349
-	public function get_created_via( $context = 'view' ) {
1350
-		return $this->get_prop( 'created_via', $context );
1351
-	}
1352
-
1353
-	/**
1354
-	 * Get whether the customer has confirmed their address.
1355
-	 *
1356
-	 * @since 1.0.19
1357
-	 * @param  string $context View or edit context.
1358
-	 * @return bool
1359
-	 */
1360
-	public function get_address_confirmed( $context = 'view' ) {
1361
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1362
-    }
1363
-
1364
-    /**
1365
-	 * Alias of self::get_address_confirmed().
1366
-	 *
1367
-	 * @since 1.0.19
1368
-	 * @param  string $context View or edit context.
1369
-	 * @return bool
1370
-	 */
1371
-	public function get_user_address_confirmed( $context = 'view' ) {
1372
-		return $this->get_address_confirmed( $context );
1373
-    }
1374
-
1375
-    /**
1376
-	 * Alias of self::get_address().
1377
-	 *
1378
-	 * @since 1.0.19
1379
-	 * @param  string $context View or edit context.
1380
-	 * @return bool
1381
-	 */
1382
-	public function get_customer_address_confirmed( $context = 'view' ) {
1383
-		return $this->get_address_confirmed( $context );
1384
-    }
1385
-
1386
-	/**
1387
-	 * Get the shipping address.
1388
-	 *
1389
-	 * @since 1.0.19
1390
-	 * @return array|false
1391
-	 */
1392
-	public function get_shipping_address() {
1393
-
1394
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1395
-		return is_array( $shipping_address ) ? $shipping_address : false;
1396
-    }
1397
-
1398
-	/**
1399
-	 * Check if the invoice has a shipping address.
1400
-	 */
1401
-	public function has_shipping_address() {
1402
-		return false !== $this->get_shipping_address();
1403
-    }
1404
-
1405
-	/**
1406
-	 * Get the shipping amount.
1407
-	 *
1408
-	 * @since 1.0.19
1409
-	 * @param  string $context View or edit context.
1410
-	 * @return float
1411
-	 */
1412
-	public function get_shipping( $context = 'view' ) {
1413
-
1414
-		if ( $context = 'view' ) {
1415
-			return floatval( $this->get_prop( 'shipping', $context ) );
1416
-		}
1417
-
1418
-		return $this->get_prop( 'shipping', $context );
1419
-    }
1420
-
1421
-	public function has_shipping() {
1422
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && $this->get_prop( 'shipping', 'edit' );
1423
-    }
1424
-
1425
-    /**
1426
-	 * Get the invoice subtotal.
1427
-	 *
1428
-	 * @since 1.0.19
1429
-	 * @param  string $context View or edit context.
1430
-	 * @return float
1431
-	 */
1432
-	public function get_subtotal( $context = 'view' ) {
1353
+    /**
1354
+     * Get whether the customer has confirmed their address.
1355
+     *
1356
+     * @since 1.0.19
1357
+     * @param  string $context View or edit context.
1358
+     * @return bool
1359
+     */
1360
+    public function get_address_confirmed( $context = 'view' ) {
1361
+        return (bool) $this->get_prop( 'address_confirmed', $context );
1362
+    }
1363
+
1364
+    /**
1365
+     * Alias of self::get_address_confirmed().
1366
+     *
1367
+     * @since 1.0.19
1368
+     * @param  string $context View or edit context.
1369
+     * @return bool
1370
+     */
1371
+    public function get_user_address_confirmed( $context = 'view' ) {
1372
+        return $this->get_address_confirmed( $context );
1373
+    }
1374
+
1375
+    /**
1376
+     * Alias of self::get_address().
1377
+     *
1378
+     * @since 1.0.19
1379
+     * @param  string $context View or edit context.
1380
+     * @return bool
1381
+     */
1382
+    public function get_customer_address_confirmed( $context = 'view' ) {
1383
+        return $this->get_address_confirmed( $context );
1384
+    }
1385
+
1386
+    /**
1387
+     * Get the shipping address.
1388
+     *
1389
+     * @since 1.0.19
1390
+     * @return array|false
1391
+     */
1392
+    public function get_shipping_address() {
1393
+
1394
+        $shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1395
+        return is_array( $shipping_address ) ? $shipping_address : false;
1396
+    }
1397
+
1398
+    /**
1399
+     * Check if the invoice has a shipping address.
1400
+     */
1401
+    public function has_shipping_address() {
1402
+        return false !== $this->get_shipping_address();
1403
+    }
1404
+
1405
+    /**
1406
+     * Get the shipping amount.
1407
+     *
1408
+     * @since 1.0.19
1409
+     * @param  string $context View or edit context.
1410
+     * @return float
1411
+     */
1412
+    public function get_shipping( $context = 'view' ) {
1413
+
1414
+        if ( $context = 'view' ) {
1415
+            return floatval( $this->get_prop( 'shipping', $context ) );
1416
+        }
1417
+
1418
+        return $this->get_prop( 'shipping', $context );
1419
+    }
1420
+
1421
+    public function has_shipping() {
1422
+        return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && $this->get_prop( 'shipping', 'edit' );
1423
+    }
1424
+
1425
+    /**
1426
+     * Get the invoice subtotal.
1427
+     *
1428
+     * @since 1.0.19
1429
+     * @param  string $context View or edit context.
1430
+     * @return float
1431
+     */
1432
+    public function get_subtotal( $context = 'view' ) {
1433 1433
         $subtotal = (float) $this->get_prop( 'subtotal', $context );
1434 1434
 
1435 1435
         // Backwards compatibility.
@@ -1441,198 +1441,198 @@  discard block
 block discarded – undo
1441 1441
     }
1442 1442
 
1443 1443
     /**
1444
-	 * Get the invoice discount total.
1445
-	 *
1446
-	 * @since 1.0.19
1447
-	 * @param  string $context View or edit context.
1448
-	 * @return float
1449
-	 */
1450
-	public function get_total_discount( $context = 'view' ) {
1451
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1444
+     * Get the invoice discount total.
1445
+     *
1446
+     * @since 1.0.19
1447
+     * @param  string $context View or edit context.
1448
+     * @return float
1449
+     */
1450
+    public function get_total_discount( $context = 'view' ) {
1451
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1452 1452
     }
1453 1453
 
1454 1454
     /**
1455
-	 * Get the invoice tax total.
1456
-	 *
1457
-	 * @since 1.0.19
1458
-	 * @param  string $context View or edit context.
1459
-	 * @return float
1460
-	 */
1461
-	public function get_total_tax( $context = 'view' ) {
1462
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1463
-	}
1455
+     * Get the invoice tax total.
1456
+     *
1457
+     * @since 1.0.19
1458
+     * @param  string $context View or edit context.
1459
+     * @return float
1460
+     */
1461
+    public function get_total_tax( $context = 'view' ) {
1462
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1463
+    }
1464 1464
 
1465
-	/**
1466
-	 * @deprecated
1467
-	 */
1468
-	public function get_final_tax( $currency = false ) {
1469
-		$tax = $this->get_total_tax();
1465
+    /**
1466
+     * @deprecated
1467
+     */
1468
+    public function get_final_tax( $currency = false ) {
1469
+        $tax = $this->get_total_tax();
1470 1470
 
1471 1471
         if ( $currency ) {
1472
-			return wpinv_price( $tax, $this->get_currency() );
1472
+            return wpinv_price( $tax, $this->get_currency() );
1473 1473
         }
1474 1474
 
1475 1475
         return $tax;
1476 1476
     }
1477 1477
 
1478 1478
     /**
1479
-	 * Get the invoice fees total.
1480
-	 *
1481
-	 * @since 1.0.19
1482
-	 * @param  string $context View or edit context.
1483
-	 * @return float
1484
-	 */
1485
-	public function get_total_fees( $context = 'view' ) {
1486
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1479
+     * Get the invoice fees total.
1480
+     *
1481
+     * @since 1.0.19
1482
+     * @param  string $context View or edit context.
1483
+     * @return float
1484
+     */
1485
+    public function get_total_fees( $context = 'view' ) {
1486
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1487
+    }
1488
+
1489
+    /**
1490
+     * Alias for self::get_total_fees().
1491
+     *
1492
+     * @since 1.0.19
1493
+     * @param  string $context View or edit context.
1494
+     * @return float
1495
+     */
1496
+    public function get_fees_total( $context = 'view' ) {
1497
+        return $this->get_total_fees( $context );
1487 1498
     }
1488 1499
 
1489 1500
     /**
1490
-	 * Alias for self::get_total_fees().
1491
-	 *
1492
-	 * @since 1.0.19
1493
-	 * @param  string $context View or edit context.
1494
-	 * @return float
1495
-	 */
1496
-	public function get_fees_total( $context = 'view' ) {
1497
-		return $this->get_total_fees( $context );
1501
+     * Get the invoice total.
1502
+     *
1503
+     * @since 1.0.19
1504
+     * @return float
1505
+     */
1506
+    public function get_total( $context = 'view' ) {
1507
+        $total = $this->get_prop( 'total', $context );
1508
+
1509
+        if ( $this->has_shipping() && $context == 'view' ) {
1510
+            $total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1511
+        }
1512
+
1513
+        return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1498 1514
     }
1499 1515
 
1500 1516
     /**
1501
-	 * Get the invoice total.
1502
-	 *
1503
-	 * @since 1.0.19
1517
+     * Retrieves the non-recurring total of items.
1518
+     *
1519
+     * @since 2.3.0
1504 1520
      * @return float
1505
-	 */
1506
-	public function get_total( $context = 'view' ) {
1507
-		$total = $this->get_prop( 'total', $context );
1508
-
1509
-		if ( $this->has_shipping() && $context == 'view' ) {
1510
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1511
-		}
1512
-
1513
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1514
-	}
1515
-
1516
-	/**
1517
-	 * Retrieves the non-recurring total of items.
1518
-	 *
1519
-	 * @since 2.3.0
1520
-	 * @return float
1521
-	 */
1522
-	public function get_non_recurring_total() {
1523
-
1524
-		$subtotal = 0;
1525
-		foreach ( $this->get_items() as $item ) {
1526
-			if ( ! $item->is_recurring() ) {
1527
-				$subtotal += $item->get_sub_total();
1528
-			}
1529
-		}
1530
-
1531
-		foreach ( $this->get_fees() as $fee ) {
1532
-			if ( empty( $fee['recurring_fee'] ) ) {
1533
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1534
-			}
1535
-		}
1536
-
1537
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1521
+     */
1522
+    public function get_non_recurring_total() {
1523
+
1524
+        $subtotal = 0;
1525
+        foreach ( $this->get_items() as $item ) {
1526
+            if ( ! $item->is_recurring() ) {
1527
+                $subtotal += $item->get_sub_total();
1528
+            }
1529
+        }
1530
+
1531
+        foreach ( $this->get_fees() as $fee ) {
1532
+            if ( empty( $fee['recurring_fee'] ) ) {
1533
+                $subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1534
+            }
1535
+        }
1536
+
1537
+        $subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1538 1538
         return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1539 1539
 
1540 1540
     }
1541 1541
 
1542
-	/**
1543
-	 * Get the invoice totals.
1544
-	 *
1545
-	 * @since 1.0.19
1542
+    /**
1543
+     * Get the invoice totals.
1544
+     *
1545
+     * @since 1.0.19
1546 1546
      * @return array
1547
-	 */
1548
-	public function get_totals() {
1549
-		return $this->totals;
1547
+     */
1548
+    public function get_totals() {
1549
+        return $this->totals;
1550 1550
     }
1551 1551
 
1552 1552
     /**
1553
-	 * Get the initial invoice total.
1554
-	 *
1555
-	 * @since 1.0.19
1553
+     * Get the initial invoice total.
1554
+     *
1555
+     * @since 1.0.19
1556 1556
      * @param  string $context View or edit context.
1557 1557
      * @return float
1558
-	 */
1558
+     */
1559 1559
     public function get_initial_total() {
1560 1560
 
1561
-		if ( empty( $this->totals ) ) {
1562
-			$this->recalculate_total();
1563
-		}
1561
+        if ( empty( $this->totals ) ) {
1562
+            $this->recalculate_total();
1563
+        }
1564 1564
 
1565
-		$tax      = $this->totals['tax']['initial'];
1566
-		$fee      = $this->totals['fee']['initial'];
1567
-		$discount = $this->totals['discount']['initial'];
1568
-		$subtotal = $this->totals['subtotal']['initial'];
1569
-		$total    = $tax + $fee - $discount + $subtotal;
1565
+        $tax      = $this->totals['tax']['initial'];
1566
+        $fee      = $this->totals['fee']['initial'];
1567
+        $discount = $this->totals['discount']['initial'];
1568
+        $subtotal = $this->totals['subtotal']['initial'];
1569
+        $total    = $tax + $fee - $discount + $subtotal;
1570 1570
 
1571
-		if ( 0 > $total ) {
1572
-			$total = 0;
1573
-		}
1571
+        if ( 0 > $total ) {
1572
+            $total = 0;
1573
+        }
1574 1574
 
1575
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1575
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1576 1576
         return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1577
-	}
1577
+    }
1578 1578
 
1579
-	/**
1580
-	 * Get the recurring invoice total.
1581
-	 *
1582
-	 * @since 1.0.19
1579
+    /**
1580
+     * Get the recurring invoice total.
1581
+     *
1582
+     * @since 1.0.19
1583 1583
      * @param  string $context View or edit context.
1584 1584
      * @return float
1585
-	 */
1585
+     */
1586 1586
     public function get_recurring_total() {
1587 1587
 
1588
-		if ( empty( $this->totals ) ) {
1589
-			$this->recalculate_total();
1590
-		}
1588
+        if ( empty( $this->totals ) ) {
1589
+            $this->recalculate_total();
1590
+        }
1591 1591
 
1592
-		$tax      = $this->totals['tax']['recurring'];
1593
-		$fee      = $this->totals['fee']['recurring'];
1594
-		$discount = $this->totals['discount']['recurring'];
1595
-		$subtotal = $this->totals['subtotal']['recurring'];
1596
-		$total    = $tax + $fee - $discount + $subtotal;
1592
+        $tax      = $this->totals['tax']['recurring'];
1593
+        $fee      = $this->totals['fee']['recurring'];
1594
+        $discount = $this->totals['discount']['recurring'];
1595
+        $subtotal = $this->totals['subtotal']['recurring'];
1596
+        $total    = $tax + $fee - $discount + $subtotal;
1597 1597
 
1598
-		if ( 0 > $total ) {
1599
-			$total = 0;
1600
-		}
1598
+        if ( 0 > $total ) {
1599
+            $total = 0;
1600
+        }
1601 1601
 
1602
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1602
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1603 1603
         return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1604
-	}
1604
+    }
1605 1605
 
1606
-	/**
1607
-	 * Returns recurring payment details.
1608
-	 *
1609
-	 * @since 1.0.19
1606
+    /**
1607
+     * Returns recurring payment details.
1608
+     *
1609
+     * @since 1.0.19
1610 1610
      * @param  string $field Optionally provide a field to return.
1611
-	 * @param string $currency Whether to include the currency.
1611
+     * @param string $currency Whether to include the currency.
1612 1612
      * @return float|string
1613
-	 */
1613
+     */
1614 1614
     public function get_recurring_details( $field = '', $currency = false ) {
1615 1615
 
1616
-		// Maybe recalculate totals.
1617
-		if ( empty( $this->totals ) ) {
1618
-			$this->recalculate_total();
1619
-		}
1616
+        // Maybe recalculate totals.
1617
+        if ( empty( $this->totals ) ) {
1618
+            $this->recalculate_total();
1619
+        }
1620 1620
 
1621
-		// Prepare recurring totals.
1621
+        // Prepare recurring totals.
1622 1622
         $data = apply_filters(
1623
-			'wpinv_get_invoice_recurring_details',
1624
-			array(
1625
-				'cart_details' => $this->get_cart_details(),
1626
-				'subtotal'     => $this->totals['subtotal']['recurring'],
1627
-				'discount'     => $this->totals['discount']['recurring'],
1628
-				'tax'          => $this->totals['tax']['recurring'],
1629
-				'fee'          => $this->totals['fee']['recurring'],
1630
-				'total'        => $this->get_recurring_total(),
1631
-			),
1632
-			$this,
1633
-			$field,
1634
-			$currency
1635
-		);
1623
+            'wpinv_get_invoice_recurring_details',
1624
+            array(
1625
+                'cart_details' => $this->get_cart_details(),
1626
+                'subtotal'     => $this->totals['subtotal']['recurring'],
1627
+                'discount'     => $this->totals['discount']['recurring'],
1628
+                'tax'          => $this->totals['tax']['recurring'],
1629
+                'fee'          => $this->totals['fee']['recurring'],
1630
+                'total'        => $this->get_recurring_total(),
1631
+            ),
1632
+            $this,
1633
+            $field,
1634
+            $currency
1635
+        );
1636 1636
 
1637 1637
         if ( isset( $data[ $field ] ) ) {
1638 1638
             return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
@@ -1642,166 +1642,166 @@  discard block
 block discarded – undo
1642 1642
     }
1643 1643
 
1644 1644
     /**
1645
-	 * Get the invoice fees.
1646
-	 *
1647
-	 * @since 1.0.19
1648
-	 * @param  string $context View or edit context.
1649
-	 * @return array
1650
-	 */
1651
-	public function get_fees( $context = 'view' ) {
1652
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1645
+     * Get the invoice fees.
1646
+     *
1647
+     * @since 1.0.19
1648
+     * @param  string $context View or edit context.
1649
+     * @return array
1650
+     */
1651
+    public function get_fees( $context = 'view' ) {
1652
+        return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1653 1653
     }
1654 1654
 
1655 1655
     /**
1656
-	 * Get the invoice discounts.
1657
-	 *
1658
-	 * @since 1.0.19
1659
-	 * @param  string $context View or edit context.
1660
-	 * @return array
1661
-	 */
1662
-	public function get_discounts( $context = 'view' ) {
1663
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1656
+     * Get the invoice discounts.
1657
+     *
1658
+     * @since 1.0.19
1659
+     * @param  string $context View or edit context.
1660
+     * @return array
1661
+     */
1662
+    public function get_discounts( $context = 'view' ) {
1663
+        return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1664 1664
     }
1665 1665
 
1666 1666
     /**
1667
-	 * Get the invoice taxes.
1668
-	 *
1669
-	 * @since 1.0.19
1670
-	 * @param  string $context View or edit context.
1671
-	 * @return array
1672
-	 */
1673
-	public function get_taxes( $context = 'view' ) {
1674
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1667
+     * Get the invoice taxes.
1668
+     *
1669
+     * @since 1.0.19
1670
+     * @param  string $context View or edit context.
1671
+     * @return array
1672
+     */
1673
+    public function get_taxes( $context = 'view' ) {
1674
+        return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1675 1675
     }
1676 1676
 
1677 1677
     /**
1678
-	 * Get the invoice items.
1679
-	 *
1680
-	 * @since 1.0.19
1681
-	 * @param  string $context View or edit context.
1682
-	 * @return GetPaid_Form_Item[]
1683
-	 */
1684
-	public function get_items( $context = 'view' ) {
1678
+     * Get the invoice items.
1679
+     *
1680
+     * @since 1.0.19
1681
+     * @param  string $context View or edit context.
1682
+     * @return GetPaid_Form_Item[]
1683
+     */
1684
+    public function get_items( $context = 'view' ) {
1685 1685
         return $this->get_prop( 'items', $context );
1686
-	}
1686
+    }
1687 1687
 
1688
-	/**
1689
-	 * Get the invoice item ids.
1690
-	 *
1691
-	 * @since 1.0.19
1692
-	 * @return string
1693
-	 */
1694
-	public function get_item_ids() {
1695
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1688
+    /**
1689
+     * Get the invoice item ids.
1690
+     *
1691
+     * @since 1.0.19
1692
+     * @return string
1693
+     */
1694
+    public function get_item_ids() {
1695
+        return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1696 1696
     }
1697 1697
 
1698 1698
     /**
1699
-	 * Get the invoice's payment form.
1700
-	 *
1701
-	 * @since 1.0.19
1702
-	 * @param  string $context View or edit context.
1703
-	 * @return int
1704
-	 */
1705
-	public function get_payment_form( $context = 'view' ) {
1706
-		return intval( $this->get_prop( 'payment_form', $context ) );
1699
+     * Get the invoice's payment form.
1700
+     *
1701
+     * @since 1.0.19
1702
+     * @param  string $context View or edit context.
1703
+     * @return int
1704
+     */
1705
+    public function get_payment_form( $context = 'view' ) {
1706
+        return intval( $this->get_prop( 'payment_form', $context ) );
1707 1707
     }
1708 1708
 
1709 1709
     /**
1710
-	 * Get the invoice's submission id.
1711
-	 *
1712
-	 * @since 1.0.19
1713
-	 * @param  string $context View or edit context.
1714
-	 * @return string
1715
-	 */
1716
-	public function get_submission_id( $context = 'view' ) {
1717
-		return $this->get_prop( 'submission_id', $context );
1710
+     * Get the invoice's submission id.
1711
+     *
1712
+     * @since 1.0.19
1713
+     * @param  string $context View or edit context.
1714
+     * @return string
1715
+     */
1716
+    public function get_submission_id( $context = 'view' ) {
1717
+        return $this->get_prop( 'submission_id', $context );
1718 1718
     }
1719 1719
 
1720 1720
     /**
1721
-	 * Get the invoice's discount code.
1722
-	 *
1723
-	 * @since 1.0.19
1724
-	 * @param  string $context View or edit context.
1725
-	 * @return string
1726
-	 */
1727
-	public function get_discount_code( $context = 'view' ) {
1728
-		return $this->get_prop( 'discount_code', $context );
1721
+     * Get the invoice's discount code.
1722
+     *
1723
+     * @since 1.0.19
1724
+     * @param  string $context View or edit context.
1725
+     * @return string
1726
+     */
1727
+    public function get_discount_code( $context = 'view' ) {
1728
+        return $this->get_prop( 'discount_code', $context );
1729 1729
     }
1730 1730
 
1731 1731
     /**
1732
-	 * Get the invoice's gateway.
1733
-	 *
1734
-	 * @since 1.0.19
1735
-	 * @param  string $context View or edit context.
1736
-	 * @return string
1737
-	 */
1738
-	public function get_gateway( $context = 'view' ) {
1739
-		return $this->get_prop( 'gateway', $context );
1732
+     * Get the invoice's gateway.
1733
+     *
1734
+     * @since 1.0.19
1735
+     * @param  string $context View or edit context.
1736
+     * @return string
1737
+     */
1738
+    public function get_gateway( $context = 'view' ) {
1739
+        return $this->get_prop( 'gateway', $context );
1740 1740
     }
1741 1741
 
1742 1742
     /**
1743
-	 * Get the invoice's gateway display title.
1744
-	 *
1745
-	 * @since 1.0.19
1746
-	 * @return string
1747
-	 */
1743
+     * Get the invoice's gateway display title.
1744
+     *
1745
+     * @since 1.0.19
1746
+     * @return string
1747
+     */
1748 1748
     public function get_gateway_title() {
1749 1749
         $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1750 1750
         return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1751 1751
     }
1752 1752
 
1753 1753
     /**
1754
-	 * Get the invoice's transaction id.
1755
-	 *
1756
-	 * @since 1.0.19
1757
-	 * @param  string $context View or edit context.
1758
-	 * @return string
1759
-	 */
1760
-	public function get_transaction_id( $context = 'view' ) {
1761
-		return $this->get_prop( 'transaction_id', $context );
1754
+     * Get the invoice's transaction id.
1755
+     *
1756
+     * @since 1.0.19
1757
+     * @param  string $context View or edit context.
1758
+     * @return string
1759
+     */
1760
+    public function get_transaction_id( $context = 'view' ) {
1761
+        return $this->get_prop( 'transaction_id', $context );
1762 1762
     }
1763 1763
 
1764 1764
     /**
1765
-	 * Get the invoice's currency.
1766
-	 *
1767
-	 * @since 1.0.19
1768
-	 * @param  string $context View or edit context.
1769
-	 * @return string
1770
-	 */
1771
-	public function get_currency( $context = 'view' ) {
1765
+     * Get the invoice's currency.
1766
+     *
1767
+     * @since 1.0.19
1768
+     * @param  string $context View or edit context.
1769
+     * @return string
1770
+     */
1771
+    public function get_currency( $context = 'view' ) {
1772 1772
         $currency = $this->get_prop( 'currency', $context );
1773 1773
         return empty( $currency ) ? wpinv_get_currency() : $currency;
1774 1774
     }
1775 1775
 
1776 1776
     /**
1777
-	 * Checks if we are charging taxes for this invoice.
1778
-	 *
1779
-	 * @since 1.0.19
1780
-	 * @param  string $context View or edit context.
1781
-	 * @return bool
1782
-	 */
1783
-	public function get_disable_taxes( $context = 'view' ) {
1777
+     * Checks if we are charging taxes for this invoice.
1778
+     *
1779
+     * @since 1.0.19
1780
+     * @param  string $context View or edit context.
1781
+     * @return bool
1782
+     */
1783
+    public function get_disable_taxes( $context = 'view' ) {
1784 1784
         return (bool) $this->get_prop( 'disable_taxes', $context );
1785 1785
     }
1786 1786
 
1787 1787
     /**
1788
-	 * Retrieves the subscription id for an invoice.
1789
-	 *
1790
-	 * @since 1.0.19
1791
-	 * @param  string $context View or edit context.
1792
-	 * @return int
1793
-	 */
1788
+     * Retrieves the subscription id for an invoice.
1789
+     *
1790
+     * @since 1.0.19
1791
+     * @param  string $context View or edit context.
1792
+     * @return int
1793
+     */
1794 1794
     public function get_subscription_id( $context = 'view' ) {
1795
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1796
-	}
1797
-
1798
-	/**
1799
-	 * Retrieves the remote subscription id for an invoice.
1800
-	 *
1801
-	 * @since 1.0.19
1802
-	 * @param  string $context View or edit context.
1803
-	 * @return int
1804
-	 */
1795
+        return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1796
+    }
1797
+
1798
+    /**
1799
+     * Retrieves the remote subscription id for an invoice.
1800
+     *
1801
+     * @since 1.0.19
1802
+     * @param  string $context View or edit context.
1803
+     * @return int
1804
+     */
1805 1805
     public function get_remote_subscription_id( $context = 'view' ) {
1806 1806
         $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1807 1807
 
@@ -1813,24 +1813,24 @@  discard block
 block discarded – undo
1813 1813
         return $subscription_id;
1814 1814
     }
1815 1815
 
1816
-	/**
1817
-	 * Get the invoice's _anonymize status.
1818
-	 *
1819
-	 * @since 2.8.22
1820
-	 * @param  string $context View or edit context.
1821
-	 * @return string
1822
-	 */
1823
-	public function get_is_anonymized( $context = 'view' ) {
1824
-		return (bool) $this->get_prop( 'is_anonymized', $context );
1816
+    /**
1817
+     * Get the invoice's _anonymize status.
1818
+     *
1819
+     * @since 2.8.22
1820
+     * @param  string $context View or edit context.
1821
+     * @return string
1822
+     */
1823
+    public function get_is_anonymized( $context = 'view' ) {
1824
+        return (bool) $this->get_prop( 'is_anonymized', $context );
1825 1825
     }
1826 1826
 
1827 1827
     /**
1828
-	 * Retrieves the payment meta for an invoice.
1829
-	 *
1830
-	 * @since 1.0.19
1831
-	 * @param  string $context View or edit context.
1832
-	 * @return array
1833
-	 */
1828
+     * Retrieves the payment meta for an invoice.
1829
+     *
1830
+     * @since 1.0.19
1831
+     * @param  string $context View or edit context.
1832
+     * @return array
1833
+     */
1834 1834
     public function get_payment_meta( $context = 'view' ) {
1835 1835
 
1836 1836
         return array(
@@ -1850,31 +1850,31 @@  discard block
 block discarded – undo
1850 1850
     }
1851 1851
 
1852 1852
     /**
1853
-	 * Retrieves the cart details for an invoice.
1854
-	 *
1855
-	 * @since 1.0.19
1856
-	 * @return array
1857
-	 */
1853
+     * Retrieves the cart details for an invoice.
1854
+     *
1855
+     * @since 1.0.19
1856
+     * @return array
1857
+     */
1858 1858
     public function get_cart_details() {
1859 1859
         $items        = $this->get_items();
1860 1860
         $cart_details = array();
1861 1861
 
1862 1862
         foreach ( $items as $item ) {
1863
-			$item->invoice_id = $this->get_id();
1863
+            $item->invoice_id = $this->get_id();
1864 1864
             $cart_details[]   = $item->prepare_data_for_saving();
1865 1865
         }
1866 1866
 
1867 1867
         return $cart_details;
1868
-	}
1868
+    }
1869 1869
 
1870
-	/**
1871
-	 * Retrieves the recurring item.
1872
-	 *
1873
-	 * @return null|GetPaid_Form_Item|int
1874
-	 */
1875
-	public function get_recurring( $object = false ) {
1870
+    /**
1871
+     * Retrieves the recurring item.
1872
+     *
1873
+     * @return null|GetPaid_Form_Item|int
1874
+     */
1875
+    public function get_recurring( $object = false ) {
1876 1876
 
1877
-		// Are we returning an object?
1877
+        // Are we returning an object?
1878 1878
         if ( $object ) {
1879 1879
             return $this->get_item( $this->recurring_item );
1880 1880
         }
@@ -1882,130 +1882,130 @@  discard block
 block discarded – undo
1882 1882
         return $this->recurring_item;
1883 1883
     }
1884 1884
 
1885
-	/**
1886
-	 * Retrieves the subscription name.
1887
-	 *
1888
-	 * @since 1.0.19
1889
-	 * @return string
1890
-	 */
1891
-	public function get_subscription_name() {
1885
+    /**
1886
+     * Retrieves the subscription name.
1887
+     *
1888
+     * @since 1.0.19
1889
+     * @return string
1890
+     */
1891
+    public function get_subscription_name() {
1892 1892
 
1893
-		// Retrieve the recurring name
1893
+        // Retrieve the recurring name
1894 1894
         $item = $this->get_recurring( true );
1895 1895
 
1896
-		// Abort if it does not exist.
1896
+        // Abort if it does not exist.
1897 1897
         if ( empty( $item ) ) {
1898 1898
             return '';
1899 1899
         }
1900 1900
 
1901
-		// Return the item name.
1901
+        // Return the item name.
1902 1902
         return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1903
-	}
1904
-
1905
-	/**
1906
-	 * Retrieves the view url.
1907
-	 *
1908
-	 * @since 1.0.19
1909
-	 * @return string
1910
-	 */
1911
-	public function get_view_url() {
1903
+    }
1904
+
1905
+    /**
1906
+     * Retrieves the view url.
1907
+     *
1908
+     * @since 1.0.19
1909
+     * @return string
1910
+     */
1911
+    public function get_view_url() {
1912 1912
         $invoice_url = get_permalink( $this->get_id() );
1913
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1913
+        $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1914 1914
         return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1915
-	}
1915
+    }
1916 1916
 
1917
-	/**
1918
-	 * Retrieves the payment url.
1919
-	 *
1920
-	 * @since 1.0.19
1921
-	 * @return string
1922
-	 */
1923
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1917
+    /**
1918
+     * Retrieves the payment url.
1919
+     *
1920
+     * @since 1.0.19
1921
+     * @return string
1922
+     */
1923
+    public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1924 1924
 
1925
-		// Retrieve the checkout url.
1925
+        // Retrieve the checkout url.
1926 1926
         $pay_url = wpinv_get_checkout_uri();
1927 1927
 
1928
-		// Maybe force ssl.
1928
+        // Maybe force ssl.
1929 1929
         if ( is_ssl() ) {
1930 1930
             $pay_url = str_replace( 'http:', 'https:', $pay_url );
1931 1931
         }
1932 1932
 
1933
-		// Add the invoice key.
1934
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1933
+        // Add the invoice key.
1934
+        $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1935 1935
 
1936
-		// (Maybe?) add a secret
1936
+        // (Maybe?) add a secret
1937 1937
         if ( $secret ) {
1938 1938
             $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1939 1939
         }
1940 1940
 
1941 1941
         return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1942
-	}
1942
+    }
1943 1943
 
1944
-	/**
1945
-	 * Retrieves the receipt url.
1946
-	 *
1947
-	 * @since 1.0.19
1948
-	 * @return string
1949
-	 */
1950
-	public function get_receipt_url() {
1944
+    /**
1945
+     * Retrieves the receipt url.
1946
+     *
1947
+     * @since 1.0.19
1948
+     * @return string
1949
+     */
1950
+    public function get_receipt_url() {
1951 1951
 
1952
-		// Retrieve the checkout url.
1952
+        // Retrieve the checkout url.
1953 1953
         $receipt_url = wpinv_get_success_page_uri();
1954 1954
 
1955
-		// Maybe force ssl.
1955
+        // Maybe force ssl.
1956 1956
         if ( is_ssl() ) {
1957 1957
             $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1958 1958
         }
1959 1959
 
1960
-		// Add the invoice key.
1961
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1960
+        // Add the invoice key.
1961
+        $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1962 1962
 
1963 1963
         return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1964
-	}
1965
-
1966
-	/**
1967
-	 * Retrieves the remote transaction url.
1968
-	 *
1969
-	 * @since 1.6.0
1970
-	 * @return string
1971
-	 */
1972
-	public function get_transaction_url() {
1973
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1974
-	}
1975
-
1976
-	/**
1977
-	 * Retrieves the default status.
1978
-	 *
1979
-	 * @since 1.0.19
1980
-	 * @return string
1981
-	 */
1982
-	public function get_default_status() {
1983
-
1984
-		$type   = $this->get_type();
1985
-		$status = "wpi-$type-pending";
1986
-		return str_replace( '-invoice', '', $status );
1987
-
1988
-	}
1989
-
1990
-    /**
1991
-	 * Magic method for accessing invoice properties.
1992
-	 *
1993
-	 * @since 1.0.15
1994
-	 * @access public
1995
-	 *
1996
-	 * @param string $key Discount data to retrieve
1997
-	 * @param  string $context View or edit context.
1998
-	 * @return mixed Value of the given invoice property (if set).
1999
-	 */
2000
-	public function get( $key, $context = 'view' ) {
2001
-		$method = "get_$key";
2002
-
2003
-		if ( is_callable( array( $this, $method ) ) ) {
2004
-			return $this->$method( $context );
2005
-		}
1964
+    }
1965
+
1966
+    /**
1967
+     * Retrieves the remote transaction url.
1968
+     *
1969
+     * @since 1.6.0
1970
+     * @return string
1971
+     */
1972
+    public function get_transaction_url() {
1973
+        return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1974
+    }
1975
+
1976
+    /**
1977
+     * Retrieves the default status.
1978
+     *
1979
+     * @since 1.0.19
1980
+     * @return string
1981
+     */
1982
+    public function get_default_status() {
1983
+
1984
+        $type   = $this->get_type();
1985
+        $status = "wpi-$type-pending";
1986
+        return str_replace( '-invoice', '', $status );
1987
+
1988
+    }
1989
+
1990
+    /**
1991
+     * Magic method for accessing invoice properties.
1992
+     *
1993
+     * @since 1.0.15
1994
+     * @access public
1995
+     *
1996
+     * @param string $key Discount data to retrieve
1997
+     * @param  string $context View or edit context.
1998
+     * @return mixed Value of the given invoice property (if set).
1999
+     */
2000
+    public function get( $key, $context = 'view' ) {
2001
+        $method = "get_$key";
2002
+
2003
+        if ( is_callable( array( $this, $method ) ) ) {
2004
+            return $this->$method( $context );
2005
+        }
2006 2006
 
2007 2007
         return $this->get_prop( $key, $context );
2008
-	}
2008
+    }
2009 2009
 
2010 2010
     /*
2011 2011
 	|--------------------------------------------------------------------------
@@ -2018,129 +2018,129 @@  discard block
 block discarded – undo
2018 2018
     */
2019 2019
 
2020 2020
     /**
2021
-	 * Magic method for setting invoice properties.
2022
-	 *
2023
-	 * @since 1.0.19
2024
-	 * @access public
2025
-	 *
2026
-	 * @param string $key Discount data to retrieve
2027
-	 * @param  mixed $value new value.
2028
-	 * @return mixed Value of the given invoice property (if set).
2029
-	 */
2030
-	public function set( $key, $value ) {
2021
+     * Magic method for setting invoice properties.
2022
+     *
2023
+     * @since 1.0.19
2024
+     * @access public
2025
+     *
2026
+     * @param string $key Discount data to retrieve
2027
+     * @param  mixed $value new value.
2028
+     * @return mixed Value of the given invoice property (if set).
2029
+     */
2030
+    public function set( $key, $value ) {
2031 2031
 
2032 2032
         $setter = "set_$key";
2033 2033
         if ( is_callable( array( $this, $setter ) ) ) {
2034 2034
             $this->{$setter}( $value );
2035 2035
         }
2036 2036
 
2037
-	}
2038
-
2039
-	/**
2040
-	 * Sets item status.
2041
-	 *
2042
-	 * @since 1.0.19
2043
-	 * @param string $new_status    New status.
2044
-	 * @param string $note          Optional note to add.
2045
-	 * @param bool   $manual_update Is this a manual status change?.
2046
-	 * @return array details of change.
2047
-	 */
2048
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2049
-		$old_status = $this->get_status();
2050
-
2051
-		$statuses = $this->get_all_statuses();
2052
-
2053
-		if ( isset( $statuses['draft'] ) ) {
2054
-			unset( $statuses['draft'] );
2055
-		}
2056
-
2057
-		$this->set_prop( 'status', $new_status );
2058
-
2059
-		// If setting the status, ensure it's set to a valid status.
2060
-		if ( true === $this->object_read ) {
2061
-
2062
-			// Only allow valid new status.
2063
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2064
-				$new_status = $this->get_default_status();
2065
-			}
2066
-
2067
-			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2068
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2069
-				$old_status = $this->get_default_status();
2070
-			}
2071
-
2072
-			// Paid - Renewal (i.e when duplicating a parent invoice )
2073
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2074
-				$old_status = 'wpi-pending';
2075
-			}
2076
-
2077
-			if ( $old_status !== $new_status ) {
2078
-				$this->status_transition = array(
2079
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2080
-					'to'     => $new_status,
2081
-					'note'   => $note,
2082
-					'manual' => (bool) $manual_update,
2083
-				);
2084
-
2085
-				if ( $manual_update ) {
2086
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2087
-				}
2088
-
2089
-				$this->maybe_set_date_paid();
2090
-
2091
-			}
2092
-		}
2093
-
2094
-		return array(
2095
-			'from' => $old_status,
2096
-			'to'   => $new_status,
2097
-		);
2098
-	}
2099
-
2100
-	/**
2101
-	 * Maybe set date paid.
2102
-	 *
2103
-	 * Sets the date paid variable when transitioning to the payment complete
2104
-	 * order status.
2105
-	 *
2106
-	 * @since 1.0.19
2107
-	 */
2108
-	public function maybe_set_date_paid() {
2109
-
2110
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2111
-			$this->set_date_completed( current_time( 'mysql' ) );
2112
-		}
2113
-	}
2114
-
2115
-    /**
2116
-	 * Set parent invoice ID.
2117
-	 *
2118
-	 * @since 1.0.19
2119
-	 */
2120
-	public function set_parent_id( $value ) {
2121
-		if ( $value && ( $value === $this->get_id() ) ) {
2122
-			return;
2123
-		}
2124
-		$this->set_prop( 'parent_id', absint( $value ) );
2125
-    }
2126
-
2127
-    /**
2128
-	 * Set plugin version when the invoice was created.
2129
-	 *
2130
-	 * @since 1.0.19
2131
-	 */
2132
-	public function set_version( $value ) {
2133
-		$this->set_prop( 'version', $value );
2134
-    }
2135
-
2136
-    /**
2137
-	 * Set date when the invoice was created.
2138
-	 *
2139
-	 * @since 1.0.19
2140
-	 * @param string $value Value to set.
2037
+    }
2038
+
2039
+    /**
2040
+     * Sets item status.
2041
+     *
2042
+     * @since 1.0.19
2043
+     * @param string $new_status    New status.
2044
+     * @param string $note          Optional note to add.
2045
+     * @param bool   $manual_update Is this a manual status change?.
2046
+     * @return array details of change.
2047
+     */
2048
+    public function set_status( $new_status, $note = '', $manual_update = false ) {
2049
+        $old_status = $this->get_status();
2050
+
2051
+        $statuses = $this->get_all_statuses();
2052
+
2053
+        if ( isset( $statuses['draft'] ) ) {
2054
+            unset( $statuses['draft'] );
2055
+        }
2056
+
2057
+        $this->set_prop( 'status', $new_status );
2058
+
2059
+        // If setting the status, ensure it's set to a valid status.
2060
+        if ( true === $this->object_read ) {
2061
+
2062
+            // Only allow valid new status.
2063
+            if ( ! array_key_exists( $new_status, $statuses ) ) {
2064
+                $new_status = $this->get_default_status();
2065
+            }
2066
+
2067
+            // If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2068
+            if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2069
+                $old_status = $this->get_default_status();
2070
+            }
2071
+
2072
+            // Paid - Renewal (i.e when duplicating a parent invoice )
2073
+            if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2074
+                $old_status = 'wpi-pending';
2075
+            }
2076
+
2077
+            if ( $old_status !== $new_status ) {
2078
+                $this->status_transition = array(
2079
+                    'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2080
+                    'to'     => $new_status,
2081
+                    'note'   => $note,
2082
+                    'manual' => (bool) $manual_update,
2083
+                );
2084
+
2085
+                if ( $manual_update ) {
2086
+                    do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2087
+                }
2088
+
2089
+                $this->maybe_set_date_paid();
2090
+
2091
+            }
2092
+        }
2093
+
2094
+        return array(
2095
+            'from' => $old_status,
2096
+            'to'   => $new_status,
2097
+        );
2098
+    }
2099
+
2100
+    /**
2101
+     * Maybe set date paid.
2102
+     *
2103
+     * Sets the date paid variable when transitioning to the payment complete
2104
+     * order status.
2105
+     *
2106
+     * @since 1.0.19
2107
+     */
2108
+    public function maybe_set_date_paid() {
2109
+
2110
+        if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2111
+            $this->set_date_completed( current_time( 'mysql' ) );
2112
+        }
2113
+    }
2114
+
2115
+    /**
2116
+     * Set parent invoice ID.
2117
+     *
2118
+     * @since 1.0.19
2119
+     */
2120
+    public function set_parent_id( $value ) {
2121
+        if ( $value && ( $value === $this->get_id() ) ) {
2122
+            return;
2123
+        }
2124
+        $this->set_prop( 'parent_id', absint( $value ) );
2125
+    }
2126
+
2127
+    /**
2128
+     * Set plugin version when the invoice was created.
2129
+     *
2130
+     * @since 1.0.19
2131
+     */
2132
+    public function set_version( $value ) {
2133
+        $this->set_prop( 'version', $value );
2134
+    }
2135
+
2136
+    /**
2137
+     * Set date when the invoice was created.
2138
+     *
2139
+     * @since 1.0.19
2140
+     * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142
-	 */
2143
-	public function set_date_created( $value ) {
2142
+     */
2143
+    public function set_date_created( $value ) {
2144 2144
         $date = strtotime( $value );
2145 2145
 
2146 2146
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2148,19 +2148,19 @@  discard block
 block discarded – undo
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'date_created', '' );
2152
-		return false;
2151
+        $this->set_prop( 'date_created', '' );
2152
+        return false;
2153 2153
 
2154 2154
     }
2155 2155
 
2156 2156
     /**
2157
-	 * Set date invoice due date.
2158
-	 *
2159
-	 * @since 1.0.19
2160
-	 * @param string $value Value to set.
2157
+     * Set date invoice due date.
2158
+     *
2159
+     * @since 1.0.19
2160
+     * @param string $value Value to set.
2161 2161
      * @return bool Whether or not the date was set.
2162
-	 */
2163
-	public function set_due_date( $value ) {
2162
+     */
2163
+    public function set_due_date( $value ) {
2164 2164
         $date = strtotime( $value );
2165 2165
 
2166 2166
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2168,29 +2168,29 @@  discard block
 block discarded – undo
2168 2168
             return true;
2169 2169
         }
2170 2170
 
2171
-		$this->set_prop( 'due_date', '' );
2171
+        $this->set_prop( 'due_date', '' );
2172 2172
         return false;
2173 2173
 
2174 2174
     }
2175 2175
 
2176 2176
     /**
2177
-	 * Alias of self::set_due_date().
2178
-	 *
2179
-	 * @since 1.0.19
2180
-	 * @param  string $value New name.
2181
-	 */
2182
-	public function set_date_due( $value ) {
2183
-		$this->set_due_date( $value );
2177
+     * Alias of self::set_due_date().
2178
+     *
2179
+     * @since 1.0.19
2180
+     * @param  string $value New name.
2181
+     */
2182
+    public function set_date_due( $value ) {
2183
+        $this->set_due_date( $value );
2184 2184
     }
2185 2185
 
2186 2186
     /**
2187
-	 * Set date invoice was completed.
2188
-	 *
2189
-	 * @since 1.0.19
2190
-	 * @param string $value Value to set.
2187
+     * Set date invoice was completed.
2188
+     *
2189
+     * @since 1.0.19
2190
+     * @param string $value Value to set.
2191 2191
      * @return bool Whether or not the date was set.
2192
-	 */
2193
-	public function set_completed_date( $value ) {
2192
+     */
2193
+    public function set_completed_date( $value ) {
2194 2194
         $date = strtotime( $value );
2195 2195
 
2196 2196
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2198,29 +2198,29 @@  discard block
 block discarded – undo
2198 2198
             return true;
2199 2199
         }
2200 2200
 
2201
-		$this->set_prop( 'completed_date', '' );
2201
+        $this->set_prop( 'completed_date', '' );
2202 2202
         return false;
2203 2203
 
2204 2204
     }
2205 2205
 
2206 2206
     /**
2207
-	 * Alias of self::set_completed_date().
2208
-	 *
2209
-	 * @since 1.0.19
2210
-	 * @param  string $value New name.
2211
-	 */
2212
-	public function set_date_completed( $value ) {
2213
-		$this->set_completed_date( $value );
2207
+     * Alias of self::set_completed_date().
2208
+     *
2209
+     * @since 1.0.19
2210
+     * @param  string $value New name.
2211
+     */
2212
+    public function set_date_completed( $value ) {
2213
+        $this->set_completed_date( $value );
2214 2214
     }
2215 2215
 
2216 2216
     /**
2217
-	 * Set date when the invoice was last modified.
2218
-	 *
2219
-	 * @since 1.0.19
2220
-	 * @param string $value Value to set.
2217
+     * Set date when the invoice was last modified.
2218
+     *
2219
+     * @since 1.0.19
2220
+     * @param string $value Value to set.
2221 2221
      * @return bool Whether or not the date was set.
2222
-	 */
2223
-	public function set_date_modified( $value ) {
2222
+     */
2223
+    public function set_date_modified( $value ) {
2224 2224
         $date = strtotime( $value );
2225 2225
 
2226 2226
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2228,813 +2228,813 @@  discard block
 block discarded – undo
2228 2228
             return true;
2229 2229
         }
2230 2230
 
2231
-		$this->set_prop( 'date_modified', '' );
2231
+        $this->set_prop( 'date_modified', '' );
2232 2232
         return false;
2233 2233
 
2234 2234
     }
2235 2235
 
2236 2236
     /**
2237
-	 * Set the invoice number.
2238
-	 *
2239
-	 * @since 1.0.19
2240
-	 * @param  string $value New number.
2241
-	 */
2242
-	public function set_number( $value ) {
2237
+     * Set the invoice number.
2238
+     *
2239
+     * @since 1.0.19
2240
+     * @param  string $value New number.
2241
+     */
2242
+    public function set_number( $value ) {
2243 2243
         $number = sanitize_text_field( $value );
2244
-		$this->set_prop( 'number', $number );
2244
+        $this->set_prop( 'number', $number );
2245 2245
     }
2246 2246
 
2247 2247
     /**
2248
-	 * Set the invoice type.
2249
-	 *
2250
-	 * @since 1.0.19
2251
-	 * @param  string $value Type.
2252
-	 */
2253
-	public function set_type( $value ) {
2248
+     * Set the invoice type.
2249
+     *
2250
+     * @since 1.0.19
2251
+     * @param  string $value Type.
2252
+     */
2253
+    public function set_type( $value ) {
2254 2254
         $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2255
-		$this->set_prop( 'type', $type );
2256
-	}
2255
+        $this->set_prop( 'type', $type );
2256
+    }
2257 2257
 
2258 2258
     /**
2259
-	 * Set the invoice post type.
2260
-	 *
2261
-	 * @since 1.0.19
2262
-	 * @param  string $value Post type.
2263
-	 */
2264
-	public function set_post_type( $value ) {
2259
+     * Set the invoice post type.
2260
+     *
2261
+     * @since 1.0.19
2262
+     * @param  string $value Post type.
2263
+     */
2264
+    public function set_post_type( $value ) {
2265 2265
         if ( getpaid_is_invoice_post_type( $value ) ) {
2266
-			$this->set_type( $value );
2266
+            $this->set_type( $value );
2267 2267
             $this->set_prop( 'post_type', $value );
2268 2268
         }
2269 2269
     }
2270 2270
 
2271 2271
     /**
2272
-	 * Set the invoice key.
2273
-	 *
2274
-	 * @since 1.0.19
2275
-	 * @param  string $value New key.
2276
-	 */
2277
-	public function set_key( $value ) {
2272
+     * Set the invoice key.
2273
+     *
2274
+     * @since 1.0.19
2275
+     * @param  string $value New key.
2276
+     */
2277
+    public function set_key( $value ) {
2278 2278
         $key = sanitize_text_field( $value );
2279
-		$this->set_prop( 'key', $key );
2279
+        $this->set_prop( 'key', $key );
2280 2280
     }
2281 2281
 
2282 2282
     /**
2283
-	 * Set the invoice mode.
2284
-	 *
2285
-	 * @since 1.0.19
2286
-	 * @param  string $value mode.
2287
-	 */
2288
-	public function set_mode( $value ) {
2283
+     * Set the invoice mode.
2284
+     *
2285
+     * @since 1.0.19
2286
+     * @param  string $value mode.
2287
+     */
2288
+    public function set_mode( $value ) {
2289 2289
         if ( in_array( $value, array( 'live', 'test' ) ) ) {
2290 2290
             $this->set_prop( 'mode', $value );
2291 2291
         }
2292 2292
     }
2293 2293
 
2294 2294
     /**
2295
-	 * Set the invoice path.
2296
-	 *
2297
-	 * @since 1.0.19
2298
-	 * @param  string $value path.
2299
-	 */
2300
-	public function set_path( $value ) {
2295
+     * Set the invoice path.
2296
+     *
2297
+     * @since 1.0.19
2298
+     * @param  string $value path.
2299
+     */
2300
+    public function set_path( $value ) {
2301 2301
         $this->set_prop( 'path', $value );
2302 2302
     }
2303 2303
 
2304 2304
     /**
2305
-	 * Set the invoice name.
2306
-	 *
2307
-	 * @since 1.0.19
2308
-	 * @param  string $value New name.
2309
-	 */
2310
-	public function set_name( $value ) {
2305
+     * Set the invoice name.
2306
+     *
2307
+     * @since 1.0.19
2308
+     * @param  string $value New name.
2309
+     */
2310
+    public function set_name( $value ) {
2311 2311
         $name = sanitize_text_field( $value );
2312
-		$this->set_prop( 'name', $name );
2312
+        $this->set_prop( 'name', $name );
2313 2313
     }
2314 2314
 
2315 2315
     /**
2316
-	 * Alias of self::set_name().
2317
-	 *
2318
-	 * @since 1.0.19
2319
-	 * @param  string $value New name.
2320
-	 */
2321
-	public function set_title( $value ) {
2322
-		$this->set_name( $value );
2316
+     * Alias of self::set_name().
2317
+     *
2318
+     * @since 1.0.19
2319
+     * @param  string $value New name.
2320
+     */
2321
+    public function set_title( $value ) {
2322
+        $this->set_name( $value );
2323 2323
     }
2324 2324
 
2325 2325
     /**
2326
-	 * Set the invoice description.
2327
-	 *
2328
-	 * @since 1.0.19
2329
-	 * @param  string $value New description.
2330
-	 */
2331
-	public function set_description( $value ) {
2326
+     * Set the invoice description.
2327
+     *
2328
+     * @since 1.0.19
2329
+     * @param  string $value New description.
2330
+     */
2331
+    public function set_description( $value ) {
2332 2332
         $description = wp_kses_post( $value );
2333
-		$this->set_prop( 'description', $description );
2333
+        $this->set_prop( 'description', $description );
2334
+    }
2335
+
2336
+    /**
2337
+     * Alias of self::set_description().
2338
+     *
2339
+     * @since 1.0.19
2340
+     * @param  string $value New description.
2341
+     */
2342
+    public function set_excerpt( $value ) {
2343
+        $this->set_description( $value );
2344
+    }
2345
+
2346
+    /**
2347
+     * Alias of self::set_description().
2348
+     *
2349
+     * @since 1.0.19
2350
+     * @param  string $value New description.
2351
+     */
2352
+    public function set_summary( $value ) {
2353
+        $this->set_description( $value );
2354
+    }
2355
+
2356
+    /**
2357
+     * Set the receiver of the invoice.
2358
+     *
2359
+     * @since 1.0.19
2360
+     * @param  int $value New author.
2361
+     */
2362
+    public function set_author( $value ) {
2363
+        $user = get_user_by( 'id', (int) $value );
2364
+
2365
+        if ( $user && $user->ID ) {
2366
+            $this->set_prop( 'author', $user->ID );
2367
+            $this->set_prop( 'email', $user->user_email );
2368
+        }
2369
+
2370
+    }
2371
+
2372
+    /**
2373
+     * Alias of self::set_author().
2374
+     *
2375
+     * @since 1.0.19
2376
+     * @param  int $value New user id.
2377
+     */
2378
+    public function set_user_id( $value ) {
2379
+        $this->set_author( $value );
2380
+    }
2381
+
2382
+    /**
2383
+     * Sets the customer ID.
2384
+     *
2385
+     * @since 1.0.19
2386
+     * @param  int $value New user id.
2387
+     */
2388
+    public function set_customer_id( $value ) {
2389
+        $this->set_prop( 'customer_id', (int) $value );
2390
+    }
2391
+
2392
+    /**
2393
+     * Set the customer's ip.
2394
+     *
2395
+     * @since 1.0.19
2396
+     * @param  string $value ip address.
2397
+     */
2398
+    public function set_ip( $value ) {
2399
+        $this->set_prop( 'ip', $value );
2400
+    }
2401
+
2402
+    /**
2403
+     * Alias of self::set_ip().
2404
+     *
2405
+     * @since 1.0.19
2406
+     * @param  string $value ip address.
2407
+     */
2408
+    public function set_user_ip( $value ) {
2409
+        $this->set_ip( $value );
2410
+    }
2411
+
2412
+    /**
2413
+     * Set the customer's first name.
2414
+     *
2415
+     * @since 1.0.19
2416
+     * @param  string $value first name.
2417
+     */
2418
+    public function set_first_name( $value ) {
2419
+        $this->set_prop( 'first_name', $value );
2420
+    }
2421
+
2422
+    /**
2423
+     * Alias of self::set_first_name().
2424
+     *
2425
+     * @since 1.0.19
2426
+     * @param  string $value first name.
2427
+     */
2428
+    public function set_user_first_name( $value ) {
2429
+        $this->set_first_name( $value );
2430
+    }
2431
+
2432
+    /**
2433
+     * Alias of self::set_first_name().
2434
+     *
2435
+     * @since 1.0.19
2436
+     * @param  string $value first name.
2437
+     */
2438
+    public function set_customer_first_name( $value ) {
2439
+        $this->set_first_name( $value );
2440
+    }
2441
+
2442
+    /**
2443
+     * Set the customer's last name.
2444
+     *
2445
+     * @since 1.0.19
2446
+     * @param  string $value last name.
2447
+     */
2448
+    public function set_last_name( $value ) {
2449
+        $this->set_prop( 'last_name', $value );
2450
+    }
2451
+
2452
+    /**
2453
+     * Alias of self::set_last_name().
2454
+     *
2455
+     * @since 1.0.19
2456
+     * @param  string $value last name.
2457
+     */
2458
+    public function set_user_last_name( $value ) {
2459
+        $this->set_last_name( $value );
2460
+    }
2461
+
2462
+    /**
2463
+     * Alias of self::set_last_name().
2464
+     *
2465
+     * @since 1.0.19
2466
+     * @param  string $value last name.
2467
+     */
2468
+    public function set_customer_last_name( $value ) {
2469
+        $this->set_last_name( $value );
2334 2470
     }
2335 2471
 
2336 2472
     /**
2337
-	 * Alias of self::set_description().
2338
-	 *
2339
-	 * @since 1.0.19
2340
-	 * @param  string $value New description.
2341
-	 */
2342
-	public function set_excerpt( $value ) {
2343
-		$this->set_description( $value );
2473
+     * Set the customer's phone number.
2474
+     *
2475
+     * @since 1.0.19
2476
+     * @param  string $value phone.
2477
+     */
2478
+    public function set_phone( $value ) {
2479
+        $this->set_prop( 'phone', $value );
2480
+    }
2481
+
2482
+    /**
2483
+     * Alias of self::set_phone().
2484
+     *
2485
+     * @since 1.0.19
2486
+     * @param  string $value phone.
2487
+     */
2488
+    public function set_user_phone( $value ) {
2489
+        $this->set_phone( $value );
2344 2490
     }
2345 2491
 
2346 2492
     /**
2347
-	 * Alias of self::set_description().
2348
-	 *
2349
-	 * @since 1.0.19
2350
-	 * @param  string $value New description.
2351
-	 */
2352
-	public function set_summary( $value ) {
2353
-		$this->set_description( $value );
2493
+     * Alias of self::set_phone().
2494
+     *
2495
+     * @since 1.0.19
2496
+     * @param  string $value phone.
2497
+     */
2498
+    public function set_customer_phone( $value ) {
2499
+        $this->set_phone( $value );
2354 2500
     }
2355 2501
 
2356 2502
     /**
2357
-	 * Set the receiver of the invoice.
2358
-	 *
2359
-	 * @since 1.0.19
2360
-	 * @param  int $value New author.
2361
-	 */
2362
-	public function set_author( $value ) {
2363
-		$user = get_user_by( 'id', (int) $value );
2503
+     * Alias of self::set_phone().
2504
+     *
2505
+     * @since 1.0.19
2506
+     * @param  string $value phone.
2507
+     */
2508
+    public function set_phone_number( $value ) {
2509
+        $this->set_phone( $value );
2510
+    }
2364 2511
 
2365
-		if ( $user && $user->ID ) {
2366
-			$this->set_prop( 'author', $user->ID );
2367
-			$this->set_prop( 'email', $user->user_email );
2368
-		}
2512
+    /**
2513
+     * Set the customer's email address.
2514
+     *
2515
+     * @since 1.0.19
2516
+     * @param  string $value email address.
2517
+     */
2518
+    public function set_email( $value ) {
2519
+        $this->set_prop( 'email', $value );
2520
+    }
2369 2521
 
2522
+    /**
2523
+     * Alias of self::set_email().
2524
+     *
2525
+     * @since 1.0.19
2526
+     * @param  string $value email address.
2527
+     */
2528
+    public function set_user_email( $value ) {
2529
+        $this->set_email( $value );
2370 2530
     }
2371 2531
 
2372 2532
     /**
2373
-	 * Alias of self::set_author().
2374
-	 *
2375
-	 * @since 1.0.19
2376
-	 * @param  int $value New user id.
2377
-	 */
2378
-	public function set_user_id( $value ) {
2379
-		$this->set_author( $value );
2533
+     * Alias of self::set_email().
2534
+     *
2535
+     * @since 1.0.19
2536
+     * @param  string $value email address.
2537
+     */
2538
+    public function set_email_address( $value ) {
2539
+        $this->set_email( $value );
2380 2540
     }
2381 2541
 
2382 2542
     /**
2383
-	 * Sets the customer ID.
2384
-	 *
2385
-	 * @since 1.0.19
2386
-	 * @param  int $value New user id.
2387
-	 */
2388
-	public function set_customer_id( $value ) {
2389
-		$this->set_prop( 'customer_id', (int) $value );
2543
+     * Alias of self::set_email().
2544
+     *
2545
+     * @since 1.0.19
2546
+     * @param  string $value email address.
2547
+     */
2548
+    public function set_customer_email( $value ) {
2549
+        $this->set_email( $value );
2390 2550
     }
2391 2551
 
2392 2552
     /**
2393
-	 * Set the customer's ip.
2394
-	 *
2395
-	 * @since 1.0.19
2396
-	 * @param  string $value ip address.
2397
-	 */
2398
-	public function set_ip( $value ) {
2399
-		$this->set_prop( 'ip', $value );
2553
+     * Set the customer's country.
2554
+     *
2555
+     * @since 1.0.19
2556
+     * @param  string $value country.
2557
+     */
2558
+    public function set_country( $value ) {
2559
+        $this->set_prop( 'country', $value );
2400 2560
     }
2401 2561
 
2402 2562
     /**
2403
-	 * Alias of self::set_ip().
2404
-	 *
2405
-	 * @since 1.0.19
2406
-	 * @param  string $value ip address.
2407
-	 */
2408
-	public function set_user_ip( $value ) {
2409
-		$this->set_ip( $value );
2563
+     * Alias of self::set_country().
2564
+     *
2565
+     * @since 1.0.19
2566
+     * @param  string $value country.
2567
+     */
2568
+    public function set_user_country( $value ) {
2569
+        $this->set_country( $value );
2410 2570
     }
2411 2571
 
2412 2572
     /**
2413
-	 * Set the customer's first name.
2414
-	 *
2415
-	 * @since 1.0.19
2416
-	 * @param  string $value first name.
2417
-	 */
2418
-	public function set_first_name( $value ) {
2419
-		$this->set_prop( 'first_name', $value );
2573
+     * Alias of self::set_country().
2574
+     *
2575
+     * @since 1.0.19
2576
+     * @param  string $value country.
2577
+     */
2578
+    public function set_customer_country( $value ) {
2579
+        $this->set_country( $value );
2420 2580
     }
2421 2581
 
2422 2582
     /**
2423
-	 * Alias of self::set_first_name().
2424
-	 *
2425
-	 * @since 1.0.19
2426
-	 * @param  string $value first name.
2427
-	 */
2428
-	public function set_user_first_name( $value ) {
2429
-		$this->set_first_name( $value );
2583
+     * Set the customer's state.
2584
+     *
2585
+     * @since 1.0.19
2586
+     * @param  string $value state.
2587
+     */
2588
+    public function set_state( $value ) {
2589
+        $this->set_prop( 'state', $value );
2430 2590
     }
2431 2591
 
2432 2592
     /**
2433
-	 * Alias of self::set_first_name().
2434
-	 *
2435
-	 * @since 1.0.19
2436
-	 * @param  string $value first name.
2437
-	 */
2438
-	public function set_customer_first_name( $value ) {
2439
-		$this->set_first_name( $value );
2593
+     * Alias of self::set_state().
2594
+     *
2595
+     * @since 1.0.19
2596
+     * @param  string $value state.
2597
+     */
2598
+    public function set_user_state( $value ) {
2599
+        $this->set_state( $value );
2440 2600
     }
2441 2601
 
2442 2602
     /**
2443
-	 * Set the customer's last name.
2444
-	 *
2445
-	 * @since 1.0.19
2446
-	 * @param  string $value last name.
2447
-	 */
2448
-	public function set_last_name( $value ) {
2449
-		$this->set_prop( 'last_name', $value );
2603
+     * Alias of self::set_state().
2604
+     *
2605
+     * @since 1.0.19
2606
+     * @param  string $value state.
2607
+     */
2608
+    public function set_customer_state( $value ) {
2609
+        $this->set_state( $value );
2450 2610
     }
2451 2611
 
2452 2612
     /**
2453
-	 * Alias of self::set_last_name().
2454
-	 *
2455
-	 * @since 1.0.19
2456
-	 * @param  string $value last name.
2457
-	 */
2458
-	public function set_user_last_name( $value ) {
2459
-		$this->set_last_name( $value );
2613
+     * Set the customer's city.
2614
+     *
2615
+     * @since 1.0.19
2616
+     * @param  string $value city.
2617
+     */
2618
+    public function set_city( $value ) {
2619
+        $this->set_prop( 'city', $value );
2460 2620
     }
2461 2621
 
2462 2622
     /**
2463
-	 * Alias of self::set_last_name().
2464
-	 *
2465
-	 * @since 1.0.19
2466
-	 * @param  string $value last name.
2467
-	 */
2468
-	public function set_customer_last_name( $value ) {
2469
-		$this->set_last_name( $value );
2623
+     * Alias of self::set_city().
2624
+     *
2625
+     * @since 1.0.19
2626
+     * @param  string $value city.
2627
+     */
2628
+    public function set_user_city( $value ) {
2629
+        $this->set_city( $value );
2470 2630
     }
2471 2631
 
2472 2632
     /**
2473
-	 * Set the customer's phone number.
2474
-	 *
2475
-	 * @since 1.0.19
2476
-	 * @param  string $value phone.
2477
-	 */
2478
-	public function set_phone( $value ) {
2479
-		$this->set_prop( 'phone', $value );
2633
+     * Alias of self::set_city().
2634
+     *
2635
+     * @since 1.0.19
2636
+     * @param  string $value city.
2637
+     */
2638
+    public function set_customer_city( $value ) {
2639
+        $this->set_city( $value );
2480 2640
     }
2481 2641
 
2482 2642
     /**
2483
-	 * Alias of self::set_phone().
2484
-	 *
2485
-	 * @since 1.0.19
2486
-	 * @param  string $value phone.
2487
-	 */
2488
-	public function set_user_phone( $value ) {
2489
-		$this->set_phone( $value );
2643
+     * Set the customer's zip code.
2644
+     *
2645
+     * @since 1.0.19
2646
+     * @param  string $value zip.
2647
+     */
2648
+    public function set_zip( $value ) {
2649
+        $this->set_prop( 'zip', $value );
2490 2650
     }
2491 2651
 
2492 2652
     /**
2493
-	 * Alias of self::set_phone().
2494
-	 *
2495
-	 * @since 1.0.19
2496
-	 * @param  string $value phone.
2497
-	 */
2498
-	public function set_customer_phone( $value ) {
2499
-		$this->set_phone( $value );
2653
+     * Alias of self::set_zip().
2654
+     *
2655
+     * @since 1.0.19
2656
+     * @param  string $value zip.
2657
+     */
2658
+    public function set_user_zip( $value ) {
2659
+        $this->set_zip( $value );
2500 2660
     }
2501 2661
 
2502 2662
     /**
2503
-	 * Alias of self::set_phone().
2504
-	 *
2505
-	 * @since 1.0.19
2506
-	 * @param  string $value phone.
2507
-	 */
2508
-	public function set_phone_number( $value ) {
2509
-		$this->set_phone( $value );
2663
+     * Alias of self::set_zip().
2664
+     *
2665
+     * @since 1.0.19
2666
+     * @param  string $value zip.
2667
+     */
2668
+    public function set_customer_zip( $value ) {
2669
+        $this->set_zip( $value );
2510 2670
     }
2511 2671
 
2512 2672
     /**
2513
-	 * Set the customer's email address.
2514
-	 *
2515
-	 * @since 1.0.19
2516
-	 * @param  string $value email address.
2517
-	 */
2518
-	public function set_email( $value ) {
2519
-		$this->set_prop( 'email', $value );
2673
+     * Set the customer's company.
2674
+     *
2675
+     * @since 1.0.19
2676
+     * @param  string $value company.
2677
+     */
2678
+    public function set_company( $value ) {
2679
+        $this->set_prop( 'company', $value );
2520 2680
     }
2521 2681
 
2522 2682
     /**
2523
-	 * Alias of self::set_email().
2524
-	 *
2525
-	 * @since 1.0.19
2526
-	 * @param  string $value email address.
2527
-	 */
2528
-	public function set_user_email( $value ) {
2529
-		$this->set_email( $value );
2683
+     * Alias of self::set_company().
2684
+     *
2685
+     * @since 1.0.19
2686
+     * @param  string $value company.
2687
+     */
2688
+    public function set_user_company( $value ) {
2689
+        $this->set_company( $value );
2530 2690
     }
2531 2691
 
2532 2692
     /**
2533
-	 * Alias of self::set_email().
2534
-	 *
2535
-	 * @since 1.0.19
2536
-	 * @param  string $value email address.
2537
-	 */
2538
-	public function set_email_address( $value ) {
2539
-		$this->set_email( $value );
2693
+     * Alias of self::set_company().
2694
+     *
2695
+     * @since 1.0.19
2696
+     * @param  string $value company.
2697
+     */
2698
+    public function set_customer_company( $value ) {
2699
+        $this->set_company( $value );
2540 2700
     }
2541 2701
 
2542 2702
     /**
2543
-	 * Alias of self::set_email().
2544
-	 *
2545
-	 * @since 1.0.19
2546
-	 * @param  string $value email address.
2547
-	 */
2548
-	public function set_customer_email( $value ) {
2549
-		$this->set_email( $value );
2703
+     * Set the customer's company id.
2704
+     *
2705
+     * @since 1.0.19
2706
+     * @param  string $value company id.
2707
+     */
2708
+    public function set_company_id( $value ) {
2709
+        $this->set_prop( 'company_id', $value );
2550 2710
     }
2551 2711
 
2552 2712
     /**
2553
-	 * Set the customer's country.
2554
-	 *
2555
-	 * @since 1.0.19
2556
-	 * @param  string $value country.
2557
-	 */
2558
-	public function set_country( $value ) {
2559
-		$this->set_prop( 'country', $value );
2713
+     * Set the customer's var number.
2714
+     *
2715
+     * @since 1.0.19
2716
+     * @param  string $value var number.
2717
+     */
2718
+    public function set_vat_number( $value ) {
2719
+        $this->set_prop( 'vat_number', $value );
2560 2720
     }
2561 2721
 
2562 2722
     /**
2563
-	 * Alias of self::set_country().
2564
-	 *
2565
-	 * @since 1.0.19
2566
-	 * @param  string $value country.
2567
-	 */
2568
-	public function set_user_country( $value ) {
2569
-		$this->set_country( $value );
2723
+     * Alias of self::set_vat_number().
2724
+     *
2725
+     * @since 1.0.19
2726
+     * @param  string $value var number.
2727
+     */
2728
+    public function set_user_vat_number( $value ) {
2729
+        $this->set_vat_number( $value );
2570 2730
     }
2571 2731
 
2572 2732
     /**
2573
-	 * Alias of self::set_country().
2574
-	 *
2575
-	 * @since 1.0.19
2576
-	 * @param  string $value country.
2577
-	 */
2578
-	public function set_customer_country( $value ) {
2579
-		$this->set_country( $value );
2733
+     * Alias of self::set_vat_number().
2734
+     *
2735
+     * @since 1.0.19
2736
+     * @param  string $value var number.
2737
+     */
2738
+    public function set_customer_vat_number( $value ) {
2739
+        $this->set_vat_number( $value );
2580 2740
     }
2581 2741
 
2582 2742
     /**
2583
-	 * Set the customer's state.
2584
-	 *
2585
-	 * @since 1.0.19
2586
-	 * @param  string $value state.
2587
-	 */
2588
-	public function set_state( $value ) {
2589
-		$this->set_prop( 'state', $value );
2743
+     * Set the customer's vat rate.
2744
+     *
2745
+     * @since 1.0.19
2746
+     * @param  string $value var rate.
2747
+     */
2748
+    public function set_vat_rate( $value ) {
2749
+        $this->set_prop( 'vat_rate', $value );
2590 2750
     }
2591 2751
 
2592 2752
     /**
2593
-	 * Alias of self::set_state().
2594
-	 *
2595
-	 * @since 1.0.19
2596
-	 * @param  string $value state.
2597
-	 */
2598
-	public function set_user_state( $value ) {
2599
-		$this->set_state( $value );
2753
+     * Alias of self::set_vat_rate().
2754
+     *
2755
+     * @since 1.0.19
2756
+     * @param  string $value var number.
2757
+     */
2758
+    public function set_user_vat_rate( $value ) {
2759
+        $this->set_vat_rate( $value );
2600 2760
     }
2601 2761
 
2602 2762
     /**
2603
-	 * Alias of self::set_state().
2604
-	 *
2605
-	 * @since 1.0.19
2606
-	 * @param  string $value state.
2607
-	 */
2608
-	public function set_customer_state( $value ) {
2609
-		$this->set_state( $value );
2763
+     * Alias of self::set_vat_rate().
2764
+     *
2765
+     * @since 1.0.19
2766
+     * @param  string $value var number.
2767
+     */
2768
+    public function set_customer_vat_rate( $value ) {
2769
+        $this->set_vat_rate( $value );
2610 2770
     }
2611 2771
 
2612 2772
     /**
2613
-	 * Set the customer's city.
2614
-	 *
2615
-	 * @since 1.0.19
2616
-	 * @param  string $value city.
2617
-	 */
2618
-	public function set_city( $value ) {
2619
-		$this->set_prop( 'city', $value );
2773
+     * Set the customer's address.
2774
+     *
2775
+     * @since 1.0.19
2776
+     * @param  string $value address.
2777
+     */
2778
+    public function set_address( $value ) {
2779
+        $this->set_prop( 'address', $value );
2620 2780
     }
2621 2781
 
2622 2782
     /**
2623
-	 * Alias of self::set_city().
2624
-	 *
2625
-	 * @since 1.0.19
2626
-	 * @param  string $value city.
2627
-	 */
2628
-	public function set_user_city( $value ) {
2629
-		$this->set_city( $value );
2783
+     * Alias of self::set_address().
2784
+     *
2785
+     * @since 1.0.19
2786
+     * @param  string $value address.
2787
+     */
2788
+    public function set_user_address( $value ) {
2789
+        $this->set_address( $value );
2630 2790
     }
2631 2791
 
2632 2792
     /**
2633
-	 * Alias of self::set_city().
2634
-	 *
2635
-	 * @since 1.0.19
2636
-	 * @param  string $value city.
2637
-	 */
2638
-	public function set_customer_city( $value ) {
2639
-		$this->set_city( $value );
2793
+     * Alias of self::set_address().
2794
+     *
2795
+     * @since 1.0.19
2796
+     * @param  string $value address.
2797
+     */
2798
+    public function set_customer_address( $value ) {
2799
+        $this->set_address( $value );
2640 2800
     }
2641 2801
 
2642 2802
     /**
2643
-	 * Set the customer's zip code.
2644
-	 *
2645
-	 * @since 1.0.19
2646
-	 * @param  string $value zip.
2647
-	 */
2648
-	public function set_zip( $value ) {
2649
-		$this->set_prop( 'zip', $value );
2803
+     * Set whether the customer has viewed the invoice or not.
2804
+     *
2805
+     * @since 1.0.19
2806
+     * @param  int|bool $value confirmed.
2807
+     */
2808
+    public function set_is_viewed( $value ) {
2809
+        $this->set_prop( 'is_viewed', $value );
2650 2810
     }
2651 2811
 
2652 2812
     /**
2653
-	 * Alias of self::set_zip().
2654
-	 *
2655
-	 * @since 1.0.19
2656
-	 * @param  string $value zip.
2657
-	 */
2658
-	public function set_user_zip( $value ) {
2659
-		$this->set_zip( $value );
2813
+     * Set extra email recipients.
2814
+     *
2815
+     * @since 1.0.19
2816
+     * @param  string $value email recipients.
2817
+     */
2818
+    public function set_email_cc( $value ) {
2819
+        $this->set_prop( 'email_cc', $value );
2660 2820
     }
2661 2821
 
2662 2822
     /**
2663
-	 * Alias of self::set_zip().
2664
-	 *
2665
-	 * @since 1.0.19
2666
-	 * @param  string $value zip.
2667
-	 */
2668
-	public function set_customer_zip( $value ) {
2669
-		$this->set_zip( $value );
2823
+     * Set the invoice template.
2824
+     *
2825
+     * @since 1.0.19
2826
+     * @param  string $value template.
2827
+     */
2828
+    public function set_template( $value ) {
2829
+        if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2830
+            $this->set_prop( 'template', $value );
2831
+        }
2670 2832
     }
2671 2833
 
2672 2834
     /**
2673
-	 * Set the customer's company.
2674
-	 *
2675
-	 * @since 1.0.19
2676
-	 * @param  string $value company.
2677
-	 */
2678
-	public function set_company( $value ) {
2679
-		$this->set_prop( 'company', $value );
2835
+     * Set the invoice source.
2836
+     *
2837
+     * @since 1.0.19
2838
+     * @param  string $value source.
2839
+     * @deprecated
2840
+     */
2841
+    public function created_via( $value ) {
2842
+        $this->set_created_via( sanitize_text_field( $value ) );
2680 2843
     }
2681 2844
 
2682 2845
     /**
2683
-	 * Alias of self::set_company().
2684
-	 *
2685
-	 * @since 1.0.19
2686
-	 * @param  string $value company.
2687
-	 */
2688
-	public function set_user_company( $value ) {
2689
-		$this->set_company( $value );
2846
+     * Set the invoice source.
2847
+     *
2848
+     * @since 1.0.19
2849
+     * @param  string $value source.
2850
+     */
2851
+    public function set_created_via( $value ) {
2852
+        $this->set_prop( 'created_via', sanitize_text_field( $value ) );
2690 2853
     }
2691 2854
 
2692 2855
     /**
2693
-	 * Alias of self::set_company().
2694
-	 *
2695
-	 * @since 1.0.19
2696
-	 * @param  string $value company.
2697
-	 */
2698
-	public function set_customer_company( $value ) {
2699
-		$this->set_company( $value );
2700
-    }
2701
-
2702
-	/**
2703
-	 * Set the customer's company id.
2704
-	 *
2705
-	 * @since 1.0.19
2706
-	 * @param  string $value company id.
2707
-	 */
2708
-	public function set_company_id( $value ) {
2709
-		$this->set_prop( 'company_id', $value );
2856
+     * Set the customer's address confirmed status.
2857
+     *
2858
+     * @since 1.0.19
2859
+     * @param  int|bool $value confirmed.
2860
+     */
2861
+    public function set_address_confirmed( $value ) {
2862
+        $this->set_prop( 'address_confirmed', $value );
2710 2863
     }
2711 2864
 
2712 2865
     /**
2713
-	 * Set the customer's var number.
2714
-	 *
2715
-	 * @since 1.0.19
2716
-	 * @param  string $value var number.
2717
-	 */
2718
-	public function set_vat_number( $value ) {
2719
-		$this->set_prop( 'vat_number', $value );
2866
+     * Alias of self::set_address_confirmed().
2867
+     *
2868
+     * @since 1.0.19
2869
+     * @param  int|bool $value confirmed.
2870
+     */
2871
+    public function set_user_address_confirmed( $value ) {
2872
+        $this->set_address_confirmed( $value );
2720 2873
     }
2721 2874
 
2722 2875
     /**
2723
-	 * Alias of self::set_vat_number().
2724
-	 *
2725
-	 * @since 1.0.19
2726
-	 * @param  string $value var number.
2727
-	 */
2728
-	public function set_user_vat_number( $value ) {
2729
-		$this->set_vat_number( $value );
2876
+     * Alias of self::set_address_confirmed().
2877
+     *
2878
+     * @since 1.0.19
2879
+     * @param  int|bool $value confirmed.
2880
+     */
2881
+    public function set_customer_address_confirmed( $value ) {
2882
+        $this->set_address_confirmed( $value );
2730 2883
     }
2731 2884
 
2732 2885
     /**
2733
-	 * Alias of self::set_vat_number().
2734
-	 *
2735
-	 * @since 1.0.19
2736
-	 * @param  string $value var number.
2737
-	 */
2738
-	public function set_customer_vat_number( $value ) {
2739
-		$this->set_vat_number( $value );
2886
+     * Set the shipping fee
2887
+     *
2888
+     * @since 1.0.19
2889
+     * @param  float $value shipping amount.
2890
+     */
2891
+    public function set_shipping( $value ) {
2892
+
2893
+        if ( ! is_numeric( $value ) ) {
2894
+            return $this->set_prop( 'shipping', null );
2895
+        }
2896
+
2897
+        $this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2740 2898
     }
2741 2899
 
2742 2900
     /**
2743
-	 * Set the customer's vat rate.
2744
-	 *
2745
-	 * @since 1.0.19
2746
-	 * @param  string $value var rate.
2747
-	 */
2748
-	public function set_vat_rate( $value ) {
2749
-		$this->set_prop( 'vat_rate', $value );
2901
+     * Set the invoice sub total.
2902
+     *
2903
+     * @since 1.0.19
2904
+     * @param  float $value sub total.
2905
+     */
2906
+    public function set_subtotal( $value ) {
2907
+        $this->set_prop( 'subtotal', max( 0, $value ) );
2750 2908
     }
2751 2909
 
2752
-    /**
2753
-	 * Alias of self::set_vat_rate().
2754
-	 *
2755
-	 * @since 1.0.19
2756
-	 * @param  string $value var number.
2757
-	 */
2758
-	public function set_user_vat_rate( $value ) {
2759
-		$this->set_vat_rate( $value );
2760
-    }
2761
-
2762
-    /**
2763
-	 * Alias of self::set_vat_rate().
2764
-	 *
2765
-	 * @since 1.0.19
2766
-	 * @param  string $value var number.
2767
-	 */
2768
-	public function set_customer_vat_rate( $value ) {
2769
-		$this->set_vat_rate( $value );
2770
-    }
2771
-
2772
-    /**
2773
-	 * Set the customer's address.
2774
-	 *
2775
-	 * @since 1.0.19
2776
-	 * @param  string $value address.
2777
-	 */
2778
-	public function set_address( $value ) {
2779
-		$this->set_prop( 'address', $value );
2780
-    }
2781
-
2782
-    /**
2783
-	 * Alias of self::set_address().
2784
-	 *
2785
-	 * @since 1.0.19
2786
-	 * @param  string $value address.
2787
-	 */
2788
-	public function set_user_address( $value ) {
2789
-		$this->set_address( $value );
2790
-    }
2791
-
2792
-    /**
2793
-	 * Alias of self::set_address().
2794
-	 *
2795
-	 * @since 1.0.19
2796
-	 * @param  string $value address.
2797
-	 */
2798
-	public function set_customer_address( $value ) {
2799
-		$this->set_address( $value );
2800
-    }
2801
-
2802
-    /**
2803
-	 * Set whether the customer has viewed the invoice or not.
2804
-	 *
2805
-	 * @since 1.0.19
2806
-	 * @param  int|bool $value confirmed.
2807
-	 */
2808
-	public function set_is_viewed( $value ) {
2809
-		$this->set_prop( 'is_viewed', $value );
2810
-	}
2811
-
2812
-	/**
2813
-	 * Set extra email recipients.
2814
-	 *
2815
-	 * @since 1.0.19
2816
-	 * @param  string $value email recipients.
2817
-	 */
2818
-	public function set_email_cc( $value ) {
2819
-		$this->set_prop( 'email_cc', $value );
2820
-	}
2821
-
2822
-	/**
2823
-	 * Set the invoice template.
2824
-	 *
2825
-	 * @since 1.0.19
2826
-	 * @param  string $value template.
2827
-	 */
2828
-	public function set_template( $value ) {
2829
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2830
-			$this->set_prop( 'template', $value );
2831
-		}
2832
-	}
2833
-
2834
-	/**
2835
-	 * Set the invoice source.
2836
-	 *
2837
-	 * @since 1.0.19
2838
-	 * @param  string $value source.
2839
-	 * @deprecated
2840
-	 */
2841
-	public function created_via( $value ) {
2842
-		$this->set_created_via( sanitize_text_field( $value ) );
2843
-	}
2844
-
2845
-	/**
2846
-	 * Set the invoice source.
2847
-	 *
2848
-	 * @since 1.0.19
2849
-	 * @param  string $value source.
2850
-	 */
2851
-	public function set_created_via( $value ) {
2852
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2853
-	}
2854
-
2855
-	/**
2856
-	 * Set the customer's address confirmed status.
2857
-	 *
2858
-	 * @since 1.0.19
2859
-	 * @param  int|bool $value confirmed.
2860
-	 */
2861
-	public function set_address_confirmed( $value ) {
2862
-		$this->set_prop( 'address_confirmed', $value );
2863
-    }
2864
-
2865
-    /**
2866
-	 * Alias of self::set_address_confirmed().
2867
-	 *
2868
-	 * @since 1.0.19
2869
-	 * @param  int|bool $value confirmed.
2870
-	 */
2871
-	public function set_user_address_confirmed( $value ) {
2872
-		$this->set_address_confirmed( $value );
2873
-    }
2874
-
2875
-    /**
2876
-	 * Alias of self::set_address_confirmed().
2877
-	 *
2878
-	 * @since 1.0.19
2879
-	 * @param  int|bool $value confirmed.
2880
-	 */
2881
-	public function set_customer_address_confirmed( $value ) {
2882
-		$this->set_address_confirmed( $value );
2883
-    }
2884
-
2885
-    /**
2886
-	 * Set the shipping fee
2887
-	 *
2888
-	 * @since 1.0.19
2889
-	 * @param  float $value shipping amount.
2890
-	 */
2891
-	public function set_shipping( $value ) {
2892
-
2893
-		if ( ! is_numeric( $value ) ) {
2894
-			return $this->set_prop( 'shipping', null );
2895
-		}
2896
-
2897
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2898
-	}
2899
-
2900
-	/**
2901
-	 * Set the invoice sub total.
2902
-	 *
2903
-	 * @since 1.0.19
2904
-	 * @param  float $value sub total.
2905
-	 */
2906
-	public function set_subtotal( $value ) {
2907
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2908
-	}
2909
-
2910
-	/**
2911
-	 * Set the invoice total.
2912
-	 *
2913
-	 * @since 1.0.19
2914
-	 * @param  float $value sub total.
2915
-	 */
2916
-	public function set_total( $value ) {
2917
-		$this->set_prop( 'total', max( 0, $value ) );
2910
+    /**
2911
+     * Set the invoice total.
2912
+     *
2913
+     * @since 1.0.19
2914
+     * @param  float $value sub total.
2915
+     */
2916
+    public function set_total( $value ) {
2917
+        $this->set_prop( 'total', max( 0, $value ) );
2918 2918
     }
2919 2919
 
2920 2920
     /**
2921
-	 * Set the invoice discount amount.
2922
-	 *
2923
-	 * @since 1.0.19
2924
-	 * @param  float $value discount total.
2925
-	 */
2926
-	public function set_total_discount( $value ) {
2927
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2921
+     * Set the invoice discount amount.
2922
+     *
2923
+     * @since 1.0.19
2924
+     * @param  float $value discount total.
2925
+     */
2926
+    public function set_total_discount( $value ) {
2927
+        $this->set_prop( 'total_discount', max( 0, $value ) );
2928 2928
     }
2929 2929
 
2930 2930
     /**
2931
-	 * Alias of self::set_total_discount().
2932
-	 *
2933
-	 * @since 1.0.19
2934
-	 * @param  float $value discount total.
2935
-	 */
2936
-	public function set_discount( $value ) {
2937
-		$this->set_total_discount( $value );
2931
+     * Alias of self::set_total_discount().
2932
+     *
2933
+     * @since 1.0.19
2934
+     * @param  float $value discount total.
2935
+     */
2936
+    public function set_discount( $value ) {
2937
+        $this->set_total_discount( $value );
2938 2938
     }
2939 2939
 
2940 2940
     /**
2941
-	 * Set the invoice tax amount.
2942
-	 *
2943
-	 * @since 1.0.19
2944
-	 * @param  float $value tax total.
2945
-	 */
2946
-	public function set_total_tax( $value ) {
2947
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2941
+     * Set the invoice tax amount.
2942
+     *
2943
+     * @since 1.0.19
2944
+     * @param  float $value tax total.
2945
+     */
2946
+    public function set_total_tax( $value ) {
2947
+        $this->set_prop( 'total_tax', max( 0, $value ) );
2948 2948
     }
2949 2949
 
2950 2950
     /**
2951
-	 * Alias of self::set_total_tax().
2952
-	 *
2953
-	 * @since 1.0.19
2954
-	 * @param  float $value tax total.
2955
-	 */
2956
-	public function set_tax_total( $value ) {
2957
-		$this->set_total_tax( $value );
2951
+     * Alias of self::set_total_tax().
2952
+     *
2953
+     * @since 1.0.19
2954
+     * @param  float $value tax total.
2955
+     */
2956
+    public function set_tax_total( $value ) {
2957
+        $this->set_total_tax( $value );
2958 2958
     }
2959 2959
 
2960 2960
     /**
2961
-	 * Set the invoice fees amount.
2962
-	 *
2963
-	 * @since 1.0.19
2964
-	 * @param  float $value fees total.
2965
-	 */
2966
-	public function set_total_fees( $value ) {
2967
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2961
+     * Set the invoice fees amount.
2962
+     *
2963
+     * @since 1.0.19
2964
+     * @param  float $value fees total.
2965
+     */
2966
+    public function set_total_fees( $value ) {
2967
+        $this->set_prop( 'total_fees', max( 0, $value ) );
2968 2968
     }
2969 2969
 
2970 2970
     /**
2971
-	 * Alias of self::set_total_fees().
2972
-	 *
2973
-	 * @since 1.0.19
2974
-	 * @param  float $value fees total.
2975
-	 */
2976
-	public function set_fees_total( $value ) {
2977
-		$this->set_total_fees( $value );
2971
+     * Alias of self::set_total_fees().
2972
+     *
2973
+     * @since 1.0.19
2974
+     * @param  float $value fees total.
2975
+     */
2976
+    public function set_fees_total( $value ) {
2977
+        $this->set_total_fees( $value );
2978 2978
     }
2979 2979
 
2980 2980
     /**
2981
-	 * Set the invoice fees.
2982
-	 *
2983
-	 * @since 1.0.19
2984
-	 * @param  array $value fees.
2985
-	 */
2986
-	public function set_fees( $value ) {
2981
+     * Set the invoice fees.
2982
+     *
2983
+     * @since 1.0.19
2984
+     * @param  array $value fees.
2985
+     */
2986
+    public function set_fees( $value ) {
2987 2987
 
2988
-		if ( ! is_array( $value ) ) {
2989
-			$value = array();
2990
-		}
2988
+        if ( ! is_array( $value ) ) {
2989
+            $value = array();
2990
+        }
2991 2991
 
2992
-		$this->set_prop( 'fees', $value );
2992
+        $this->set_prop( 'fees', $value );
2993 2993
 
2994 2994
     }
2995 2995
 
2996 2996
     /**
2997
-	 * Set the invoice taxes.
2998
-	 *
2999
-	 * @since 1.0.19
3000
-	 * @param  array $value taxes.
3001
-	 */
3002
-	public function set_taxes( $value ) {
2997
+     * Set the invoice taxes.
2998
+     *
2999
+     * @since 1.0.19
3000
+     * @param  array $value taxes.
3001
+     */
3002
+    public function set_taxes( $value ) {
3003 3003
 
3004
-		if ( ! is_array( $value ) ) {
3005
-			$value = array();
3006
-		}
3004
+        if ( ! is_array( $value ) ) {
3005
+            $value = array();
3006
+        }
3007 3007
 
3008
-		$this->set_prop( 'taxes', $value );
3008
+        $this->set_prop( 'taxes', $value );
3009 3009
 
3010 3010
     }
3011 3011
 
3012 3012
     /**
3013
-	 * Set the invoice discounts.
3014
-	 *
3015
-	 * @since 1.0.19
3016
-	 * @param  array $value discounts.
3017
-	 */
3018
-	public function set_discounts( $value ) {
3013
+     * Set the invoice discounts.
3014
+     *
3015
+     * @since 1.0.19
3016
+     * @param  array $value discounts.
3017
+     */
3018
+    public function set_discounts( $value ) {
3019 3019
 
3020
-		if ( ! is_array( $value ) ) {
3021
-			$value = array();
3022
-		}
3020
+        if ( ! is_array( $value ) ) {
3021
+            $value = array();
3022
+        }
3023 3023
 
3024
-		$this->set_prop( 'discounts', $value );
3024
+        $this->set_prop( 'discounts', $value );
3025 3025
     }
3026 3026
 
3027 3027
     /**
3028
-	 * Set the invoice items.
3029
-	 *
3030
-	 * @since 1.0.19
3031
-	 * @param  GetPaid_Form_Item[] $value items.
3032
-	 */
3033
-	public function set_items( $value ) {
3028
+     * Set the invoice items.
3029
+     *
3030
+     * @since 1.0.19
3031
+     * @param  GetPaid_Form_Item[] $value items.
3032
+     */
3033
+    public function set_items( $value ) {
3034 3034
 
3035 3035
         // Remove existing items.
3036 3036
         $this->set_prop( 'items', array() );
3037
-		$this->recurring_item = null;
3037
+        $this->recurring_item = null;
3038 3038
 
3039 3039
         // Ensure that we have an array.
3040 3040
         if ( ! is_array( $value ) ) {
@@ -3048,105 +3048,105 @@  discard block
 block discarded – undo
3048 3048
     }
3049 3049
 
3050 3050
     /**
3051
-	 * Set the payment form.
3052
-	 *
3053
-	 * @since 1.0.19
3054
-	 * @param  int $value payment form.
3055
-	 */
3056
-	public function set_payment_form( $value ) {
3057
-		$this->set_prop( 'payment_form', $value );
3051
+     * Set the payment form.
3052
+     *
3053
+     * @since 1.0.19
3054
+     * @param  int $value payment form.
3055
+     */
3056
+    public function set_payment_form( $value ) {
3057
+        $this->set_prop( 'payment_form', $value );
3058 3058
     }
3059 3059
 
3060 3060
     /**
3061
-	 * Set the submission id.
3062
-	 *
3063
-	 * @since 1.0.19
3064
-	 * @param  string $value submission id.
3065
-	 */
3066
-	public function set_submission_id( $value ) {
3067
-		$this->set_prop( 'submission_id', $value );
3061
+     * Set the submission id.
3062
+     *
3063
+     * @since 1.0.19
3064
+     * @param  string $value submission id.
3065
+     */
3066
+    public function set_submission_id( $value ) {
3067
+        $this->set_prop( 'submission_id', $value );
3068 3068
     }
3069 3069
 
3070 3070
     /**
3071
-	 * Set the discount code.
3072
-	 *
3073
-	 * @since 1.0.19
3074
-	 * @param  string $value discount code.
3075
-	 */
3076
-	public function set_discount_code( $value ) {
3077
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3071
+     * Set the discount code.
3072
+     *
3073
+     * @since 1.0.19
3074
+     * @param  string $value discount code.
3075
+     */
3076
+    public function set_discount_code( $value ) {
3077
+        $this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3078 3078
     }
3079 3079
 
3080 3080
     /**
3081
-	 * Set the gateway.
3082
-	 *
3083
-	 * @since 1.0.19
3084
-	 * @param  string $value gateway.
3085
-	 */
3086
-	public function set_gateway( $value ) {
3087
-		$this->set_prop( 'gateway', $value );
3081
+     * Set the gateway.
3082
+     *
3083
+     * @since 1.0.19
3084
+     * @param  string $value gateway.
3085
+     */
3086
+    public function set_gateway( $value ) {
3087
+        $this->set_prop( 'gateway', $value );
3088 3088
     }
3089 3089
 
3090 3090
     /**
3091
-	 * Set the transaction id.
3092
-	 *
3093
-	 * @since 1.0.19
3094
-	 * @param  string $value transaction id.
3095
-	 */
3096
-	public function set_transaction_id( $value ) {
3097
-		if ( ! empty( $value ) ) {
3098
-			$this->set_prop( 'transaction_id', $value );
3099
-		}
3091
+     * Set the transaction id.
3092
+     *
3093
+     * @since 1.0.19
3094
+     * @param  string $value transaction id.
3095
+     */
3096
+    public function set_transaction_id( $value ) {
3097
+        if ( ! empty( $value ) ) {
3098
+            $this->set_prop( 'transaction_id', $value );
3099
+        }
3100 3100
     }
3101 3101
 
3102 3102
     /**
3103
-	 * Set the currency id.
3104
-	 *
3105
-	 * @since 1.0.19
3106
-	 * @param  string $value currency id.
3107
-	 */
3108
-	public function set_currency( $value ) {
3109
-		$this->set_prop( 'currency', $value );
3103
+     * Set the currency id.
3104
+     *
3105
+     * @since 1.0.19
3106
+     * @param  string $value currency id.
3107
+     */
3108
+    public function set_currency( $value ) {
3109
+        $this->set_prop( 'currency', $value );
3110 3110
     }
3111 3111
 
3112
-	/**
3113
-	 * Set whether to disable taxes.
3114
-	 *
3115
-	 * @since 1.0.19
3116
-	 * @param  bool $value value.
3117
-	 */
3118
-	public function set_disable_taxes( $value ) {
3119
-		$this->set_prop( 'disable_taxes', (bool) $value );
3120
-	}
3112
+    /**
3113
+     * Set whether to disable taxes.
3114
+     *
3115
+     * @since 1.0.19
3116
+     * @param  bool $value value.
3117
+     */
3118
+    public function set_disable_taxes( $value ) {
3119
+        $this->set_prop( 'disable_taxes', (bool) $value );
3120
+    }
3121 3121
 
3122 3122
     /**
3123
-	 * Set the subscription id.
3124
-	 *
3125
-	 * @since 1.0.19
3126
-	 * @param  string $value subscription id.
3127
-	 */
3128
-	public function set_subscription_id( $value ) {
3129
-		$this->set_prop( 'subscription_id', $value );
3130
-	}
3123
+     * Set the subscription id.
3124
+     *
3125
+     * @since 1.0.19
3126
+     * @param  string $value subscription id.
3127
+     */
3128
+    public function set_subscription_id( $value ) {
3129
+        $this->set_prop( 'subscription_id', $value );
3130
+    }
3131 3131
 
3132
-	/**
3133
-	 * Set the remote subscription id.
3134
-	 *
3135
-	 * @since 1.0.19
3136
-	 * @param  string $value subscription id.
3137
-	 */
3138
-	public function set_remote_subscription_id( $value ) {
3139
-		$this->set_prop( 'remote_subscription_id', $value );
3132
+    /**
3133
+     * Set the remote subscription id.
3134
+     *
3135
+     * @since 1.0.19
3136
+     * @param  string $value subscription id.
3137
+     */
3138
+    public function set_remote_subscription_id( $value ) {
3139
+        $this->set_prop( 'remote_subscription_id', $value );
3140 3140
     }
3141 3141
 
3142
-	/**
3143
-	 * Set the invoice anonymize status.
3144
-	 *
3145
-	 * @since 2.8.22
3146
-	 * @param  bool $is_anonymized is anonymized.
3147
-	 */
3148
-	public function set_is_anonymized( $is_anonymized ) {
3149
-		$this->set_prop( 'is_anonymized', (bool) $is_anonymized );
3142
+    /**
3143
+     * Set the invoice anonymize status.
3144
+     *
3145
+     * @since 2.8.22
3146
+     * @param  bool $is_anonymized is anonymized.
3147
+     */
3148
+    public function set_is_anonymized( $is_anonymized ) {
3149
+        $this->set_prop( 'is_anonymized', (bool) $is_anonymized );
3150 3150
     }
3151 3151
 
3152 3152
     /*
@@ -3185,24 +3185,24 @@  discard block
 block discarded – undo
3185 3185
      */
3186 3186
     public function is_taxable() {
3187 3187
         return ! $this->get_disable_taxes();
3188
-	}
3188
+    }
3189 3189
 
3190
-	/**
3191
-	 * @deprecated
3192
-	 */
3193
-	public function has_vat() {
3190
+    /**
3191
+     * @deprecated
3192
+     */
3193
+    public function has_vat() {
3194 3194
         return $this->is_taxable();
3195
-	}
3195
+    }
3196 3196
 
3197
-	/**
3198
-	 * Checks to see if the invoice requires payment.
3199
-	 */
3200
-	public function is_free() {
3197
+    /**
3198
+     * Checks to see if the invoice requires payment.
3199
+     */
3200
+    public function is_free() {
3201 3201
         $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3202 3202
 
3203
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3204
-			$is_free = false;
3205
-		}
3203
+        if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3204
+            $is_free = false;
3205
+        }
3206 3206
 
3207 3207
         return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3208 3208
     }
@@ -3213,46 +3213,46 @@  discard block
 block discarded – undo
3213 3213
     public function is_paid() {
3214 3214
         $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3215 3215
         return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3216
-	}
3216
+    }
3217 3217
 
3218
-	/**
3218
+    /**
3219 3219
      * Checks if the invoice needs payment.
3220 3220
      */
3221
-	public function needs_payment() {
3222
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3221
+    public function needs_payment() {
3222
+        $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3223 3223
         return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3224 3224
     }
3225 3225
 
3226
-	/**
3226
+    /**
3227 3227
      * Checks if the invoice is refunded.
3228 3228
      */
3229
-	public function is_refunded() {
3229
+    public function is_refunded() {
3230 3230
         $is_refunded = $this->has_status( 'wpi-refunded' );
3231 3231
         return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3232
-	}
3232
+    }
3233 3233
 
3234
-	/**
3234
+    /**
3235 3235
      * Checks if the invoice is held.
3236 3236
      */
3237
-	public function is_held() {
3237
+    public function is_held() {
3238 3238
         $is_held = $this->has_status( 'wpi-onhold' );
3239 3239
         return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3240
-	}
3240
+    }
3241 3241
 
3242
-	/**
3242
+    /**
3243 3243
      * Checks if the invoice is due.
3244 3244
      */
3245
-	public function is_due() {
3246
-		$due_date = $this->get_due_date();
3247
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3248
-	}
3245
+    public function is_due() {
3246
+        $due_date = $this->get_due_date();
3247
+        return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3248
+    }
3249 3249
 
3250
-	/**
3250
+    /**
3251 3251
      * Checks if the invoice is draft.
3252 3252
      */
3253
-	public function is_draft() {
3253
+    public function is_draft() {
3254 3254
         return $this->has_status( 'draft, auto-draft' );
3255
-	}
3255
+    }
3256 3256
 
3257 3257
     /**
3258 3258
      * Checks if the invoice has a given status.
@@ -3260,9 +3260,9 @@  discard block
 block discarded – undo
3260 3260
     public function has_status( $status ) {
3261 3261
         $status = wpinv_parse_list( $status );
3262 3262
         return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3263
-	}
3263
+    }
3264 3264
 
3265
-	/**
3265
+    /**
3266 3266
      * Checks if the invoice is of a given type.
3267 3267
      */
3268 3268
     public function is_type( $type ) {
@@ -3285,25 +3285,25 @@  discard block
 block discarded – undo
3285 3285
      */
3286 3286
     public function has_free_trial() {
3287 3287
         return $this->is_recurring() && 0 == $this->get_initial_total();
3288
-	}
3288
+    }
3289 3289
 
3290
-	/**
3290
+    /**
3291 3291
      * @deprecated
3292 3292
      */
3293 3293
     public function is_free_trial() {
3294 3294
         return $this->has_free_trial();
3295 3295
     }
3296 3296
 
3297
-	/**
3297
+    /**
3298 3298
      * Check if the initial payment if 0.
3299 3299
      *
3300 3300
      */
3301
-	public function is_initial_free() {
3301
+    public function is_initial_free() {
3302 3302
         $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3303 3303
         return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3304 3304
     }
3305 3305
 
3306
-	/**
3306
+    /**
3307 3307
      * Check if the recurring item has a free trial.
3308 3308
      *
3309 3309
      */
@@ -3316,16 +3316,16 @@  discard block
 block discarded – undo
3316 3316
 
3317 3317
         $item = $this->get_recurring( true );
3318 3318
         return $item->has_free_trial();
3319
-	}
3319
+    }
3320 3320
 
3321
-	/**
3321
+    /**
3322 3322
      * Check if the free trial is a result of a discount.
3323 3323
      */
3324 3324
     public function is_free_trial_from_discount() {
3325
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3326
-	}
3325
+        return $this->has_free_trial() && ! $this->item_has_free_trial();
3326
+    }
3327 3327
 
3328
-	/**
3328
+    /**
3329 3329
      * Checks if this is an anonymized invoice.
3330 3330
      *
3331 3331
      * @since 2.8.22
@@ -3334,12 +3334,12 @@  discard block
 block discarded – undo
3334 3334
         return true === (bool) $this->get_is_anonymized();
3335 3335
     }
3336 3336
 
3337
-	/**
3337
+    /**
3338 3338
      * @deprecated
3339 3339
      */
3340 3340
     public function discount_first_payment_only() {
3341 3341
 
3342
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3342
+        $discount = wpinv_get_discount_obj( $this->get_discount_code() );
3343 3343
         if ( ! $discount->exists() || ! $this->is_recurring() ) {
3344 3344
             return true;
3345 3345
         }
@@ -3364,146 +3364,146 @@  discard block
 block discarded – undo
3364 3364
      */
3365 3365
     public function add_item( $item ) {
3366 3366
 
3367
-		if ( is_array( $item ) ) {
3368
-			$item = $this->process_array_item( $item );
3369
-		}
3367
+        if ( is_array( $item ) ) {
3368
+            $item = $this->process_array_item( $item );
3369
+        }
3370 3370
 
3371
-		if ( is_numeric( $item ) ) {
3372
-			$item = new GetPaid_Form_Item( $item );
3373
-		}
3371
+        if ( is_numeric( $item ) ) {
3372
+            $item = new GetPaid_Form_Item( $item );
3373
+        }
3374 3374
 
3375 3375
         // Make sure that it is available for purchase.
3376
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3377
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3376
+        if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3377
+            return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3378 3378
         }
3379 3379
 
3380 3380
         // Do we have a recurring item?
3381
-		if ( $item->is_recurring() ) {
3382
-			$this->recurring_item = $item->get_id();
3381
+        if ( $item->is_recurring() ) {
3382
+            $this->recurring_item = $item->get_id();
3383 3383
         }
3384 3384
 
3385 3385
         // Invoice id.
3386 3386
         $item->invoice_id = (int) $this->get_id();
3387 3387
 
3388
-		// Remove duplicates.
3389
-		$this->remove_item( $item->get_id() );
3388
+        // Remove duplicates.
3389
+        $this->remove_item( $item->get_id() );
3390 3390
 
3391
-		if ( 0 == $item->get_quantity() ) {
3392
-			return;
3393
-		}
3391
+        if ( 0 == $item->get_quantity() ) {
3392
+            return;
3393
+        }
3394 3394
 
3395
-		// Retrieve all items.
3395
+        // Retrieve all items.
3396 3396
         $items   = $this->get_items();
3397 3397
 
3398
-		// Add new item.
3398
+        // Add new item.
3399 3399
         $items[] = $item;
3400 3400
 
3401 3401
         $this->set_prop( 'items', $items );
3402 3402
 
3403
-		return true;
3404
-	}
3403
+        return true;
3404
+    }
3405 3405
 
3406
-	/**
3407
-	 * Converts an array to an item.
3408
-	 *
3409
-	 * @since 1.0.19
3410
-	 * @return GetPaid_Form_Item
3411
-	 */
3412
-	protected function process_array_item( $array ) {
3406
+    /**
3407
+     * Converts an array to an item.
3408
+     *
3409
+     * @since 1.0.19
3410
+     * @return GetPaid_Form_Item
3411
+     */
3412
+    protected function process_array_item( $array ) {
3413 3413
 
3414
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3415
-		$item    = new GetPaid_Form_Item( $item_id );
3414
+        $item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3415
+        $item    = new GetPaid_Form_Item( $item_id );
3416 3416
 
3417
-		// Set item data.
3418
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3419
-			if ( isset( $array[ "item_$key" ] ) ) {
3420
-				$method = "set_$key";
3421
-				$item->$method( $array[ "item_$key" ] );
3422
-			}
3423
-		}
3417
+        // Set item data.
3418
+        foreach ( array( 'name', 'price', 'description' ) as $key ) {
3419
+            if ( isset( $array[ "item_$key" ] ) ) {
3420
+                $method = "set_$key";
3421
+                $item->$method( $array[ "item_$key" ] );
3422
+            }
3423
+        }
3424 3424
 
3425
-		if ( isset( $array['quantity'] ) ) {
3426
-			$item->set_quantity( $array['quantity'] );
3427
-		}
3425
+        if ( isset( $array['quantity'] ) ) {
3426
+            $item->set_quantity( $array['quantity'] );
3427
+        }
3428 3428
 
3429
-		// Set item meta.
3430
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3431
-			$item->set_item_meta( $array['meta'] );
3432
-		}
3429
+        // Set item meta.
3430
+        if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3431
+            $item->set_item_meta( $array['meta'] );
3432
+        }
3433 3433
 
3434
-		return $item;
3434
+        return $item;
3435 3435
 
3436
-	}
3436
+    }
3437 3437
 
3438 3438
     /**
3439
-	 * Retrieves a specific item.
3440
-	 *
3441
-	 * @since 1.0.19
3442
-	 * @return GetPaid_Form_Item|null
3443
-	 */
3444
-	public function get_item( $item_id ) {
3439
+     * Retrieves a specific item.
3440
+     *
3441
+     * @since 1.0.19
3442
+     * @return GetPaid_Form_Item|null
3443
+     */
3444
+    public function get_item( $item_id ) {
3445 3445
 
3446
-		foreach ( $this->get_items() as $item ) {
3447
-			if ( (int) $item_id == $item->get_id() ) {
3448
-				return $item;
3449
-			}
3450
-		}
3446
+        foreach ( $this->get_items() as $item ) {
3447
+            if ( (int) $item_id == $item->get_id() ) {
3448
+                return $item;
3449
+            }
3450
+        }
3451 3451
 
3452
-		return null;
3452
+        return null;
3453 3453
     }
3454 3454
 
3455 3455
     /**
3456
-	 * Removes a specific item.
3457
-	 *
3458
-	 * @since 1.0.19
3459
-	 */
3460
-	public function remove_item( $item_id ) {
3461
-		$items   = $this->get_items();
3462
-		$item_id = (int) $item_id;
3456
+     * Removes a specific item.
3457
+     *
3458
+     * @since 1.0.19
3459
+     */
3460
+    public function remove_item( $item_id ) {
3461
+        $items   = $this->get_items();
3462
+        $item_id = (int) $item_id;
3463 3463
 
3464
-		foreach ( $items as $index => $item ) {
3465
-			if ( (int) $item_id == $item->get_id() ) {
3466
-				unset( $items[ $index ] );
3467
-				$this->set_prop( 'items', $items );
3464
+        foreach ( $items as $index => $item ) {
3465
+            if ( (int) $item_id == $item->get_id() ) {
3466
+                unset( $items[ $index ] );
3467
+                $this->set_prop( 'items', $items );
3468 3468
 
3469
-				if ( $item_id == $this->recurring_item ) {
3470
-					$this->recurring_item = null;
3471
-				}
3469
+                if ( $item_id == $this->recurring_item ) {
3470
+                    $this->recurring_item = null;
3471
+                }
3472 3472
 }
3473
-		}
3473
+        }
3474 3474
 
3475 3475
     }
3476 3476
 
3477 3477
     /**
3478
-	 * Adds a fee to the invoice.
3479
-	 *
3480
-	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3481
-	 * @since 1.0.19
3482
-	 */
3478
+     * Adds a fee to the invoice.
3479
+     *
3480
+     * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3481
+     * @since 1.0.19
3482
+     */
3483 3483
     public function add_fee( $fee ) {
3484 3484
 
3485
-		$fees                 = $this->get_fees();
3486
-		$fees[ $fee['name'] ] = $fee;
3487
-		$this->set_prop( 'fees', $fees );
3485
+        $fees                 = $this->get_fees();
3486
+        $fees[ $fee['name'] ] = $fee;
3487
+        $this->set_prop( 'fees', $fees );
3488 3488
 
3489 3489
     }
3490 3490
 
3491 3491
     /**
3492
-	 * Retrieves a specific fee.
3493
-	 *
3494
-	 * @since 1.0.19
3495
-	 */
3496
-	public function get_fee( $fee ) {
3492
+     * Retrieves a specific fee.
3493
+     *
3494
+     * @since 1.0.19
3495
+     */
3496
+    public function get_fee( $fee ) {
3497 3497
         $fees = $this->get_fees();
3498
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3498
+        return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3499 3499
     }
3500 3500
 
3501 3501
     /**
3502
-	 * Removes a specific fee.
3503
-	 *
3504
-	 * @since 1.0.19
3505
-	 */
3506
-	public function remove_fee( $fee ) {
3502
+     * Removes a specific fee.
3503
+     *
3504
+     * @since 1.0.19
3505
+     */
3506
+    public function remove_fee( $fee ) {
3507 3507
         $fees = $this->get_fees();
3508 3508
         if ( isset( $fees[ $fee ] ) ) {
3509 3509
             unset( $fees[ $fee ] );
@@ -3511,55 +3511,55 @@  discard block
 block discarded – undo
3511 3511
         }
3512 3512
     }
3513 3513
 
3514
-	/**
3515
-	 * Adds a discount to the invoice.
3516
-	 *
3517
-	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3518
-	 * @since 1.0.19
3519
-	 */
3520
-	public function add_discount( $discount ) {
3514
+    /**
3515
+     * Adds a discount to the invoice.
3516
+     *
3517
+     * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3518
+     * @since 1.0.19
3519
+     */
3520
+    public function add_discount( $discount ) {
3521 3521
 
3522
-		$discounts = $this->get_discounts();
3523
-		$discounts[ $discount['name'] ] = $discount;
3524
-		$this->set_prop( 'discounts', $discounts );
3522
+        $discounts = $this->get_discounts();
3523
+        $discounts[ $discount['name'] ] = $discount;
3524
+        $this->set_prop( 'discounts', $discounts );
3525 3525
 
3526
-	}
3526
+    }
3527 3527
 
3528 3528
     /**
3529
-	 * Retrieves a specific discount.
3530
-	 *
3531
-	 * @since 1.0.19
3532
-	 * @return float
3533
-	 */
3534
-	public function get_discount( $discount = false ) {
3529
+     * Retrieves a specific discount.
3530
+     *
3531
+     * @since 1.0.19
3532
+     * @return float
3533
+     */
3534
+    public function get_discount( $discount = false ) {
3535 3535
 
3536
-		// Backwards compatibility.
3537
-		if ( empty( $discount ) ) {
3538
-			return $this->get_total_discount();
3539
-		}
3536
+        // Backwards compatibility.
3537
+        if ( empty( $discount ) ) {
3538
+            return $this->get_total_discount();
3539
+        }
3540 3540
 
3541 3541
         $discounts = $this->get_discounts();
3542
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3542
+        return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3543 3543
     }
3544 3544
 
3545 3545
     /**
3546
-	 * Removes a specific discount.
3547
-	 *
3548
-	 * @since 1.0.19
3549
-	 */
3550
-	public function remove_discount( $discount ) {
3546
+     * Removes a specific discount.
3547
+     *
3548
+     * @since 1.0.19
3549
+     */
3550
+    public function remove_discount( $discount ) {
3551 3551
         $discounts = $this->get_discounts();
3552 3552
         if ( isset( $discounts[ $discount ] ) ) {
3553 3553
             unset( $discounts[ $discount ] );
3554 3554
             $this->set_prop( 'discounts', $discounts );
3555 3555
         }
3556 3556
 
3557
-		if ( 'discount_code' == $discount ) {
3558
-			foreach ( $this->get_items() as $item ) {
3559
-				$item->item_discount           = 0;
3560
-				$item->recurring_item_discount = 0;
3561
-			}
3562
-		}
3557
+        if ( 'discount_code' == $discount ) {
3558
+            foreach ( $this->get_items() as $item ) {
3559
+                $item->item_discount           = 0;
3560
+                $item->recurring_item_discount = 0;
3561
+            }
3562
+        }
3563 3563
 
3564 3564
     }
3565 3565
 
@@ -3572,116 +3572,116 @@  discard block
 block discarded – undo
3572 3572
         if ( $this->is_taxable() ) {
3573 3573
 
3574 3574
             $taxes                 = $this->get_taxes();
3575
-			$taxes[ $tax['name'] ] = $tax;
3576
-			$this->set_prop( 'taxes', $tax );
3575
+            $taxes[ $tax['name'] ] = $tax;
3576
+            $this->set_prop( 'taxes', $tax );
3577 3577
 
3578 3578
         }
3579 3579
     }
3580 3580
 
3581 3581
     /**
3582
-	 * Retrieves a specific tax.
3583
-	 *
3584
-	 * @since 1.0.19
3585
-	 */
3586
-	public function get_tax( $tax = null ) {
3582
+     * Retrieves a specific tax.
3583
+     *
3584
+     * @since 1.0.19
3585
+     */
3586
+    public function get_tax( $tax = null ) {
3587 3587
 
3588
-		// Backwards compatibility.
3589
-		if ( empty( $tax ) ) {
3590
-			return $this->get_total_tax();
3591
-		}
3588
+        // Backwards compatibility.
3589
+        if ( empty( $tax ) ) {
3590
+            return $this->get_total_tax();
3591
+        }
3592 3592
 
3593 3593
         $taxes = $this->get_taxes();
3594
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3594
+        return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3595 3595
     }
3596 3596
 
3597
-	public function get_tax_total_by_name( $name ) {
3598
-		if ( $name && 0 === strpos( $name, 'tax__' ) ) {
3599
-			$name = str_replace( 'tax__', '', $name );
3600
-		}
3597
+    public function get_tax_total_by_name( $name ) {
3598
+        if ( $name && 0 === strpos( $name, 'tax__' ) ) {
3599
+            $name = str_replace( 'tax__', '', $name );
3600
+        }
3601 3601
 
3602
-		if ( empty( $name ) ) {
3603
-			return 0;
3604
-		}
3602
+        if ( empty( $name ) ) {
3603
+            return 0;
3604
+        }
3605 3605
 
3606
-		$tax = $this->get_tax( $name );
3606
+        $tax = $this->get_tax( $name );
3607 3607
 
3608
-		if ( empty( $tax ) ) {
3609
-			return 0;
3610
-		}
3608
+        if ( empty( $tax ) ) {
3609
+            return 0;
3610
+        }
3611 3611
 
3612 3612
         return $this->is_renewal() ? $tax['recurring_tax'] : $tax['initial_tax'];
3613 3613
     }
3614 3614
 
3615
-	/**
3616
-	 * Get tax item name.
3617
-	 *
3618
-	 * @since 2.8.8
3619
-	 */
3620
-	public function get_tax_item_name( $tax_key, $tax_item, $suffix = '' ) {
3621
-		$tax_name = _x( 'Tax', 'Tax name', 'invoicing' );
3615
+    /**
3616
+     * Get tax item name.
3617
+     *
3618
+     * @since 2.8.8
3619
+     */
3620
+    public function get_tax_item_name( $tax_key, $tax_item, $suffix = '' ) {
3621
+        $tax_name = _x( 'Tax', 'Tax name', 'invoicing' );
3622 3622
 
3623
-		if ( ! empty( $tax_item ) && is_array( $tax_item ) && ! empty( $tax_item['name'] ) ) {
3624
-			$tax_name = __( $tax_item['name'], 'invoicing' );
3625
-		}
3623
+        if ( ! empty( $tax_item ) && is_array( $tax_item ) && ! empty( $tax_item['name'] ) ) {
3624
+            $tax_name = __( $tax_item['name'], 'invoicing' );
3625
+        }
3626 3626
 
3627
-		if ( $suffix ) {
3628
-			$tax_name .= $suffix;
3629
-		}
3627
+        if ( $suffix ) {
3628
+            $tax_name .= $suffix;
3629
+        }
3630 3630
 
3631
-		return apply_filters( 'wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix );
3632
-	}
3631
+        return apply_filters( 'wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix );
3632
+    }
3633 3633
 
3634
-	/**
3635
-	 * Get tax item amount.
3636
-	 *
3637
-	 * @since 2.8.8
3638
-	 */
3639
-	public function get_tax_item_amount( $tax_key, $tax_item, $with_currency = false ) {
3640
-		$tax_amount = $this->get_tax_total_by_name( $tax_key );
3634
+    /**
3635
+     * Get tax item amount.
3636
+     *
3637
+     * @since 2.8.8
3638
+     */
3639
+    public function get_tax_item_amount( $tax_key, $tax_item, $with_currency = false ) {
3640
+        $tax_amount = $this->get_tax_total_by_name( $tax_key );
3641 3641
 
3642
-		if ( $with_currency ) {
3643
-			$tax_amount = wpinv_price( $tax_amount, $this->get_currency() );
3644
-		}
3642
+        if ( $with_currency ) {
3643
+            $tax_amount = wpinv_price( $tax_amount, $this->get_currency() );
3644
+        }
3645 3645
 
3646
-		return apply_filters( 'wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency );
3647
-	}
3646
+        return apply_filters( 'wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency );
3647
+    }
3648 3648
 
3649
-	public function get_item_tax_name( $percentage = true, $sep = ' + ' ) {
3650
-		$taxes = $this->get_taxes();
3649
+    public function get_item_tax_name( $percentage = true, $sep = ' + ' ) {
3650
+        $taxes = $this->get_taxes();
3651 3651
 
3652
-		if ( ! empty( $taxes ) && is_array( $taxes ) && count( $taxes ) == 1 && wpinv_display_individual_tax_rates() ) {
3653
-			$names = array();
3652
+        if ( ! empty( $taxes ) && is_array( $taxes ) && count( $taxes ) == 1 && wpinv_display_individual_tax_rates() ) {
3653
+            $names = array();
3654 3654
 
3655
-			foreach ( $taxes as $key => $tax ) {
3656
-				if ( ! empty( $tax ) && ! empty( $tax['name'] ) ) {
3657
-					$name = __( $tax['name'], 'invoicing' );
3655
+            foreach ( $taxes as $key => $tax ) {
3656
+                if ( ! empty( $tax ) && ! empty( $tax['name'] ) ) {
3657
+                    $name = __( $tax['name'], 'invoicing' );
3658 3658
 
3659
-					$names[] = $name;
3660
-				}
3661
-			}
3659
+                    $names[] = $name;
3660
+                }
3661
+            }
3662 3662
 
3663
-			if ( ! empty( $names ) ) {
3664
-				$names = array_unique( $names );
3663
+            if ( ! empty( $names ) ) {
3664
+                $names = array_unique( $names );
3665 3665
 
3666
-				$tax_name = implode( $sep, $names );
3667
-			}
3666
+                $tax_name = implode( $sep, $names );
3667
+            }
3668 3668
 
3669
-			if ( $percentage ) {
3670
-				$tax_name = wp_sprintf( _x( '%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing' ), $tax_name );
3671
-			}
3672
-		} else {
3673
-			$tax_name = $percentage ? __( 'Tax (%)', 'invoicing' ) : _x( 'Tax', 'Tax name', 'invoicing' );
3674
-		}
3669
+            if ( $percentage ) {
3670
+                $tax_name = wp_sprintf( _x( '%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing' ), $tax_name );
3671
+            }
3672
+        } else {
3673
+            $tax_name = $percentage ? __( 'Tax (%)', 'invoicing' ) : _x( 'Tax', 'Tax name', 'invoicing' );
3674
+        }
3675 3675
 
3676
-		return apply_filters( 'wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep );
3677
-	}
3676
+        return apply_filters( 'wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep );
3677
+    }
3678 3678
 
3679 3679
     /**
3680
-	 * Removes a specific tax.
3681
-	 *
3682
-	 * @since 1.0.19
3683
-	 */
3684
-	public function remove_tax( $tax ) {
3680
+     * Removes a specific tax.
3681
+     *
3682
+     * @since 1.0.19
3683
+     */
3684
+    public function remove_tax( $tax ) {
3685 3685
         $taxes = $this->get_taxes();
3686 3686
         if ( isset( $taxes[ $tax ] ) ) {
3687 3687
             unset( $taxes[ $tax ] );
@@ -3690,198 +3690,198 @@  discard block
 block discarded – undo
3690 3690
     }
3691 3691
 
3692 3692
     /**
3693
-	 * Recalculates the invoice subtotal.
3694
-	 *
3695
-	 * @since 1.0.19
3696
-	 * @return float The recalculated subtotal
3697
-	 */
3698
-	public function recalculate_subtotal() {
3693
+     * Recalculates the invoice subtotal.
3694
+     *
3695
+     * @since 1.0.19
3696
+     * @return float The recalculated subtotal
3697
+     */
3698
+    public function recalculate_subtotal() {
3699 3699
         $items     = $this->get_items();
3700
-		$subtotal  = 0;
3701
-		$recurring = 0;
3700
+        $subtotal  = 0;
3701
+        $recurring = 0;
3702 3702
 
3703 3703
         foreach ( $items as $item ) {
3704
-			$subtotal  += $item->get_sub_total( 'edit' );
3705
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3704
+            $subtotal  += $item->get_sub_total( 'edit' );
3705
+            $recurring += $item->get_recurring_sub_total( 'edit' );
3706 3706
         }
3707 3707
 
3708
-		if ( wpinv_prices_include_tax() ) {
3709
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3710
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3711
-		}
3708
+        if ( wpinv_prices_include_tax() ) {
3709
+            $subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3710
+            $recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3711
+        }
3712 3712
 
3713
-		$current = $this->is_renewal() ? $recurring : $subtotal;
3714
-		$this->set_subtotal( $current );
3713
+        $current = $this->is_renewal() ? $recurring : $subtotal;
3714
+        $this->set_subtotal( $current );
3715 3715
 
3716
-		$this->totals['subtotal'] = array(
3717
-			'initial'   => $subtotal,
3718
-			'recurring' => $recurring,
3719
-		);
3716
+        $this->totals['subtotal'] = array(
3717
+            'initial'   => $subtotal,
3718
+            'recurring' => $recurring,
3719
+        );
3720 3720
 
3721 3721
         return $current;
3722 3722
     }
3723 3723
 
3724 3724
     /**
3725
-	 * Recalculates the invoice discount total.
3726
-	 *
3727
-	 * @since 1.0.19
3728
-	 * @return float The recalculated discount
3729
-	 */
3730
-	public function recalculate_total_discount() {
3731
-		// Fix renewal invoice amount when tax + recurring discount applied.
3732
-		if ( $this->is_renewal() && $this->get_discount_code() ) {
3733
-			// Maybe recalculate discount (Pre-GetPaid Fix).
3734
-			$discount = new WPInv_Discount( $this->get_discount_code() );
3735
-
3736
-			if ( $discount->exists() && $discount->is_recurring() ) {
3737
-				getpaid_calculate_invoice_discount( $this, $discount );
3738
-			}
3739
-		}
3725
+     * Recalculates the invoice discount total.
3726
+     *
3727
+     * @since 1.0.19
3728
+     * @return float The recalculated discount
3729
+     */
3730
+    public function recalculate_total_discount() {
3731
+        // Fix renewal invoice amount when tax + recurring discount applied.
3732
+        if ( $this->is_renewal() && $this->get_discount_code() ) {
3733
+            // Maybe recalculate discount (Pre-GetPaid Fix).
3734
+            $discount = new WPInv_Discount( $this->get_discount_code() );
3735
+
3736
+            if ( $discount->exists() && $discount->is_recurring() ) {
3737
+                getpaid_calculate_invoice_discount( $this, $discount );
3738
+            }
3739
+        }
3740 3740
 
3741
-		$discounts = $this->get_discounts();
3742
-		$discount  = 0;
3743
-		$recurring = 0;
3741
+        $discounts = $this->get_discounts();
3742
+        $discount  = 0;
3743
+        $recurring = 0;
3744 3744
 
3745 3745
         foreach ( $discounts as $data ) {
3746
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3747
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3748
-		}
3746
+            $discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3747
+            $recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3748
+        }
3749 3749
 
3750
-		$current = $this->is_renewal() ? $recurring : $discount;
3750
+        $current = $this->is_renewal() ? $recurring : $discount;
3751 3751
 
3752
-		$this->set_total_discount( $current );
3752
+        $this->set_total_discount( $current );
3753 3753
 
3754
-		$this->totals['discount'] = array(
3755
-			'initial'   => $discount,
3756
-			'recurring' => $recurring,
3757
-		);
3754
+        $this->totals['discount'] = array(
3755
+            'initial'   => $discount,
3756
+            'recurring' => $recurring,
3757
+        );
3758 3758
 
3759
-		return $current;
3759
+        return $current;
3760 3760
 
3761 3761
     }
3762 3762
 
3763 3763
     /**
3764
-	 * Recalculates the invoice tax total.
3765
-	 *
3766
-	 * @since 1.0.19
3767
-	 * @return float The recalculated tax
3768
-	 */
3769
-	public function recalculate_total_tax() {
3764
+     * Recalculates the invoice tax total.
3765
+     *
3766
+     * @since 1.0.19
3767
+     * @return float The recalculated tax
3768
+     */
3769
+    public function recalculate_total_tax() {
3770 3770
 
3771
-		// Maybe disable taxes.
3772
-		$vat_number = $this->get_vat_number();
3773
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3771
+        // Maybe disable taxes.
3772
+        $vat_number = $this->get_vat_number();
3773
+        $skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3774 3774
 
3775
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3776
-			$skip_tax = false;
3777
-		}
3775
+        if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3776
+            $skip_tax = false;
3777
+        }
3778 3778
 
3779
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3779
+        if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3780 3780
 
3781
-			$this->totals['tax'] = array(
3782
-				'initial'   => 0,
3783
-				'recurring' => 0,
3784
-			);
3781
+            $this->totals['tax'] = array(
3782
+                'initial'   => 0,
3783
+                'recurring' => 0,
3784
+            );
3785 3785
 
3786
-			$this->tax_rate = 0;
3786
+            $this->tax_rate = 0;
3787 3787
 
3788
-			$this->set_taxes( array() );
3789
-			$current = 0;
3790
-		} else {
3788
+            $this->set_taxes( array() );
3789
+            $current = 0;
3790
+        } else {
3791 3791
 
3792
-			$item_taxes = array();
3792
+            $item_taxes = array();
3793 3793
 
3794
-			foreach ( $this->get_items() as $item ) {
3795
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3796
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3797
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3798
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3799
-				foreach ( $taxes as $name => $amount ) {
3800
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3801
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3794
+            foreach ( $this->get_items() as $item ) {
3795
+                $rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3796
+                $rates    = getpaid_filter_item_tax_rates( $item, $rates );
3797
+                $taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3798
+                $r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3799
+                foreach ( $taxes as $name => $amount ) {
3800
+                    $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3801
+                    $tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3802 3802
 
3803
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3804
-						$item_taxes[ $name ] = $tax;
3805
-						continue;
3806
-					}
3803
+                    if ( ! isset( $item_taxes[ $name ] ) ) {
3804
+                        $item_taxes[ $name ] = $tax;
3805
+                        continue;
3806
+                    }
3807 3807
 
3808
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3809
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3808
+                    $item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3809
+                    $item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3810 3810
 
3811
-				}
3812
-			}
3811
+                }
3812
+            }
3813 3813
 
3814
-			$this->set_taxes( $item_taxes );
3814
+            $this->set_taxes( $item_taxes );
3815 3815
 
3816
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3817
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3816
+            $initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3817
+            $recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3818 3818
 
3819
-			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3819
+            $current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3820 3820
 
3821
-			$this->totals['tax'] = array(
3822
-				'initial'   => $initial_tax,
3823
-				'recurring' => $recurring_tax,
3824
-			);
3821
+            $this->totals['tax'] = array(
3822
+                'initial'   => $initial_tax,
3823
+                'recurring' => $recurring_tax,
3824
+            );
3825 3825
 
3826
-		}
3826
+        }
3827 3827
 
3828
-		$this->set_total_tax( $current );
3828
+        $this->set_total_tax( $current );
3829 3829
 
3830
-		return $current;
3830
+        return $current;
3831 3831
 
3832 3832
     }
3833 3833
 
3834 3834
     /**
3835
-	 * Recalculates the invoice fees total.
3836
-	 *
3837
-	 * @since 1.0.19
3838
-	 * @return float The recalculated fee
3839
-	 */
3840
-	public function recalculate_total_fees() {
3841
-		$fees      = $this->get_fees();
3842
-		$fee       = 0;
3843
-		$recurring = 0;
3835
+     * Recalculates the invoice fees total.
3836
+     *
3837
+     * @since 1.0.19
3838
+     * @return float The recalculated fee
3839
+     */
3840
+    public function recalculate_total_fees() {
3841
+        $fees      = $this->get_fees();
3842
+        $fee       = 0;
3843
+        $recurring = 0;
3844 3844
 
3845 3845
         foreach ( $fees as $data ) {
3846
-			if( isset( $data['initial_fee'] ) ){
3847
-				$fee += wpinv_sanitize_amount( $data['initial_fee'] );
3848
-			}
3846
+            if( isset( $data['initial_fee'] ) ){
3847
+                $fee += wpinv_sanitize_amount( $data['initial_fee'] );
3848
+            }
3849 3849
 
3850
-			if( isset( $data['recurring_fee'] ) ){
3851
-				$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3852
-			}
3853
-		}
3850
+            if( isset( $data['recurring_fee'] ) ){
3851
+                $recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3852
+            }
3853
+        }
3854 3854
 
3855
-		$current = $this->is_renewal() ? $recurring : $fee;
3856
-		$this->set_total_fees( $current );
3855
+        $current = $this->is_renewal() ? $recurring : $fee;
3856
+        $this->set_total_fees( $current );
3857 3857
 
3858
-		$this->totals['fee'] = array(
3859
-			'initial'   => $fee,
3860
-			'recurring' => $recurring,
3861
-		);
3858
+        $this->totals['fee'] = array(
3859
+            'initial'   => $fee,
3860
+            'recurring' => $recurring,
3861
+        );
3862 3862
 
3863 3863
         $this->set_total_fees( $fee );
3864 3864
         return $current;
3865 3865
     }
3866 3866
 
3867 3867
     /**
3868
-	 * Recalculates the invoice total.
3869
-	 *
3870
-	 * @since 1.0.19
3868
+     * Recalculates the invoice total.
3869
+     *
3870
+     * @since 1.0.19
3871 3871
      * @return float The invoice total
3872
-	 */
3873
-	public function recalculate_total() {
3872
+     */
3873
+    public function recalculate_total() {
3874 3874
         $this->recalculate_total_fees();
3875 3875
         $this->recalculate_total_discount();
3876
-		$this->recalculate_total_tax();
3877
-		$this->recalculate_subtotal();
3878
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3879
-		return $this->get_total();
3880
-	}
3881
-
3882
-	/**
3883
-	 * @deprecated
3884
-	 */
3876
+        $this->recalculate_total_tax();
3877
+        $this->recalculate_subtotal();
3878
+        $this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3879
+        return $this->get_total();
3880
+    }
3881
+
3882
+    /**
3883
+     * @deprecated
3884
+     */
3885 3885
     public function recalculate_totals() {
3886 3886
         $this->recalculate_total();
3887 3887
         $this->save( true );
@@ -3895,22 +3895,22 @@  discard block
 block discarded – undo
3895 3895
         return $this->get_data();
3896 3896
     }
3897 3897
 
3898
-	/**
3898
+    /**
3899 3899
      * Adds a system note to an invoice.
3900 3900
      *
3901 3901
      * @param string $note The note being added.
3902
-	 * @return int|false The new note's ID on success, false on failure.
3902
+     * @return int|false The new note's ID on success, false on failure.
3903 3903
      *
3904 3904
      */
3905 3905
     public function add_system_note( $note ) {
3906
-		return $this->add_note( $note, false, false, true );
3907
-	}
3906
+        return $this->add_note( $note, false, false, true );
3907
+    }
3908 3908
 
3909 3909
     /**
3910 3910
      * Adds a note to an invoice.
3911 3911
      *
3912 3912
      * @param string $note The note being added.
3913
-	 * @return int|false The new note's ID on success, false on failure.
3913
+     * @return int|false The new note's ID on success, false on failure.
3914 3914
      *
3915 3915
      */
3916 3916
     public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
@@ -3920,21 +3920,21 @@  discard block
 block discarded – undo
3920 3920
             return false;
3921 3921
         }
3922 3922
 
3923
-		$author       = 'System';
3924
-		$author_email = '[email protected]';
3923
+        $author       = 'System';
3924
+        $author_email = '[email protected]';
3925 3925
 
3926
-		// If this is an admin comment or it has been added by the user.
3927
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3928
-			$user         = get_user_by( 'id', get_current_user_id() );
3926
+        // If this is an admin comment or it has been added by the user.
3927
+        if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3928
+            $user         = get_user_by( 'id', get_current_user_id() );
3929 3929
             $author       = $user->display_name;
3930 3930
             $author_email = $user->user_email;
3931
-		}
3931
+        }
3932 3932
 
3933
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3933
+        return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3934 3934
 
3935
-	}
3935
+    }
3936 3936
 
3937
-	/**
3937
+    /**
3938 3938
      * Generates a unique key for the invoice.
3939 3939
      */
3940 3940
     public function generate_key( $string = '' ) {
@@ -3954,113 +3954,113 @@  discard block
 block discarded – undo
3954 3954
             $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3955 3955
         }
3956 3956
 
3957
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3958
-
3959
-	}
3960
-
3961
-	/**
3962
-	 * Handle the status transition.
3963
-	 */
3964
-	protected function status_transition() {
3965
-		$status_transition = $this->status_transition;
3966
-
3967
-		// Reset status transition variable.
3968
-		$this->status_transition = false;
3969
-
3970
-		if ( $status_transition ) {
3971
-			try {
3972
-
3973
-				// Fire a hook for the status change.
3974
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3975
-
3976
-				// @deprecated this is deprecated and will be removed in the future.
3977
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3978
-
3979
-				if ( ! empty( $status_transition['from'] ) ) {
3980
-
3981
-					/* translators: 1: old invoice status 2: new invoice status */
3982
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3983
-
3984
-					// Fire another hook.
3985
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3986
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3957
+        return wpinv_format_invoice_number( $number, $this->get_post_type() );
3987 3958
 
3988
-					// @deprecated this is deprecated and will be removed in the future.
3989
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3990
-
3991
-					// Note the transition occurred.
3992
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3993
-
3994
-					// Work out if this was for a payment, and trigger a payment_status hook instead.
3995
-					if (
3996
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3997
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3998
-					) {
3999
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
4000
-					}
4001
-
4002
-					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
4003
-					if (
4004
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
4005
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
4006
-					) {
4007
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
4008
-					}
4009
-				} else {
4010
-					/* translators: %s: new invoice status */
4011
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
4012
-
4013
-					// Note the transition occurred.
4014
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3959
+    }
4015 3960
 
4016
-				}
4017
-			} catch ( Exception $e ) {
4018
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
4019
-			}
4020
-		}
4021
-	}
3961
+    /**
3962
+     * Handle the status transition.
3963
+     */
3964
+    protected function status_transition() {
3965
+        $status_transition = $this->status_transition;
3966
+
3967
+        // Reset status transition variable.
3968
+        $this->status_transition = false;
3969
+
3970
+        if ( $status_transition ) {
3971
+            try {
3972
+
3973
+                // Fire a hook for the status change.
3974
+                do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3975
+
3976
+                // @deprecated this is deprecated and will be removed in the future.
3977
+                do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3978
+
3979
+                if ( ! empty( $status_transition['from'] ) ) {
3980
+
3981
+                    /* translators: 1: old invoice status 2: new invoice status */
3982
+                    $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3983
+
3984
+                    // Fire another hook.
3985
+                    do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3986
+                    do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3987
+
3988
+                    // @deprecated this is deprecated and will be removed in the future.
3989
+                    do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3990
+
3991
+                    // Note the transition occurred.
3992
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3993
+
3994
+                    // Work out if this was for a payment, and trigger a payment_status hook instead.
3995
+                    if (
3996
+                        in_array( $status_transition['from'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3997
+                        && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3998
+                    ) {
3999
+                        do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
4000
+                    }
4001
+
4002
+                    // Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
4003
+                    if (
4004
+                        in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
4005
+                        && in_array( $status_transition['to'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
4006
+                    ) {
4007
+                        do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
4008
+                    }
4009
+                } else {
4010
+                    /* translators: %s: new invoice status */
4011
+                    $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
4012
+
4013
+                    // Note the transition occurred.
4014
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
4015
+
4016
+                }
4017
+            } catch ( Exception $e ) {
4018
+                $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
4019
+            }
4020
+        }
4021
+    }
4022 4022
 
4023
-	/**
4024
-	 * Updates an invoice status.
4025
-	 */
4026
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
4023
+    /**
4024
+     * Updates an invoice status.
4025
+     */
4026
+    public function update_status( $new_status = false, $note = '', $manual = false ) {
4027 4027
 
4028
-		// Fires before updating a status.
4029
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
4028
+        // Fires before updating a status.
4029
+        do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
4030 4030
 
4031
-		// Update the status.
4032
-		$this->set_status( $new_status, $note, $manual );
4031
+        // Update the status.
4032
+        $this->set_status( $new_status, $note, $manual );
4033 4033
 
4034
-		// Save the order.
4035
-		return $this->save();
4034
+        // Save the order.
4035
+        return $this->save();
4036 4036
 
4037
-	}
4037
+    }
4038 4038
 
4039
-	/**
4040
-	 * @deprecated
4041
-	 */
4042
-	public function refresh_item_ids() {
4039
+    /**
4040
+     * @deprecated
4041
+     */
4042
+    public function refresh_item_ids() {
4043 4043
         $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
4044 4044
         update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
4045
-	}
4045
+    }
4046 4046
 
4047
-	/**
4048
-	 * @deprecated
4049
-	 */
4050
-	public function update_items( $temp = false ) {
4047
+    /**
4048
+     * @deprecated
4049
+     */
4050
+    public function update_items( $temp = false ) {
4051 4051
 
4052
-		$this->set_items( $this->get_items() );
4052
+        $this->set_items( $this->get_items() );
4053 4053
 
4054
-		if ( ! $temp ) {
4055
-			$this->save();
4056
-		}
4054
+        if ( ! $temp ) {
4055
+            $this->save();
4056
+        }
4057 4057
 
4058 4058
         return $this;
4059
-	}
4059
+    }
4060 4060
 
4061
-	/**
4062
-	 * @deprecated
4063
-	 */
4061
+    /**
4062
+     * @deprecated
4063
+     */
4064 4064
     public function validate_discount() {
4065 4065
 
4066 4066
         $discount_code = $this->get_discount_code();
@@ -4076,101 +4076,101 @@  discard block
 block discarded – undo
4076 4076
 
4077 4077
     }
4078 4078
 
4079
-	/**
4080
-	 * Refunds an invoice.
4081
-	 */
4079
+    /**
4080
+     * Refunds an invoice.
4081
+     */
4082 4082
     public function refund() {
4083
-		$this->set_status( 'wpi-refunded' );
4083
+        $this->set_status( 'wpi-refunded' );
4084 4084
         $this->save();
4085
-	}
4085
+    }
4086 4086
 
4087
-	/**
4088
-	 * Marks an invoice as paid.
4089
-	 *
4090
-	 * @param string $transaction_id
4091
-	 */
4087
+    /**
4088
+     * Marks an invoice as paid.
4089
+     *
4090
+     * @param string $transaction_id
4091
+     */
4092 4092
     public function mark_paid( $transaction_id = null, $note = '' ) {
4093 4093
 
4094
-		// Set the transaction id.
4095
-		if ( empty( $transaction_id ) ) {
4096
-			$transaction_id = $this->generate_key( 'trans_' );
4097
-		}
4094
+        // Set the transaction id.
4095
+        if ( empty( $transaction_id ) ) {
4096
+            $transaction_id = $this->generate_key( 'trans_' );
4097
+        }
4098 4098
 
4099
-		if ( ! $this->get_transaction_id() ) {
4100
-			$this->set_transaction_id( $transaction_id );
4101
-		}
4099
+        if ( ! $this->get_transaction_id() ) {
4100
+            $this->set_transaction_id( $transaction_id );
4101
+        }
4102 4102
 
4103
-		if ( $this->is_paid() && 'wpi-processing' !== $this->get_status() ) {
4104
-			return $this->save();
4105
-		}
4103
+        if ( $this->is_paid() && 'wpi-processing' !== $this->get_status() ) {
4104
+            return $this->save();
4105
+        }
4106 4106
 
4107
-		// Set the completed date.
4108
-		$this->set_date_completed( current_time( 'mysql' ) );
4107
+        // Set the completed date.
4108
+        $this->set_date_completed( current_time( 'mysql' ) );
4109 4109
 
4110
-		// Set the new status.
4111
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
4112
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
4110
+        // Set the new status.
4111
+        $gateway = sanitize_text_field( $this->get_gateway_title() );
4112
+        if ( $this->is_renewal() || ! $this->is_parent() ) {
4113 4113
 
4114
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
4115
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4114
+            $_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
4115
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
4116 4116
 
4117
-			if ( 'none' == $this->get_gateway() ) {
4118
-				$_note = $note;
4119
-			}
4117
+            if ( 'none' == $this->get_gateway() ) {
4118
+                $_note = $note;
4119
+            }
4120 4120
 
4121
-			$this->set_status( 'wpi-renewal', $_note );
4121
+            $this->set_status( 'wpi-renewal', $_note );
4122 4122
 
4123
-		} else {
4123
+        } else {
4124 4124
 
4125
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
4126
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4125
+            $_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
4126
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
4127 4127
 
4128
-			if ( 'none' == $this->get_gateway() ) {
4129
-				$_note = $note;
4130
-			}
4128
+            if ( 'none' == $this->get_gateway() ) {
4129
+                $_note = $note;
4130
+            }
4131 4131
 
4132
-			$this->set_status( 'publish', $_note );
4132
+            $this->set_status( 'publish', $_note );
4133 4133
 
4134
-		}
4134
+        }
4135 4135
 
4136
-		// Set checkout mode.
4137
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4138
-		$this->set_mode( $mode );
4136
+        // Set checkout mode.
4137
+        $mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4138
+        $this->set_mode( $mode );
4139 4139
 
4140
-		// Save the invoice.
4140
+        // Save the invoice.
4141 4141
         $this->save();
4142
-	}
4143
-
4144
-	/**
4145
-	 * Save data to the database.
4146
-	 *
4147
-	 * @since 1.0.19
4148
-	 * @return int invoice ID
4149
-	 */
4150
-	public function save() {
4151
-		$this->maybe_set_date_paid();
4152
-		$this->maybe_set_key();
4153
-		parent::save();
4154
-		$this->clear_cache();
4155
-		$this->status_transition();
4156
-		return $this->get_id();
4157
-	}
4158
-
4159
-	/**
4142
+    }
4143
+
4144
+    /**
4145
+     * Save data to the database.
4146
+     *
4147
+     * @since 1.0.19
4148
+     * @return int invoice ID
4149
+     */
4150
+    public function save() {
4151
+        $this->maybe_set_date_paid();
4152
+        $this->maybe_set_key();
4153
+        parent::save();
4154
+        $this->clear_cache();
4155
+        $this->status_transition();
4156
+        return $this->get_id();
4157
+    }
4158
+
4159
+    /**
4160 4160
      * Clears the subscription's cache.
4161 4161
      */
4162 4162
     public function clear_cache() {
4163
-		if ( $this->get_key() ) {
4164
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4165
-		}
4166
-
4167
-		if ( $this->get_number() ) {
4168
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4169
-		}
4170
-
4171
-		if ( $this->get_transaction_id() ) {
4172
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4173
-		}
4174
-	}
4163
+        if ( $this->get_key() ) {
4164
+            wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4165
+        }
4166
+
4167
+        if ( $this->get_number() ) {
4168
+            wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4169
+        }
4170
+
4171
+        if ( $this->get_transaction_id() ) {
4172
+            wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4173
+        }
4174
+    }
4175 4175
 
4176 4176
 }
Please login to merge, or discard this patch.
Spacing   +856 added lines, -856 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
  * Invoice class.
@@ -147,39 +147,39 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
149 149
 	 */
150
-    public function __construct( $invoice = 0 ) {
150
+    public function __construct($invoice = 0) {
151 151
 
152
-        parent::__construct( $invoice );
152
+        parent::__construct($invoice);
153 153
 
154
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
155
-			$this->set_id( (int) $invoice );
156
-		} elseif ( $invoice instanceof self ) {
157
-			$this->set_id( $invoice->get_id() );
158
-		} elseif ( ! empty( $invoice->ID ) ) {
159
-			$this->set_id( $invoice->ID );
160
-		} elseif ( is_array( $invoice ) ) {
161
-			$this->set_props( $invoice );
154
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) {
155
+			$this->set_id((int) $invoice);
156
+		} elseif ($invoice instanceof self) {
157
+			$this->set_id($invoice->get_id());
158
+		} elseif (!empty($invoice->ID)) {
159
+			$this->set_id($invoice->ID);
160
+		} elseif (is_array($invoice)) {
161
+			$this->set_props($invoice);
162 162
 
163
-			if ( isset( $invoice['ID'] ) ) {
164
-				$this->set_id( $invoice['ID'] );
163
+			if (isset($invoice['ID'])) {
164
+				$this->set_id($invoice['ID']);
165 165
 			}
166
-} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
169
-			$this->set_id( $invoice_id );
170
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
171
-			$this->set_id( $invoice_id );
166
+} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
167
+			$this->set_id($invoice_id);
168
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
169
+			$this->set_id($invoice_id);
170
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
171
+			$this->set_id($invoice_id);
172 172
 		} else {
173
-			$this->set_object_read( true );
173
+			$this->set_object_read(true);
174 174
 		}
175 175
 
176 176
         // Load the datastore.
177
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
177
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
178 178
 
179
-		if ( $this->get_id() > 0 ) {
180
-            $this->post = get_post( $this->get_id() );
179
+		if ($this->get_id() > 0) {
180
+            $this->post = get_post($this->get_id());
181 181
             $this->ID   = $this->get_id();
182
-			$this->data_store->read( $this );
182
+			$this->data_store->read($this);
183 183
         }
184 184
 
185 185
     }
@@ -194,39 +194,39 @@  discard block
 block discarded – undo
194 194
 	 * @since 1.0.15
195 195
 	 * @return int
196 196
 	 */
197
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
197
+	public static function get_invoice_id_by_field($value, $field = 'key') {
198 198
         global $wpdb;
199 199
 
200 200
 		// Trim the value.
201
-		$value = trim( $value );
201
+		$value = trim($value);
202 202
 
203
-		if ( empty( $value ) ) {
203
+		if (empty($value)) {
204 204
 			return 0;
205 205
 		}
206 206
 
207 207
         // Valid fields.
208
-        $fields = array( 'key', 'number', 'transaction_id' );
208
+        $fields = array('key', 'number', 'transaction_id');
209 209
 
210 210
 		// Ensure a field has been passed.
211
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
211
+		if (empty($field) || !in_array($field, $fields)) {
212 212
 			return 0;
213 213
 		}
214 214
 
215 215
 		// Maybe retrieve from the cache.
216
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
217
-		if ( false !== $invoice_id ) {
216
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
217
+		if (false !== $invoice_id) {
218 218
 			return $invoice_id;
219 219
 		}
220 220
 
221 221
         // Fetch from the db.
222 222
         $table       = $wpdb->prefix . 'getpaid_invoices';
223
-		$db_field    = 'key' === $field ? 'invoice_key' : $field;
223
+		$db_field = 'key' === $field ? 'invoice_key' : $field;
224 224
         $invoice_id  = (int) $wpdb->get_var(
225
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$db_field`=%s LIMIT 1", $value )
225
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$db_field`=%s LIMIT 1", $value)
226 226
         );
227 227
 
228 228
 		// Update the cache with our data
229
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
229
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
230 230
 
231 231
 		return $invoice_id;
232 232
     }
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
     /**
235 235
      * Checks if an invoice key is set.
236 236
      */
237
-    public function _isset( $key ) {
238
-        return isset( $this->data[ $key ] ) || method_exists( $this, "get_$key" );
237
+    public function _isset($key) {
238
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
239 239
     }
240 240
 
241 241
     /*
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @param  string $context View or edit context.
261 261
 	 * @return int
262 262
 	 */
263
-	public function get_parent_id( $context = 'view' ) {
264
-		return (int) $this->get_prop( 'parent_id', $context );
263
+	public function get_parent_id($context = 'view') {
264
+		return (int) $this->get_prop('parent_id', $context);
265 265
     }
266 266
 
267 267
     /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @return WPInv_Invoice
272 272
 	 */
273 273
     public function get_parent_payment() {
274
-        return new WPInv_Invoice( $this->get_parent_id() );
274
+        return new WPInv_Invoice($this->get_parent_id());
275 275
     }
276 276
 
277 277
     /**
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param  string $context View or edit context.
292 292
 	 * @return string
293 293
 	 */
294
-	public function get_status( $context = 'view' ) {
295
-		return $this->get_prop( 'status', $context );
294
+	public function get_status($context = 'view') {
295
+		return $this->get_prop('status', $context);
296 296
 	}
297 297
 
298 298
 	/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return array
303 303
 	 */
304 304
 	public function get_all_statuses() {
305
-		return wpinv_get_invoice_statuses( true, true, $this );
305
+		return wpinv_get_invoice_statuses(true, true, $this);
306 306
     }
307 307
 
308 308
     /**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
     public function get_status_nicename() {
315 315
 		$statuses = $this->get_all_statuses();
316 316
 
317
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
317
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
318 318
 
319
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
319
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
320 320
     }
321 321
 
322 322
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function get_status_class() {
329 329
 		$statuses = getpaid_get_invoice_status_classes();
330
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'bg-dark text-white';
330
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'bg-dark text-white';
331 331
 	}
332 332
 
333 333
 	/**
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function get_status_label_html() {
340 340
 
341
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
342
-		$status       = sanitize_html_class( $this->get_status() );
343
-		$class        = esc_attr( $this->get_status_class() );
341
+		$status_label = sanitize_text_field($this->get_status_nicename());
342
+		$status       = sanitize_html_class($this->get_status());
343
+		$class        = esc_attr($this->get_status_class());
344 344
 
345 345
 		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
346 346
 	}
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
 	 * @param  string $context View or edit context.
353 353
 	 * @return string
354 354
 	 */
355
-	public function get_version( $context = 'view' ) {
356
-		return $this->get_prop( 'version', $context );
355
+	public function get_version($context = 'view') {
356
+		return $this->get_prop('version', $context);
357 357
 	}
358 358
 
359 359
 	/**
360 360
 	 * @deprecated
361 361
 	 */
362
-	public function get_invoice_date( $format = true ) {
363
-		$date      = getpaid_format_date( $this->get_date_completed() );
364
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
365
-		$formatted = getpaid_format_date( $date );
362
+	public function get_invoice_date($format = true) {
363
+		$date      = getpaid_format_date($this->get_date_completed());
364
+		$date      = empty($date) ? $this->get_date_created() : $this->get_date_completed();
365
+		$formatted = getpaid_format_date($date);
366 366
 
367
-		if ( $format ) {
367
+		if ($format) {
368 368
 			return $formatted;
369 369
 		}
370 370
 
371
-		return empty( $formatted ) ? '' : $date;
371
+		return empty($formatted) ? '' : $date;
372 372
 
373 373
     }
374 374
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param  string $context View or edit context.
380 380
 	 * @return string
381 381
 	 */
382
-	public function get_date_created( $context = 'view' ) {
383
-		return $this->get_prop( 'date_created', $context );
382
+	public function get_date_created($context = 'view') {
383
+		return $this->get_prop('date_created', $context);
384 384
 	}
385 385
 
386 386
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 * @param  string $context View or edit context.
391 391
 	 * @return string
392 392
 	 */
393
-	public function get_created_date( $context = 'view' ) {
394
-		return $this->get_date_created( $context );
393
+	public function get_created_date($context = 'view') {
394
+		return $this->get_date_created($context);
395 395
     }
396 396
 
397 397
     /**
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 	 * @param  string $context View or edit context.
402 402
 	 * @return string
403 403
 	 */
404
-	public function get_date_created_gmt( $context = 'view' ) {
405
-        $date = $this->get_date_created( $context );
404
+	public function get_date_created_gmt($context = 'view') {
405
+        $date = $this->get_date_created($context);
406 406
 
407
-        if ( $date ) {
408
-            $date = get_gmt_from_date( $date );
407
+        if ($date) {
408
+            $date = get_gmt_from_date($date);
409 409
         }
410 410
 		return $date;
411 411
     }
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 * @param  string $context View or edit context.
418 418
 	 * @return string
419 419
 	 */
420
-	public function get_date_modified( $context = 'view' ) {
421
-		return $this->get_prop( 'date_modified', $context );
420
+	public function get_date_modified($context = 'view') {
421
+		return $this->get_prop('date_modified', $context);
422 422
 	}
423 423
 
424 424
 	/**
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param  string $context View or edit context.
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_modified_date( $context = 'view' ) {
432
-		return $this->get_date_modified( $context );
431
+	public function get_modified_date($context = 'view') {
432
+		return $this->get_date_modified($context);
433 433
     }
434 434
 
435 435
     /**
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
 	 * @param  string $context View or edit context.
440 440
 	 * @return string
441 441
 	 */
442
-	public function get_date_modified_gmt( $context = 'view' ) {
443
-        $date = $this->get_date_modified( $context );
442
+	public function get_date_modified_gmt($context = 'view') {
443
+        $date = $this->get_date_modified($context);
444 444
 
445
-        if ( $date ) {
446
-            $date = get_gmt_from_date( $date );
445
+        if ($date) {
446
+            $date = get_gmt_from_date($date);
447 447
         }
448 448
 		return $date;
449 449
     }
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param  string $context View or edit context.
456 456
 	 * @return string
457 457
 	 */
458
-	public function get_due_date( $context = 'view' ) {
459
-		return $this->get_prop( 'due_date', $context );
458
+	public function get_due_date($context = 'view') {
459
+		return $this->get_prop('due_date', $context);
460 460
     }
461 461
 
462 462
     /**
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param  string $context View or edit context.
467 467
 	 * @return string
468 468
 	 */
469
-	public function get_date_due( $context = 'view' ) {
470
-		return $this->get_due_date( $context );
469
+	public function get_date_due($context = 'view') {
470
+		return $this->get_due_date($context);
471 471
     }
472 472
 
473 473
     /**
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 	 * @param  string $context View or edit context.
478 478
 	 * @return string
479 479
 	 */
480
-	public function get_due_date_gmt( $context = 'view' ) {
481
-        $date = $this->get_due_date( $context );
480
+	public function get_due_date_gmt($context = 'view') {
481
+        $date = $this->get_due_date($context);
482 482
 
483
-        if ( $date ) {
484
-            $date = get_gmt_from_date( $date );
483
+        if ($date) {
484
+            $date = get_gmt_from_date($date);
485 485
         }
486 486
 		return $date;
487 487
     }
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 * @param  string $context View or edit context.
494 494
 	 * @return string
495 495
 	 */
496
-	public function get_gmt_date_due( $context = 'view' ) {
497
-		return $this->get_due_date_gmt( $context );
496
+	public function get_gmt_date_due($context = 'view') {
497
+		return $this->get_due_date_gmt($context);
498 498
     }
499 499
 
500 500
     /**
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param  string $context View or edit context.
505 505
 	 * @return string
506 506
 	 */
507
-	public function get_completed_date( $context = 'view' ) {
508
-		return $this->get_prop( 'completed_date', $context );
507
+	public function get_completed_date($context = 'view') {
508
+		return $this->get_prop('completed_date', $context);
509 509
     }
510 510
 
511 511
     /**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * @param  string $context View or edit context.
516 516
 	 * @return string
517 517
 	 */
518
-	public function get_date_completed( $context = 'view' ) {
519
-		return $this->get_completed_date( $context );
518
+	public function get_date_completed($context = 'view') {
519
+		return $this->get_completed_date($context);
520 520
     }
521 521
 
522 522
     /**
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 	 * @param  string $context View or edit context.
527 527
 	 * @return string
528 528
 	 */
529
-	public function get_completed_date_gmt( $context = 'view' ) {
530
-        $date = $this->get_completed_date( $context );
529
+	public function get_completed_date_gmt($context = 'view') {
530
+        $date = $this->get_completed_date($context);
531 531
 
532
-        if ( $date ) {
533
-            $date = get_gmt_from_date( $date );
532
+        if ($date) {
533
+            $date = get_gmt_from_date($date);
534 534
         }
535 535
 		return $date;
536 536
     }
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	 * @param  string $context View or edit context.
543 543
 	 * @return string
544 544
 	 */
545
-	public function get_gmt_completed_date( $context = 'view' ) {
546
-		return $this->get_completed_date_gmt( $context );
545
+	public function get_gmt_completed_date($context = 'view') {
546
+		return $this->get_completed_date_gmt($context);
547 547
     }
548 548
 
549 549
     /**
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 	 * @param  string $context View or edit context.
554 554
 	 * @return string
555 555
 	 */
556
-	public function get_number( $context = 'view' ) {
557
-		$number = $this->get_prop( 'number', $context );
556
+	public function get_number($context = 'view') {
557
+		$number = $this->get_prop('number', $context);
558 558
 
559
-		if ( empty( $number ) ) {
559
+		if (empty($number)) {
560 560
 			$number = $this->generate_number();
561
-			$this->set_number( $this->generate_number() );
561
+			$this->set_number($this->generate_number());
562 562
 		}
563 563
 
564 564
 		return $number;
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 	public function maybe_set_number() {
573 573
         $number = $this->get_number();
574 574
 
575
-        if ( empty( $number ) || $this->get_id() == $number ) {
576
-			$this->set_number( $this->generate_number() );
575
+        if (empty($number) || $this->get_id() == $number) {
576
+			$this->set_number($this->generate_number());
577 577
         }
578 578
 
579 579
 	}
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 	 * @param  string $context View or edit context.
586 586
 	 * @return string
587 587
 	 */
588
-	public function get_key( $context = 'view' ) {
589
-        return $this->get_prop( 'key', $context );
588
+	public function get_key($context = 'view') {
589
+        return $this->get_prop('key', $context);
590 590
 	}
591 591
 
592 592
 	/**
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 	public function maybe_set_key() {
598 598
         $key = $this->get_key();
599 599
 
600
-        if ( empty( $key ) ) {
601
-            $key = $this->generate_key( $this->get_type() . '_' );
602
-            $this->set_key( $key );
600
+        if (empty($key)) {
601
+            $key = $this->generate_key($this->get_type() . '_');
602
+            $this->set_key($key);
603 603
         }
604 604
 
605 605
     }
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @param  string $context View or edit context.
612 612
 	 * @return string
613 613
 	 */
614
-	public function get_type( $context = 'view' ) {
615
-        return $this->get_prop( 'type', $context );
614
+	public function get_type($context = 'view') {
615
+        return $this->get_prop('type', $context);
616 616
 	}
617 617
 
618 618
 	/**
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 * @return string
623 623
 	 */
624 624
 	public function get_invoice_quote_type() {
625
-        return getpaid_get_post_type_label( $this->get_post_type(), false );
625
+        return getpaid_get_post_type_label($this->get_post_type(), false);
626 626
     }
627 627
 
628 628
     /**
@@ -632,8 +632,8 @@  discard block
 block discarded – undo
632 632
 	 * @param  string $context View or edit context.
633 633
 	 * @return string
634 634
 	 */
635
-	public function get_label( $context = 'view' ) {
636
-        return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
635
+	public function get_label($context = 'view') {
636
+        return getpaid_get_post_type_label($this->get_post_type($context), false);
637 637
 	}
638 638
 
639 639
 	/**
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 	 * @param  string $context View or edit context.
644 644
 	 * @return string
645 645
 	 */
646
-	public function get_post_type( $context = 'view' ) {
647
-        return $this->get_prop( 'post_type', $context );
646
+	public function get_post_type($context = 'view') {
647
+        return $this->get_prop('post_type', $context);
648 648
     }
649 649
 
650 650
     /**
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 	 * @param  string $context View or edit context.
655 655
 	 * @return string
656 656
 	 */
657
-	public function get_mode( $context = 'view' ) {
658
-        return $this->get_prop( 'mode', $context );
657
+	public function get_mode($context = 'view') {
658
+        return $this->get_prop('mode', $context);
659 659
     }
660 660
 
661 661
     /**
@@ -665,13 +665,13 @@  discard block
 block discarded – undo
665 665
 	 * @param  string $context View or edit context.
666 666
 	 * @return string
667 667
 	 */
668
-	public function get_path( $context = 'view' ) {
669
-        $path   = $this->get_prop( 'path', $context );
668
+	public function get_path($context = 'view') {
669
+        $path = $this->get_prop('path', $context);
670 670
 		$prefix = $this->get_type();
671 671
 
672
-		if ( 0 !== strpos( $path, $prefix ) ) {
673
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
674
-			$this->set_path( $path );
672
+		if (0 !== strpos($path, $prefix)) {
673
+			$path = sanitize_title($prefix . '-' . $this->get_id());
674
+			$this->set_path($path);
675 675
 		}
676 676
 
677 677
 		return $path;
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param  string $context View or edit context.
685 685
 	 * @return string
686 686
 	 */
687
-	public function get_name( $context = 'view' ) {
688
-        return $this->get_prop( 'title', $context );
687
+	public function get_name($context = 'view') {
688
+        return $this->get_prop('title', $context);
689 689
     }
690 690
 
691 691
     /**
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 	 * @param  string $context View or edit context.
696 696
 	 * @return string
697 697
 	 */
698
-	public function get_title( $context = 'view' ) {
699
-		return $this->get_name( $context );
698
+	public function get_title($context = 'view') {
699
+		return $this->get_name($context);
700 700
     }
701 701
 
702 702
     /**
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 	 * @param  string $context View or edit context.
707 707
 	 * @return string
708 708
 	 */
709
-	public function get_description( $context = 'view' ) {
710
-		return $this->get_prop( 'description', $context );
709
+	public function get_description($context = 'view') {
710
+		return $this->get_prop('description', $context);
711 711
     }
712 712
 
713 713
     /**
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 	 * @param  string $context View or edit context.
718 718
 	 * @return string
719 719
 	 */
720
-	public function get_excerpt( $context = 'view' ) {
721
-		return $this->get_description( $context );
720
+	public function get_excerpt($context = 'view') {
721
+		return $this->get_description($context);
722 722
     }
723 723
 
724 724
     /**
@@ -728,8 +728,8 @@  discard block
 block discarded – undo
728 728
 	 * @param  string $context View or edit context.
729 729
 	 * @return string
730 730
 	 */
731
-	public function get_summary( $context = 'view' ) {
732
-		return $this->get_description( $context );
731
+	public function get_summary($context = 'view') {
732
+		return $this->get_description($context);
733 733
     }
734 734
 
735 735
     /**
@@ -739,26 +739,26 @@  discard block
 block discarded – undo
739 739
      * @param  string $context View or edit context.
740 740
 	 * @return array
741 741
 	 */
742
-    public function get_user_info( $context = 'view' ) {
742
+    public function get_user_info($context = 'view') {
743 743
 
744 744
         $user_info = array(
745
-            'user_id'    => $this->get_user_id( $context ),
746
-            'email'      => $this->get_email( $context ),
747
-            'first_name' => $this->get_first_name( $context ),
748
-            'last_name'  => $this->get_last_name( $context ),
749
-            'address'    => $this->get_address( $context ),
750
-            'phone'      => $this->get_phone( $context ),
751
-            'city'       => $this->get_city( $context ),
752
-            'country'    => $this->get_country( $context ),
753
-            'state'      => $this->get_state( $context ),
754
-            'zip'        => $this->get_zip( $context ),
755
-            'company'    => $this->get_company( $context ),
756
-			'company_id' => $this->get_company_id( $context ),
757
-            'vat_number' => $this->get_vat_number( $context ),
758
-            'discount'   => $this->get_discount_code( $context ),
745
+            'user_id'    => $this->get_user_id($context),
746
+            'email'      => $this->get_email($context),
747
+            'first_name' => $this->get_first_name($context),
748
+            'last_name'  => $this->get_last_name($context),
749
+            'address'    => $this->get_address($context),
750
+            'phone'      => $this->get_phone($context),
751
+            'city'       => $this->get_city($context),
752
+            'country'    => $this->get_country($context),
753
+            'state'      => $this->get_state($context),
754
+            'zip'        => $this->get_zip($context),
755
+            'company'    => $this->get_company($context),
756
+			'company_id' => $this->get_company_id($context),
757
+            'vat_number' => $this->get_vat_number($context),
758
+            'discount'   => $this->get_discount_code($context),
759 759
 		);
760 760
 
761
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
761
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
762 762
 
763 763
     }
764 764
 
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 	 * @param  string $context View or edit context.
770 770
 	 * @return int
771 771
 	 */
772
-	public function get_author( $context = 'view' ) {
773
-		return (int) $this->get_prop( 'author', $context );
772
+	public function get_author($context = 'view') {
773
+		return (int) $this->get_prop('author', $context);
774 774
     }
775 775
 
776 776
     /**
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	 * @param  string $context View or edit context.
781 781
 	 * @return int
782 782
 	 */
783
-	public function get_user_id( $context = 'view' ) {
784
-		return $this->get_author( $context );
783
+	public function get_user_id($context = 'view') {
784
+		return $this->get_author($context);
785 785
     }
786 786
 
787 787
      /**
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 	 * @param  string $context View or edit context.
792 792
 	 * @return int
793 793
 	 */
794
-	public function get_customer_id( $context = 'view' ) {
795
-		return (int) $this->get_prop( 'customer_id', $context );
794
+	public function get_customer_id($context = 'view') {
795
+		return (int) $this->get_prop('customer_id', $context);
796 796
     }
797 797
 
798 798
     /**
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 	 * @param  string $context View or edit context.
803 803
 	 * @return string
804 804
 	 */
805
-	public function get_ip( $context = 'view' ) {
806
-		return $this->get_prop( 'user_ip', $context );
805
+	public function get_ip($context = 'view') {
806
+		return $this->get_prop('user_ip', $context);
807 807
     }
808 808
 
809 809
     /**
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
 	 * @param  string $context View or edit context.
814 814
 	 * @return string
815 815
 	 */
816
-	public function get_user_ip( $context = 'view' ) {
817
-		return $this->get_ip( $context );
816
+	public function get_user_ip($context = 'view') {
817
+		return $this->get_ip($context);
818 818
     }
819 819
 
820 820
      /**
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
 	 * @param  string $context View or edit context.
825 825
 	 * @return string
826 826
 	 */
827
-	public function get_customer_ip( $context = 'view' ) {
828
-		return $this->get_ip( $context );
827
+	public function get_customer_ip($context = 'view') {
828
+		return $this->get_ip($context);
829 829
     }
830 830
 
831 831
     /**
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 	 * @param  string $context View or edit context.
836 836
 	 * @return string
837 837
 	 */
838
-	public function get_first_name( $context = 'view' ) {
839
-		return $this->get_prop( 'first_name', $context );
838
+	public function get_first_name($context = 'view') {
839
+		return $this->get_prop('first_name', $context);
840 840
     }
841 841
 
842 842
     /**
@@ -846,8 +846,8 @@  discard block
 block discarded – undo
846 846
 	 * @param  string $context View or edit context.
847 847
 	 * @return string
848 848
 	 */
849
-	public function get_user_first_name( $context = 'view' ) {
850
-		return $this->get_first_name( $context );
849
+	public function get_user_first_name($context = 'view') {
850
+		return $this->get_first_name($context);
851 851
     }
852 852
 
853 853
      /**
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
 	 * @param  string $context View or edit context.
858 858
 	 * @return string
859 859
 	 */
860
-	public function get_customer_first_name( $context = 'view' ) {
861
-		return $this->get_first_name( $context );
860
+	public function get_customer_first_name($context = 'view') {
861
+		return $this->get_first_name($context);
862 862
     }
863 863
 
864 864
     /**
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 	 * @param  string $context View or edit context.
869 869
 	 * @return string
870 870
 	 */
871
-	public function get_last_name( $context = 'view' ) {
872
-		return $this->get_prop( 'last_name', $context );
871
+	public function get_last_name($context = 'view') {
872
+		return $this->get_prop('last_name', $context);
873 873
     }
874 874
 
875 875
     /**
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
 	 * @param  string $context View or edit context.
880 880
 	 * @return string
881 881
 	 */
882
-	public function get_user_last_name( $context = 'view' ) {
883
-		return $this->get_last_name( $context );
882
+	public function get_user_last_name($context = 'view') {
883
+		return $this->get_last_name($context);
884 884
     }
885 885
 
886 886
     /**
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	 * @param  string $context View or edit context.
891 891
 	 * @return string
892 892
 	 */
893
-	public function get_customer_last_name( $context = 'view' ) {
894
-		return $this->get_last_name( $context );
893
+	public function get_customer_last_name($context = 'view') {
894
+		return $this->get_last_name($context);
895 895
     }
896 896
 
897 897
     /**
@@ -901,22 +901,22 @@  discard block
 block discarded – undo
901 901
 	 * @param  string $context View or edit context.
902 902
 	 * @return string
903 903
 	 */
904
-	public function get_full_name( $context = 'view' ) {
905
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
904
+	public function get_full_name($context = 'view') {
905
+		$name = trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
906 906
 
907
-		if ( ! $name ) {
908
-			$user = get_userdata( $this->get_author( $context ) );
907
+		if (!$name) {
908
+			$user = get_userdata($this->get_author($context));
909 909
 
910
-			if ( $user ) {
910
+			if ($user) {
911 911
 				$name = $user->display_name;
912 912
 			}
913 913
 		}
914 914
 
915
-		if ( ! $name ) {
916
-			$name = $this->get_email( $context );
915
+		if (!$name) {
916
+			$name = $this->get_email($context);
917 917
 		}
918 918
 
919
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
919
+		return apply_filters('wpinv_invoice_user_full_name', $name, $this);
920 920
     }
921 921
 
922 922
     /**
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 	 * @param  string $context View or edit context.
927 927
 	 * @return string
928 928
 	 */
929
-	public function get_user_full_name( $context = 'view' ) {
930
-		return $this->get_full_name( $context );
929
+	public function get_user_full_name($context = 'view') {
930
+		return $this->get_full_name($context);
931 931
     }
932 932
 
933 933
     /**
@@ -937,8 +937,8 @@  discard block
 block discarded – undo
937 937
 	 * @param  string $context View or edit context.
938 938
 	 * @return string
939 939
 	 */
940
-	public function get_customer_full_name( $context = 'view' ) {
941
-		return $this->get_full_name( $context );
940
+	public function get_customer_full_name($context = 'view') {
941
+		return $this->get_full_name($context);
942 942
     }
943 943
 
944 944
     /**
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param  string $context View or edit context.
949 949
 	 * @return string
950 950
 	 */
951
-	public function get_phone( $context = 'view' ) {
952
-		return $this->get_prop( 'phone', $context );
951
+	public function get_phone($context = 'view') {
952
+		return $this->get_prop('phone', $context);
953 953
     }
954 954
 
955 955
     /**
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
 	 * @param  string $context View or edit context.
960 960
 	 * @return string
961 961
 	 */
962
-	public function get_phone_number( $context = 'view' ) {
963
-		return $this->get_phone( $context );
962
+	public function get_phone_number($context = 'view') {
963
+		return $this->get_phone($context);
964 964
     }
965 965
 
966 966
     /**
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 	 * @param  string $context View or edit context.
971 971
 	 * @return string
972 972
 	 */
973
-	public function get_user_phone( $context = 'view' ) {
974
-		return $this->get_phone( $context );
973
+	public function get_user_phone($context = 'view') {
974
+		return $this->get_phone($context);
975 975
     }
976 976
 
977 977
     /**
@@ -981,8 +981,8 @@  discard block
 block discarded – undo
981 981
 	 * @param  string $context View or edit context.
982 982
 	 * @return string
983 983
 	 */
984
-	public function get_customer_phone( $context = 'view' ) {
985
-		return $this->get_phone( $context );
984
+	public function get_customer_phone($context = 'view') {
985
+		return $this->get_phone($context);
986 986
     }
987 987
 
988 988
     /**
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
 	 * @param  string $context View or edit context.
993 993
 	 * @return string
994 994
 	 */
995
-	public function get_email( $context = 'view' ) {
996
-		return $this->get_prop( 'email', $context );
995
+	public function get_email($context = 'view') {
996
+		return $this->get_prop('email', $context);
997 997
     }
998 998
 
999 999
     /**
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  string $context View or edit context.
1004 1004
 	 * @return string
1005 1005
 	 */
1006
-	public function get_email_address( $context = 'view' ) {
1007
-		return $this->get_email( $context );
1006
+	public function get_email_address($context = 'view') {
1007
+		return $this->get_email($context);
1008 1008
     }
1009 1009
 
1010 1010
     /**
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
 	 * @param  string $context View or edit context.
1015 1015
 	 * @return string
1016 1016
 	 */
1017
-	public function get_user_email( $context = 'view' ) {
1018
-		return $this->get_email( $context );
1017
+	public function get_user_email($context = 'view') {
1018
+		return $this->get_email($context);
1019 1019
     }
1020 1020
 
1021 1021
     /**
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  string $context View or edit context.
1026 1026
 	 * @return string
1027 1027
 	 */
1028
-	public function get_customer_email( $context = 'view' ) {
1029
-		return $this->get_email( $context );
1028
+	public function get_customer_email($context = 'view') {
1029
+		return $this->get_email($context);
1030 1030
     }
1031 1031
 
1032 1032
     /**
@@ -1036,9 +1036,9 @@  discard block
 block discarded – undo
1036 1036
 	 * @param  string $context View or edit context.
1037 1037
 	 * @return string
1038 1038
 	 */
1039
-	public function get_country( $context = 'view' ) {
1040
-		$country = $this->get_prop( 'country', $context );
1041
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1039
+	public function get_country($context = 'view') {
1040
+		$country = $this->get_prop('country', $context);
1041
+		return empty($country) ? wpinv_get_default_country() : $country;
1042 1042
     }
1043 1043
 
1044 1044
     /**
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
 	 * @param  string $context View or edit context.
1049 1049
 	 * @return string
1050 1050
 	 */
1051
-	public function get_user_country( $context = 'view' ) {
1052
-		return $this->get_country( $context );
1051
+	public function get_user_country($context = 'view') {
1052
+		return $this->get_country($context);
1053 1053
     }
1054 1054
 
1055 1055
     /**
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 	 * @param  string $context View or edit context.
1060 1060
 	 * @return string
1061 1061
 	 */
1062
-	public function get_customer_country( $context = 'view' ) {
1063
-		return $this->get_country( $context );
1062
+	public function get_customer_country($context = 'view') {
1063
+		return $this->get_country($context);
1064 1064
     }
1065 1065
 
1066 1066
     /**
@@ -1070,9 +1070,9 @@  discard block
 block discarded – undo
1070 1070
 	 * @param  string $context View or edit context.
1071 1071
 	 * @return string
1072 1072
 	 */
1073
-	public function get_state( $context = 'view' ) {
1074
-		$state = $this->get_prop( 'state', $context );
1075
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1073
+	public function get_state($context = 'view') {
1074
+		$state = $this->get_prop('state', $context);
1075
+		return empty($state) ? wpinv_get_default_state() : $state;
1076 1076
     }
1077 1077
 
1078 1078
     /**
@@ -1082,8 +1082,8 @@  discard block
 block discarded – undo
1082 1082
 	 * @param  string $context View or edit context.
1083 1083
 	 * @return string
1084 1084
 	 */
1085
-	public function get_user_state( $context = 'view' ) {
1086
-		return $this->get_state( $context );
1085
+	public function get_user_state($context = 'view') {
1086
+		return $this->get_state($context);
1087 1087
     }
1088 1088
 
1089 1089
     /**
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	 * @param  string $context View or edit context.
1094 1094
 	 * @return string
1095 1095
 	 */
1096
-	public function get_customer_state( $context = 'view' ) {
1097
-		return $this->get_state( $context );
1096
+	public function get_customer_state($context = 'view') {
1097
+		return $this->get_state($context);
1098 1098
     }
1099 1099
 
1100 1100
     /**
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 	 * @param  string $context View or edit context.
1105 1105
 	 * @return string
1106 1106
 	 */
1107
-	public function get_city( $context = 'view' ) {
1108
-		return $this->get_prop( 'city', $context );
1107
+	public function get_city($context = 'view') {
1108
+		return $this->get_prop('city', $context);
1109 1109
     }
1110 1110
 
1111 1111
     /**
@@ -1115,8 +1115,8 @@  discard block
 block discarded – undo
1115 1115
 	 * @param  string $context View or edit context.
1116 1116
 	 * @return string
1117 1117
 	 */
1118
-	public function get_user_city( $context = 'view' ) {
1119
-		return $this->get_city( $context );
1118
+	public function get_user_city($context = 'view') {
1119
+		return $this->get_city($context);
1120 1120
     }
1121 1121
 
1122 1122
     /**
@@ -1126,8 +1126,8 @@  discard block
 block discarded – undo
1126 1126
 	 * @param  string $context View or edit context.
1127 1127
 	 * @return string
1128 1128
 	 */
1129
-	public function get_customer_city( $context = 'view' ) {
1130
-		return $this->get_city( $context );
1129
+	public function get_customer_city($context = 'view') {
1130
+		return $this->get_city($context);
1131 1131
     }
1132 1132
 
1133 1133
     /**
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 	 * @param  string $context View or edit context.
1138 1138
 	 * @return string
1139 1139
 	 */
1140
-	public function get_zip( $context = 'view' ) {
1141
-		return $this->get_prop( 'zip', $context );
1140
+	public function get_zip($context = 'view') {
1141
+		return $this->get_prop('zip', $context);
1142 1142
     }
1143 1143
 
1144 1144
     /**
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
 	 * @param  string $context View or edit context.
1149 1149
 	 * @return string
1150 1150
 	 */
1151
-	public function get_user_zip( $context = 'view' ) {
1152
-		return $this->get_zip( $context );
1151
+	public function get_user_zip($context = 'view') {
1152
+		return $this->get_zip($context);
1153 1153
     }
1154 1154
 
1155 1155
     /**
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
 	 * @param  string $context View or edit context.
1160 1160
 	 * @return string
1161 1161
 	 */
1162
-	public function get_customer_zip( $context = 'view' ) {
1163
-		return $this->get_zip( $context );
1162
+	public function get_customer_zip($context = 'view') {
1163
+		return $this->get_zip($context);
1164 1164
     }
1165 1165
 
1166 1166
     /**
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 	 * @param  string $context View or edit context.
1171 1171
 	 * @return string
1172 1172
 	 */
1173
-	public function get_company( $context = 'view' ) {
1174
-		return $this->get_prop( 'company', $context );
1173
+	public function get_company($context = 'view') {
1174
+		return $this->get_prop('company', $context);
1175 1175
     }
1176 1176
 
1177 1177
     /**
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
 	 * @param  string $context View or edit context.
1182 1182
 	 * @return string
1183 1183
 	 */
1184
-	public function get_user_company( $context = 'view' ) {
1185
-		return $this->get_company( $context );
1184
+	public function get_user_company($context = 'view') {
1185
+		return $this->get_company($context);
1186 1186
     }
1187 1187
 
1188 1188
     /**
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 	 * @param  string $context View or edit context.
1193 1193
 	 * @return string
1194 1194
 	 */
1195
-	public function get_customer_company( $context = 'view' ) {
1196
-		return $this->get_company( $context );
1195
+	public function get_customer_company($context = 'view') {
1196
+		return $this->get_company($context);
1197 1197
     }
1198 1198
 
1199 1199
 	/**
@@ -1203,8 +1203,8 @@  discard block
 block discarded – undo
1203 1203
 	 * @param  string $context View or edit context.
1204 1204
 	 * @return string
1205 1205
 	 */
1206
-	public function get_company_id( $context = 'view' ) {
1207
-		return $this->get_prop( 'company_id', $context );
1206
+	public function get_company_id($context = 'view') {
1207
+		return $this->get_prop('company_id', $context);
1208 1208
     }
1209 1209
 
1210 1210
     /**
@@ -1214,8 +1214,8 @@  discard block
 block discarded – undo
1214 1214
 	 * @param  string $context View or edit context.
1215 1215
 	 * @return string
1216 1216
 	 */
1217
-	public function get_vat_number( $context = 'view' ) {
1218
-		return $this->get_prop( 'vat_number', $context );
1217
+	public function get_vat_number($context = 'view') {
1218
+		return $this->get_prop('vat_number', $context);
1219 1219
     }
1220 1220
 
1221 1221
     /**
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
 	 * @param  string $context View or edit context.
1226 1226
 	 * @return string
1227 1227
 	 */
1228
-	public function get_user_vat_number( $context = 'view' ) {
1229
-		return $this->get_vat_number( $context );
1228
+	public function get_user_vat_number($context = 'view') {
1229
+		return $this->get_vat_number($context);
1230 1230
     }
1231 1231
 
1232 1232
     /**
@@ -1236,8 +1236,8 @@  discard block
 block discarded – undo
1236 1236
 	 * @param  string $context View or edit context.
1237 1237
 	 * @return string
1238 1238
 	 */
1239
-	public function get_customer_vat_number( $context = 'view' ) {
1240
-		return $this->get_vat_number( $context );
1239
+	public function get_customer_vat_number($context = 'view') {
1240
+		return $this->get_vat_number($context);
1241 1241
     }
1242 1242
 
1243 1243
     /**
@@ -1247,8 +1247,8 @@  discard block
 block discarded – undo
1247 1247
 	 * @param  string $context View or edit context.
1248 1248
 	 * @return string
1249 1249
 	 */
1250
-	public function get_vat_rate( $context = 'view' ) {
1251
-		return $this->get_prop( 'vat_rate', $context );
1250
+	public function get_vat_rate($context = 'view') {
1251
+		return $this->get_prop('vat_rate', $context);
1252 1252
     }
1253 1253
 
1254 1254
     /**
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 	 * @param  string $context View or edit context.
1259 1259
 	 * @return string
1260 1260
 	 */
1261
-	public function get_user_vat_rate( $context = 'view' ) {
1262
-		return $this->get_vat_rate( $context );
1261
+	public function get_user_vat_rate($context = 'view') {
1262
+		return $this->get_vat_rate($context);
1263 1263
     }
1264 1264
 
1265 1265
     /**
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
 	 * @param  string $context View or edit context.
1270 1270
 	 * @return string
1271 1271
 	 */
1272
-	public function get_customer_vat_rate( $context = 'view' ) {
1273
-		return $this->get_vat_rate( $context );
1272
+	public function get_customer_vat_rate($context = 'view') {
1273
+		return $this->get_vat_rate($context);
1274 1274
     }
1275 1275
 
1276 1276
     /**
@@ -1280,8 +1280,8 @@  discard block
 block discarded – undo
1280 1280
 	 * @param  string $context View or edit context.
1281 1281
 	 * @return string
1282 1282
 	 */
1283
-	public function get_address( $context = 'view' ) {
1284
-		return $this->get_prop( 'address', $context );
1283
+	public function get_address($context = 'view') {
1284
+		return $this->get_prop('address', $context);
1285 1285
     }
1286 1286
 
1287 1287
     /**
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
 	 * @param  string $context View or edit context.
1292 1292
 	 * @return string
1293 1293
 	 */
1294
-	public function get_user_address( $context = 'view' ) {
1295
-		return $this->get_address( $context );
1294
+	public function get_user_address($context = 'view') {
1295
+		return $this->get_address($context);
1296 1296
     }
1297 1297
 
1298 1298
     /**
@@ -1302,8 +1302,8 @@  discard block
 block discarded – undo
1302 1302
 	 * @param  string $context View or edit context.
1303 1303
 	 * @return string
1304 1304
 	 */
1305
-	public function get_customer_address( $context = 'view' ) {
1306
-		return $this->get_address( $context );
1305
+	public function get_customer_address($context = 'view') {
1306
+		return $this->get_address($context);
1307 1307
     }
1308 1308
 
1309 1309
     /**
@@ -1313,8 +1313,8 @@  discard block
 block discarded – undo
1313 1313
 	 * @param  string $context View or edit context.
1314 1314
 	 * @return bool
1315 1315
 	 */
1316
-	public function get_is_viewed( $context = 'view' ) {
1317
-		return (bool) $this->get_prop( 'is_viewed', $context );
1316
+	public function get_is_viewed($context = 'view') {
1317
+		return (bool) $this->get_prop('is_viewed', $context);
1318 1318
 	}
1319 1319
 
1320 1320
 	/**
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
 	 * @param  string $context View or edit context.
1325 1325
 	 * @return bool
1326 1326
 	 */
1327
-	public function get_email_cc( $context = 'view' ) {
1328
-		return $this->get_prop( 'email_cc', $context );
1327
+	public function get_email_cc($context = 'view') {
1328
+		return $this->get_prop('email_cc', $context);
1329 1329
 	}
1330 1330
 
1331 1331
 	/**
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
 	 * @param  string $context View or edit context.
1336 1336
 	 * @return bool
1337 1337
 	 */
1338
-	public function get_template( $context = 'view' ) {
1339
-		return $this->get_prop( 'template', $context );
1338
+	public function get_template($context = 'view') {
1339
+		return $this->get_prop('template', $context);
1340 1340
 	}
1341 1341
 
1342 1342
 	/**
@@ -1346,8 +1346,8 @@  discard block
 block discarded – undo
1346 1346
 	 * @param  string $context View or edit context.
1347 1347
 	 * @return bool
1348 1348
 	 */
1349
-	public function get_created_via( $context = 'view' ) {
1350
-		return $this->get_prop( 'created_via', $context );
1349
+	public function get_created_via($context = 'view') {
1350
+		return $this->get_prop('created_via', $context);
1351 1351
 	}
1352 1352
 
1353 1353
 	/**
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
 	 * @param  string $context View or edit context.
1358 1358
 	 * @return bool
1359 1359
 	 */
1360
-	public function get_address_confirmed( $context = 'view' ) {
1361
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1360
+	public function get_address_confirmed($context = 'view') {
1361
+		return (bool) $this->get_prop('address_confirmed', $context);
1362 1362
     }
1363 1363
 
1364 1364
     /**
@@ -1368,8 +1368,8 @@  discard block
 block discarded – undo
1368 1368
 	 * @param  string $context View or edit context.
1369 1369
 	 * @return bool
1370 1370
 	 */
1371
-	public function get_user_address_confirmed( $context = 'view' ) {
1372
-		return $this->get_address_confirmed( $context );
1371
+	public function get_user_address_confirmed($context = 'view') {
1372
+		return $this->get_address_confirmed($context);
1373 1373
     }
1374 1374
 
1375 1375
     /**
@@ -1379,8 +1379,8 @@  discard block
 block discarded – undo
1379 1379
 	 * @param  string $context View or edit context.
1380 1380
 	 * @return bool
1381 1381
 	 */
1382
-	public function get_customer_address_confirmed( $context = 'view' ) {
1383
-		return $this->get_address_confirmed( $context );
1382
+	public function get_customer_address_confirmed($context = 'view') {
1383
+		return $this->get_address_confirmed($context);
1384 1384
     }
1385 1385
 
1386 1386
 	/**
@@ -1391,8 +1391,8 @@  discard block
 block discarded – undo
1391 1391
 	 */
1392 1392
 	public function get_shipping_address() {
1393 1393
 
1394
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1395
-		return is_array( $shipping_address ) ? $shipping_address : false;
1394
+		$shipping_address = get_post_meta($this->get_id(), 'shipping_address', true);
1395
+		return is_array($shipping_address) ? $shipping_address : false;
1396 1396
     }
1397 1397
 
1398 1398
 	/**
@@ -1409,17 +1409,17 @@  discard block
 block discarded – undo
1409 1409
 	 * @param  string $context View or edit context.
1410 1410
 	 * @return float
1411 1411
 	 */
1412
-	public function get_shipping( $context = 'view' ) {
1412
+	public function get_shipping($context = 'view') {
1413 1413
 
1414
-		if ( $context = 'view' ) {
1415
-			return floatval( $this->get_prop( 'shipping', $context ) );
1414
+		if ($context = 'view') {
1415
+			return floatval($this->get_prop('shipping', $context));
1416 1416
 		}
1417 1417
 
1418
-		return $this->get_prop( 'shipping', $context );
1418
+		return $this->get_prop('shipping', $context);
1419 1419
     }
1420 1420
 
1421 1421
 	public function has_shipping() {
1422
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && $this->get_prop( 'shipping', 'edit' );
1422
+		return defined('GETPAID_SHIPPING_CALCULATOR_VERSION') && $this->get_prop('shipping', 'edit');
1423 1423
     }
1424 1424
 
1425 1425
     /**
@@ -1429,12 +1429,12 @@  discard block
 block discarded – undo
1429 1429
 	 * @param  string $context View or edit context.
1430 1430
 	 * @return float
1431 1431
 	 */
1432
-	public function get_subtotal( $context = 'view' ) {
1433
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1432
+	public function get_subtotal($context = 'view') {
1433
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1434 1434
 
1435 1435
         // Backwards compatibility.
1436
-        if ( is_bool( $context ) && $context ) {
1437
-            return wpinv_price( $subtotal, $this->get_currency() );
1436
+        if (is_bool($context) && $context) {
1437
+            return wpinv_price($subtotal, $this->get_currency());
1438 1438
         }
1439 1439
 
1440 1440
         return $subtotal;
@@ -1447,8 +1447,8 @@  discard block
 block discarded – undo
1447 1447
 	 * @param  string $context View or edit context.
1448 1448
 	 * @return float
1449 1449
 	 */
1450
-	public function get_total_discount( $context = 'view' ) {
1451
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1450
+	public function get_total_discount($context = 'view') {
1451
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context)));
1452 1452
     }
1453 1453
 
1454 1454
     /**
@@ -1458,18 +1458,18 @@  discard block
 block discarded – undo
1458 1458
 	 * @param  string $context View or edit context.
1459 1459
 	 * @return float
1460 1460
 	 */
1461
-	public function get_total_tax( $context = 'view' ) {
1462
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1461
+	public function get_total_tax($context = 'view') {
1462
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context)));
1463 1463
 	}
1464 1464
 
1465 1465
 	/**
1466 1466
 	 * @deprecated
1467 1467
 	 */
1468
-	public function get_final_tax( $currency = false ) {
1468
+	public function get_final_tax($currency = false) {
1469 1469
 		$tax = $this->get_total_tax();
1470 1470
 
1471
-        if ( $currency ) {
1472
-			return wpinv_price( $tax, $this->get_currency() );
1471
+        if ($currency) {
1472
+			return wpinv_price($tax, $this->get_currency());
1473 1473
         }
1474 1474
 
1475 1475
         return $tax;
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
 	 * @param  string $context View or edit context.
1483 1483
 	 * @return float
1484 1484
 	 */
1485
-	public function get_total_fees( $context = 'view' ) {
1486
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1485
+	public function get_total_fees($context = 'view') {
1486
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context)));
1487 1487
     }
1488 1488
 
1489 1489
     /**
@@ -1493,8 +1493,8 @@  discard block
 block discarded – undo
1493 1493
 	 * @param  string $context View or edit context.
1494 1494
 	 * @return float
1495 1495
 	 */
1496
-	public function get_fees_total( $context = 'view' ) {
1497
-		return $this->get_total_fees( $context );
1496
+	public function get_fees_total($context = 'view') {
1497
+		return $this->get_total_fees($context);
1498 1498
     }
1499 1499
 
1500 1500
     /**
@@ -1503,14 +1503,14 @@  discard block
 block discarded – undo
1503 1503
 	 * @since 1.0.19
1504 1504
      * @return float
1505 1505
 	 */
1506
-	public function get_total( $context = 'view' ) {
1507
-		$total = $this->get_prop( 'total', $context );
1506
+	public function get_total($context = 'view') {
1507
+		$total = $this->get_prop('total', $context);
1508 1508
 
1509
-		if ( $this->has_shipping() && $context == 'view' ) {
1510
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1509
+		if ($this->has_shipping() && $context == 'view') {
1510
+			$total = $this->get_prop('total', $context) + $this->get_shipping($context);
1511 1511
 		}
1512 1512
 
1513
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1513
+		return wpinv_round_amount(wpinv_sanitize_amount($total));
1514 1514
 	}
1515 1515
 
1516 1516
 	/**
@@ -1522,20 +1522,20 @@  discard block
 block discarded – undo
1522 1522
 	public function get_non_recurring_total() {
1523 1523
 
1524 1524
 		$subtotal = 0;
1525
-		foreach ( $this->get_items() as $item ) {
1526
-			if ( ! $item->is_recurring() ) {
1525
+		foreach ($this->get_items() as $item) {
1526
+			if (!$item->is_recurring()) {
1527 1527
 				$subtotal += $item->get_sub_total();
1528 1528
 			}
1529 1529
 		}
1530 1530
 
1531
-		foreach ( $this->get_fees() as $fee ) {
1532
-			if ( empty( $fee['recurring_fee'] ) ) {
1533
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
+		foreach ($this->get_fees() as $fee) {
1532
+			if (empty($fee['recurring_fee'])) {
1533
+				$subtotal += wpinv_sanitize_amount($fee['initial_fee']);
1534 1534
 			}
1535 1535
 		}
1536 1536
 
1537
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1538
-        return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1537
+		$subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal));
1538
+        return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this);
1539 1539
 
1540 1540
     }
1541 1541
 
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	 */
1559 1559
     public function get_initial_total() {
1560 1560
 
1561
-		if ( empty( $this->totals ) ) {
1561
+		if (empty($this->totals)) {
1562 1562
 			$this->recalculate_total();
1563 1563
 		}
1564 1564
 
@@ -1568,12 +1568,12 @@  discard block
 block discarded – undo
1568 1568
 		$subtotal = $this->totals['subtotal']['initial'];
1569 1569
 		$total    = $tax + $fee - $discount + $subtotal;
1570 1570
 
1571
-		if ( 0 > $total ) {
1571
+		if (0 > $total) {
1572 1572
 			$total = 0;
1573 1573
 		}
1574 1574
 
1575
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1576
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1575
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1576
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1577 1577
 	}
1578 1578
 
1579 1579
 	/**
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 	 */
1586 1586
     public function get_recurring_total() {
1587 1587
 
1588
-		if ( empty( $this->totals ) ) {
1588
+		if (empty($this->totals)) {
1589 1589
 			$this->recalculate_total();
1590 1590
 		}
1591 1591
 
@@ -1595,12 +1595,12 @@  discard block
 block discarded – undo
1595 1595
 		$subtotal = $this->totals['subtotal']['recurring'];
1596 1596
 		$total    = $tax + $fee - $discount + $subtotal;
1597 1597
 
1598
-		if ( 0 > $total ) {
1598
+		if (0 > $total) {
1599 1599
 			$total = 0;
1600 1600
 		}
1601 1601
 
1602
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1603
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1602
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1603
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1604 1604
 	}
1605 1605
 
1606 1606
 	/**
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
 	 * @param string $currency Whether to include the currency.
1612 1612
      * @return float|string
1613 1613
 	 */
1614
-    public function get_recurring_details( $field = '', $currency = false ) {
1614
+    public function get_recurring_details($field = '', $currency = false) {
1615 1615
 
1616 1616
 		// Maybe recalculate totals.
1617
-		if ( empty( $this->totals ) ) {
1617
+		if (empty($this->totals)) {
1618 1618
 			$this->recalculate_total();
1619 1619
 		}
1620 1620
 
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 			$currency
1635 1635
 		);
1636 1636
 
1637
-        if ( isset( $data[ $field ] ) ) {
1638
-            return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
1637
+        if (isset($data[$field])) {
1638
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1639 1639
         }
1640 1640
 
1641 1641
         return $data;
@@ -1648,8 +1648,8 @@  discard block
 block discarded – undo
1648 1648
 	 * @param  string $context View or edit context.
1649 1649
 	 * @return array
1650 1650
 	 */
1651
-	public function get_fees( $context = 'view' ) {
1652
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1651
+	public function get_fees($context = 'view') {
1652
+		return wpinv_parse_list($this->get_prop('fees', $context));
1653 1653
     }
1654 1654
 
1655 1655
     /**
@@ -1659,8 +1659,8 @@  discard block
 block discarded – undo
1659 1659
 	 * @param  string $context View or edit context.
1660 1660
 	 * @return array
1661 1661
 	 */
1662
-	public function get_discounts( $context = 'view' ) {
1663
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1662
+	public function get_discounts($context = 'view') {
1663
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1664 1664
     }
1665 1665
 
1666 1666
     /**
@@ -1670,8 +1670,8 @@  discard block
 block discarded – undo
1670 1670
 	 * @param  string $context View or edit context.
1671 1671
 	 * @return array
1672 1672
 	 */
1673
-	public function get_taxes( $context = 'view' ) {
1674
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1673
+	public function get_taxes($context = 'view') {
1674
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1675 1675
     }
1676 1676
 
1677 1677
     /**
@@ -1681,8 +1681,8 @@  discard block
 block discarded – undo
1681 1681
 	 * @param  string $context View or edit context.
1682 1682
 	 * @return GetPaid_Form_Item[]
1683 1683
 	 */
1684
-	public function get_items( $context = 'view' ) {
1685
-        return $this->get_prop( 'items', $context );
1684
+	public function get_items($context = 'view') {
1685
+        return $this->get_prop('items', $context);
1686 1686
 	}
1687 1687
 
1688 1688
 	/**
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 	 * @return string
1693 1693
 	 */
1694 1694
 	public function get_item_ids() {
1695
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1695
+		return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id'));
1696 1696
     }
1697 1697
 
1698 1698
     /**
@@ -1702,8 +1702,8 @@  discard block
 block discarded – undo
1702 1702
 	 * @param  string $context View or edit context.
1703 1703
 	 * @return int
1704 1704
 	 */
1705
-	public function get_payment_form( $context = 'view' ) {
1706
-		return intval( $this->get_prop( 'payment_form', $context ) );
1705
+	public function get_payment_form($context = 'view') {
1706
+		return intval($this->get_prop('payment_form', $context));
1707 1707
     }
1708 1708
 
1709 1709
     /**
@@ -1713,8 +1713,8 @@  discard block
 block discarded – undo
1713 1713
 	 * @param  string $context View or edit context.
1714 1714
 	 * @return string
1715 1715
 	 */
1716
-	public function get_submission_id( $context = 'view' ) {
1717
-		return $this->get_prop( 'submission_id', $context );
1716
+	public function get_submission_id($context = 'view') {
1717
+		return $this->get_prop('submission_id', $context);
1718 1718
     }
1719 1719
 
1720 1720
     /**
@@ -1724,8 +1724,8 @@  discard block
 block discarded – undo
1724 1724
 	 * @param  string $context View or edit context.
1725 1725
 	 * @return string
1726 1726
 	 */
1727
-	public function get_discount_code( $context = 'view' ) {
1728
-		return $this->get_prop( 'discount_code', $context );
1727
+	public function get_discount_code($context = 'view') {
1728
+		return $this->get_prop('discount_code', $context);
1729 1729
     }
1730 1730
 
1731 1731
     /**
@@ -1735,8 +1735,8 @@  discard block
 block discarded – undo
1735 1735
 	 * @param  string $context View or edit context.
1736 1736
 	 * @return string
1737 1737
 	 */
1738
-	public function get_gateway( $context = 'view' ) {
1739
-		return $this->get_prop( 'gateway', $context );
1738
+	public function get_gateway($context = 'view') {
1739
+		return $this->get_prop('gateway', $context);
1740 1740
     }
1741 1741
 
1742 1742
     /**
@@ -1746,8 +1746,8 @@  discard block
 block discarded – undo
1746 1746
 	 * @return string
1747 1747
 	 */
1748 1748
     public function get_gateway_title() {
1749
-        $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1750
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1749
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1750
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1751 1751
     }
1752 1752
 
1753 1753
     /**
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
 	 * @param  string $context View or edit context.
1758 1758
 	 * @return string
1759 1759
 	 */
1760
-	public function get_transaction_id( $context = 'view' ) {
1761
-		return $this->get_prop( 'transaction_id', $context );
1760
+	public function get_transaction_id($context = 'view') {
1761
+		return $this->get_prop('transaction_id', $context);
1762 1762
     }
1763 1763
 
1764 1764
     /**
@@ -1768,9 +1768,9 @@  discard block
 block discarded – undo
1768 1768
 	 * @param  string $context View or edit context.
1769 1769
 	 * @return string
1770 1770
 	 */
1771
-	public function get_currency( $context = 'view' ) {
1772
-        $currency = $this->get_prop( 'currency', $context );
1773
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1771
+	public function get_currency($context = 'view') {
1772
+        $currency = $this->get_prop('currency', $context);
1773
+        return empty($currency) ? wpinv_get_currency() : $currency;
1774 1774
     }
1775 1775
 
1776 1776
     /**
@@ -1780,8 +1780,8 @@  discard block
 block discarded – undo
1780 1780
 	 * @param  string $context View or edit context.
1781 1781
 	 * @return bool
1782 1782
 	 */
1783
-	public function get_disable_taxes( $context = 'view' ) {
1784
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1783
+	public function get_disable_taxes($context = 'view') {
1784
+        return (bool) $this->get_prop('disable_taxes', $context);
1785 1785
     }
1786 1786
 
1787 1787
     /**
@@ -1791,8 +1791,8 @@  discard block
 block discarded – undo
1791 1791
 	 * @param  string $context View or edit context.
1792 1792
 	 * @return int
1793 1793
 	 */
1794
-    public function get_subscription_id( $context = 'view' ) {
1795
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1794
+    public function get_subscription_id($context = 'view') {
1795
+		return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context);
1796 1796
 	}
1797 1797
 
1798 1798
 	/**
@@ -1802,12 +1802,12 @@  discard block
 block discarded – undo
1802 1802
 	 * @param  string $context View or edit context.
1803 1803
 	 * @return int
1804 1804
 	 */
1805
-    public function get_remote_subscription_id( $context = 'view' ) {
1806
-        $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1805
+    public function get_remote_subscription_id($context = 'view') {
1806
+        $subscription_id = $this->get_prop('remote_subscription_id', $context);
1807 1807
 
1808
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1808
+        if (empty($subscription_id) && $this->is_renewal()) {
1809 1809
             $parent = $this->get_parent();
1810
-            return $parent->get_remote_subscription_id( $context );
1810
+            return $parent->get_remote_subscription_id($context);
1811 1811
         }
1812 1812
 
1813 1813
         return $subscription_id;
@@ -1820,8 +1820,8 @@  discard block
 block discarded – undo
1820 1820
 	 * @param  string $context View or edit context.
1821 1821
 	 * @return string
1822 1822
 	 */
1823
-	public function get_is_anonymized( $context = 'view' ) {
1824
-		return (bool) $this->get_prop( 'is_anonymized', $context );
1823
+	public function get_is_anonymized($context = 'view') {
1824
+		return (bool) $this->get_prop('is_anonymized', $context);
1825 1825
     }
1826 1826
 
1827 1827
     /**
@@ -1831,20 +1831,20 @@  discard block
 block discarded – undo
1831 1831
 	 * @param  string $context View or edit context.
1832 1832
 	 * @return array
1833 1833
 	 */
1834
-    public function get_payment_meta( $context = 'view' ) {
1834
+    public function get_payment_meta($context = 'view') {
1835 1835
 
1836 1836
         return array(
1837
-            'price'        => $this->get_total( $context ),
1838
-            'date'         => $this->get_date_created( $context ),
1839
-            'user_email'   => $this->get_email( $context ),
1840
-            'invoice_key'  => $this->get_key( $context ),
1841
-            'currency'     => $this->get_currency( $context ),
1842
-            'items'        => $this->get_items( $context ),
1843
-            'user_info'    => $this->get_user_info( $context ),
1837
+            'price'        => $this->get_total($context),
1838
+            'date'         => $this->get_date_created($context),
1839
+            'user_email'   => $this->get_email($context),
1840
+            'invoice_key'  => $this->get_key($context),
1841
+            'currency'     => $this->get_currency($context),
1842
+            'items'        => $this->get_items($context),
1843
+            'user_info'    => $this->get_user_info($context),
1844 1844
             'cart_details' => $this->get_cart_details(),
1845
-            'status'       => $this->get_status( $context ),
1846
-            'fees'         => $this->get_fees( $context ),
1847
-            'taxes'        => $this->get_taxes( $context ),
1845
+            'status'       => $this->get_status($context),
1846
+            'fees'         => $this->get_fees($context),
1847
+            'taxes'        => $this->get_taxes($context),
1848 1848
         );
1849 1849
 
1850 1850
     }
@@ -1859,9 +1859,9 @@  discard block
 block discarded – undo
1859 1859
         $items        = $this->get_items();
1860 1860
         $cart_details = array();
1861 1861
 
1862
-        foreach ( $items as $item ) {
1862
+        foreach ($items as $item) {
1863 1863
 			$item->invoice_id = $this->get_id();
1864
-            $cart_details[]   = $item->prepare_data_for_saving();
1864
+            $cart_details[] = $item->prepare_data_for_saving();
1865 1865
         }
1866 1866
 
1867 1867
         return $cart_details;
@@ -1872,11 +1872,11 @@  discard block
 block discarded – undo
1872 1872
 	 *
1873 1873
 	 * @return null|GetPaid_Form_Item|int
1874 1874
 	 */
1875
-	public function get_recurring( $object = false ) {
1875
+	public function get_recurring($object = false) {
1876 1876
 
1877 1877
 		// Are we returning an object?
1878
-        if ( $object ) {
1879
-            return $this->get_item( $this->recurring_item );
1878
+        if ($object) {
1879
+            return $this->get_item($this->recurring_item);
1880 1880
         }
1881 1881
 
1882 1882
         return $this->recurring_item;
@@ -1891,15 +1891,15 @@  discard block
 block discarded – undo
1891 1891
 	public function get_subscription_name() {
1892 1892
 
1893 1893
 		// Retrieve the recurring name
1894
-        $item = $this->get_recurring( true );
1894
+        $item = $this->get_recurring(true);
1895 1895
 
1896 1896
 		// Abort if it does not exist.
1897
-        if ( empty( $item ) ) {
1897
+        if (empty($item)) {
1898 1898
             return '';
1899 1899
         }
1900 1900
 
1901 1901
 		// Return the item name.
1902
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1902
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1903 1903
 	}
1904 1904
 
1905 1905
 	/**
@@ -1909,9 +1909,9 @@  discard block
 block discarded – undo
1909 1909
 	 * @return string
1910 1910
 	 */
1911 1911
 	public function get_view_url() {
1912
-        $invoice_url = get_permalink( $this->get_id() );
1913
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1914
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1912
+        $invoice_url = get_permalink($this->get_id());
1913
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1914
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1915 1915
 	}
1916 1916
 
1917 1917
 	/**
@@ -1920,25 +1920,25 @@  discard block
 block discarded – undo
1920 1920
 	 * @since 1.0.19
1921 1921
 	 * @return string
1922 1922
 	 */
1923
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1923
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1924 1924
 
1925 1925
 		// Retrieve the checkout url.
1926 1926
         $pay_url = wpinv_get_checkout_uri();
1927 1927
 
1928 1928
 		// Maybe force ssl.
1929
-        if ( is_ssl() ) {
1930
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1929
+        if (is_ssl()) {
1930
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1931 1931
         }
1932 1932
 
1933 1933
 		// Add the invoice key.
1934
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1934
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1935 1935
 
1936 1936
 		// (Maybe?) add a secret
1937
-        if ( $secret ) {
1938
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1937
+        if ($secret) {
1938
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1939 1939
         }
1940 1940
 
1941
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1941
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1942 1942
 	}
1943 1943
 
1944 1944
 	/**
@@ -1953,14 +1953,14 @@  discard block
 block discarded – undo
1953 1953
         $receipt_url = wpinv_get_success_page_uri();
1954 1954
 
1955 1955
 		// Maybe force ssl.
1956
-        if ( is_ssl() ) {
1957
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1956
+        if (is_ssl()) {
1957
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1958 1958
         }
1959 1959
 
1960 1960
 		// Add the invoice key.
1961
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1961
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1962 1962
 
1963
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1963
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1964 1964
 	}
1965 1965
 
1966 1966
 	/**
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
 	 * @return string
1971 1971
 	 */
1972 1972
 	public function get_transaction_url() {
1973
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1973
+		return apply_filters('getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this);
1974 1974
 	}
1975 1975
 
1976 1976
 	/**
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 
1984 1984
 		$type   = $this->get_type();
1985 1985
 		$status = "wpi-$type-pending";
1986
-		return str_replace( '-invoice', '', $status );
1986
+		return str_replace('-invoice', '', $status);
1987 1987
 
1988 1988
 	}
1989 1989
 
@@ -1997,14 +1997,14 @@  discard block
 block discarded – undo
1997 1997
 	 * @param  string $context View or edit context.
1998 1998
 	 * @return mixed Value of the given invoice property (if set).
1999 1999
 	 */
2000
-	public function get( $key, $context = 'view' ) {
2000
+	public function get($key, $context = 'view') {
2001 2001
 		$method = "get_$key";
2002 2002
 
2003
-		if ( is_callable( array( $this, $method ) ) ) {
2004
-			return $this->$method( $context );
2003
+		if (is_callable(array($this, $method))) {
2004
+			return $this->$method($context);
2005 2005
 		}
2006 2006
 
2007
-        return $this->get_prop( $key, $context );
2007
+        return $this->get_prop($key, $context);
2008 2008
 	}
2009 2009
 
2010 2010
     /*
@@ -2027,11 +2027,11 @@  discard block
 block discarded – undo
2027 2027
 	 * @param  mixed $value new value.
2028 2028
 	 * @return mixed Value of the given invoice property (if set).
2029 2029
 	 */
2030
-	public function set( $key, $value ) {
2030
+	public function set($key, $value) {
2031 2031
 
2032 2032
         $setter = "set_$key";
2033
-        if ( is_callable( array( $this, $setter ) ) ) {
2034
-            $this->{$setter}( $value );
2033
+        if (is_callable(array($this, $setter))) {
2034
+            $this->{$setter}($value);
2035 2035
         }
2036 2036
 
2037 2037
 	}
@@ -2045,45 +2045,45 @@  discard block
 block discarded – undo
2045 2045
 	 * @param bool   $manual_update Is this a manual status change?.
2046 2046
 	 * @return array details of change.
2047 2047
 	 */
2048
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2048
+	public function set_status($new_status, $note = '', $manual_update = false) {
2049 2049
 		$old_status = $this->get_status();
2050 2050
 
2051 2051
 		$statuses = $this->get_all_statuses();
2052 2052
 
2053
-		if ( isset( $statuses['draft'] ) ) {
2054
-			unset( $statuses['draft'] );
2053
+		if (isset($statuses['draft'])) {
2054
+			unset($statuses['draft']);
2055 2055
 		}
2056 2056
 
2057
-		$this->set_prop( 'status', $new_status );
2057
+		$this->set_prop('status', $new_status);
2058 2058
 
2059 2059
 		// If setting the status, ensure it's set to a valid status.
2060
-		if ( true === $this->object_read ) {
2060
+		if (true === $this->object_read) {
2061 2061
 
2062 2062
 			// Only allow valid new status.
2063
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2063
+			if (!array_key_exists($new_status, $statuses)) {
2064 2064
 				$new_status = $this->get_default_status();
2065 2065
 			}
2066 2066
 
2067 2067
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2068
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2068
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
2069 2069
 				$old_status = $this->get_default_status();
2070 2070
 			}
2071 2071
 
2072 2072
 			// Paid - Renewal (i.e when duplicating a parent invoice )
2073
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2073
+			if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) {
2074 2074
 				$old_status = 'wpi-pending';
2075 2075
 			}
2076 2076
 
2077
-			if ( $old_status !== $new_status ) {
2077
+			if ($old_status !== $new_status) {
2078 2078
 				$this->status_transition = array(
2079
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2079
+					'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
2080 2080
 					'to'     => $new_status,
2081 2081
 					'note'   => $note,
2082 2082
 					'manual' => (bool) $manual_update,
2083 2083
 				);
2084 2084
 
2085
-				if ( $manual_update ) {
2086
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2085
+				if ($manual_update) {
2086
+					do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
2087 2087
 				}
2088 2088
 
2089 2089
 				$this->maybe_set_date_paid();
@@ -2107,8 +2107,8 @@  discard block
 block discarded – undo
2107 2107
 	 */
2108 2108
 	public function maybe_set_date_paid() {
2109 2109
 
2110
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2111
-			$this->set_date_completed( current_time( 'mysql' ) );
2110
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
2111
+			$this->set_date_completed(current_time('mysql'));
2112 2112
 		}
2113 2113
 	}
2114 2114
 
@@ -2117,11 +2117,11 @@  discard block
 block discarded – undo
2117 2117
 	 *
2118 2118
 	 * @since 1.0.19
2119 2119
 	 */
2120
-	public function set_parent_id( $value ) {
2121
-		if ( $value && ( $value === $this->get_id() ) ) {
2120
+	public function set_parent_id($value) {
2121
+		if ($value && ($value === $this->get_id())) {
2122 2122
 			return;
2123 2123
 		}
2124
-		$this->set_prop( 'parent_id', absint( $value ) );
2124
+		$this->set_prop('parent_id', absint($value));
2125 2125
     }
2126 2126
 
2127 2127
     /**
@@ -2129,8 +2129,8 @@  discard block
 block discarded – undo
2129 2129
 	 *
2130 2130
 	 * @since 1.0.19
2131 2131
 	 */
2132
-	public function set_version( $value ) {
2133
-		$this->set_prop( 'version', $value );
2132
+	public function set_version($value) {
2133
+		$this->set_prop('version', $value);
2134 2134
     }
2135 2135
 
2136 2136
     /**
@@ -2140,15 +2140,15 @@  discard block
 block discarded – undo
2140 2140
 	 * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142 2142
 	 */
2143
-	public function set_date_created( $value ) {
2144
-        $date = strtotime( $value );
2143
+	public function set_date_created($value) {
2144
+        $date = strtotime($value);
2145 2145
 
2146
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2147
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
2146
+        if ($date && $value !== '0000-00-00 00:00:00') {
2147
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'date_created', '' );
2151
+		$this->set_prop('date_created', '');
2152 2152
 		return false;
2153 2153
 
2154 2154
     }
@@ -2160,15 +2160,15 @@  discard block
 block discarded – undo
2160 2160
 	 * @param string $value Value to set.
2161 2161
      * @return bool Whether or not the date was set.
2162 2162
 	 */
2163
-	public function set_due_date( $value ) {
2164
-        $date = strtotime( $value );
2163
+	public function set_due_date($value) {
2164
+        $date = strtotime($value);
2165 2165
 
2166
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2167
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
2166
+        if ($date && $value !== '0000-00-00 00:00:00') {
2167
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
2168 2168
             return true;
2169 2169
         }
2170 2170
 
2171
-		$this->set_prop( 'due_date', '' );
2171
+		$this->set_prop('due_date', '');
2172 2172
         return false;
2173 2173
 
2174 2174
     }
@@ -2179,8 +2179,8 @@  discard block
 block discarded – undo
2179 2179
 	 * @since 1.0.19
2180 2180
 	 * @param  string $value New name.
2181 2181
 	 */
2182
-	public function set_date_due( $value ) {
2183
-		$this->set_due_date( $value );
2182
+	public function set_date_due($value) {
2183
+		$this->set_due_date($value);
2184 2184
     }
2185 2185
 
2186 2186
     /**
@@ -2190,15 +2190,15 @@  discard block
 block discarded – undo
2190 2190
 	 * @param string $value Value to set.
2191 2191
      * @return bool Whether or not the date was set.
2192 2192
 	 */
2193
-	public function set_completed_date( $value ) {
2194
-        $date = strtotime( $value );
2193
+	public function set_completed_date($value) {
2194
+        $date = strtotime($value);
2195 2195
 
2196
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2197
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
2196
+        if ($date && $value !== '0000-00-00 00:00:00') {
2197
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
2198 2198
             return true;
2199 2199
         }
2200 2200
 
2201
-		$this->set_prop( 'completed_date', '' );
2201
+		$this->set_prop('completed_date', '');
2202 2202
         return false;
2203 2203
 
2204 2204
     }
@@ -2209,8 +2209,8 @@  discard block
 block discarded – undo
2209 2209
 	 * @since 1.0.19
2210 2210
 	 * @param  string $value New name.
2211 2211
 	 */
2212
-	public function set_date_completed( $value ) {
2213
-		$this->set_completed_date( $value );
2212
+	public function set_date_completed($value) {
2213
+		$this->set_completed_date($value);
2214 2214
     }
2215 2215
 
2216 2216
     /**
@@ -2220,15 +2220,15 @@  discard block
 block discarded – undo
2220 2220
 	 * @param string $value Value to set.
2221 2221
      * @return bool Whether or not the date was set.
2222 2222
 	 */
2223
-	public function set_date_modified( $value ) {
2224
-        $date = strtotime( $value );
2223
+	public function set_date_modified($value) {
2224
+        $date = strtotime($value);
2225 2225
 
2226
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2227
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
2226
+        if ($date && $value !== '0000-00-00 00:00:00') {
2227
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
2228 2228
             return true;
2229 2229
         }
2230 2230
 
2231
-		$this->set_prop( 'date_modified', '' );
2231
+		$this->set_prop('date_modified', '');
2232 2232
         return false;
2233 2233
 
2234 2234
     }
@@ -2239,9 +2239,9 @@  discard block
 block discarded – undo
2239 2239
 	 * @since 1.0.19
2240 2240
 	 * @param  string $value New number.
2241 2241
 	 */
2242
-	public function set_number( $value ) {
2243
-        $number = sanitize_text_field( $value );
2244
-		$this->set_prop( 'number', $number );
2242
+	public function set_number($value) {
2243
+        $number = sanitize_text_field($value);
2244
+		$this->set_prop('number', $number);
2245 2245
     }
2246 2246
 
2247 2247
     /**
@@ -2250,9 +2250,9 @@  discard block
 block discarded – undo
2250 2250
 	 * @since 1.0.19
2251 2251
 	 * @param  string $value Type.
2252 2252
 	 */
2253
-	public function set_type( $value ) {
2254
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2255
-		$this->set_prop( 'type', $type );
2253
+	public function set_type($value) {
2254
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2255
+		$this->set_prop('type', $type);
2256 2256
 	}
2257 2257
 
2258 2258
     /**
@@ -2261,10 +2261,10 @@  discard block
 block discarded – undo
2261 2261
 	 * @since 1.0.19
2262 2262
 	 * @param  string $value Post type.
2263 2263
 	 */
2264
-	public function set_post_type( $value ) {
2265
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2266
-			$this->set_type( $value );
2267
-            $this->set_prop( 'post_type', $value );
2264
+	public function set_post_type($value) {
2265
+        if (getpaid_is_invoice_post_type($value)) {
2266
+			$this->set_type($value);
2267
+            $this->set_prop('post_type', $value);
2268 2268
         }
2269 2269
     }
2270 2270
 
@@ -2274,9 +2274,9 @@  discard block
 block discarded – undo
2274 2274
 	 * @since 1.0.19
2275 2275
 	 * @param  string $value New key.
2276 2276
 	 */
2277
-	public function set_key( $value ) {
2278
-        $key = sanitize_text_field( $value );
2279
-		$this->set_prop( 'key', $key );
2277
+	public function set_key($value) {
2278
+        $key = sanitize_text_field($value);
2279
+		$this->set_prop('key', $key);
2280 2280
     }
2281 2281
 
2282 2282
     /**
@@ -2285,9 +2285,9 @@  discard block
 block discarded – undo
2285 2285
 	 * @since 1.0.19
2286 2286
 	 * @param  string $value mode.
2287 2287
 	 */
2288
-	public function set_mode( $value ) {
2289
-        if ( in_array( $value, array( 'live', 'test' ) ) ) {
2290
-            $this->set_prop( 'mode', $value );
2288
+	public function set_mode($value) {
2289
+        if (in_array($value, array('live', 'test'))) {
2290
+            $this->set_prop('mode', $value);
2291 2291
         }
2292 2292
     }
2293 2293
 
@@ -2297,8 +2297,8 @@  discard block
 block discarded – undo
2297 2297
 	 * @since 1.0.19
2298 2298
 	 * @param  string $value path.
2299 2299
 	 */
2300
-	public function set_path( $value ) {
2301
-        $this->set_prop( 'path', $value );
2300
+	public function set_path($value) {
2301
+        $this->set_prop('path', $value);
2302 2302
     }
2303 2303
 
2304 2304
     /**
@@ -2307,9 +2307,9 @@  discard block
 block discarded – undo
2307 2307
 	 * @since 1.0.19
2308 2308
 	 * @param  string $value New name.
2309 2309
 	 */
2310
-	public function set_name( $value ) {
2311
-        $name = sanitize_text_field( $value );
2312
-		$this->set_prop( 'name', $name );
2310
+	public function set_name($value) {
2311
+        $name = sanitize_text_field($value);
2312
+		$this->set_prop('name', $name);
2313 2313
     }
2314 2314
 
2315 2315
     /**
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
 	 * @since 1.0.19
2319 2319
 	 * @param  string $value New name.
2320 2320
 	 */
2321
-	public function set_title( $value ) {
2322
-		$this->set_name( $value );
2321
+	public function set_title($value) {
2322
+		$this->set_name($value);
2323 2323
     }
2324 2324
 
2325 2325
     /**
@@ -2328,9 +2328,9 @@  discard block
 block discarded – undo
2328 2328
 	 * @since 1.0.19
2329 2329
 	 * @param  string $value New description.
2330 2330
 	 */
2331
-	public function set_description( $value ) {
2332
-        $description = wp_kses_post( $value );
2333
-		$this->set_prop( 'description', $description );
2331
+	public function set_description($value) {
2332
+        $description = wp_kses_post($value);
2333
+		$this->set_prop('description', $description);
2334 2334
     }
2335 2335
 
2336 2336
     /**
@@ -2339,8 +2339,8 @@  discard block
 block discarded – undo
2339 2339
 	 * @since 1.0.19
2340 2340
 	 * @param  string $value New description.
2341 2341
 	 */
2342
-	public function set_excerpt( $value ) {
2343
-		$this->set_description( $value );
2342
+	public function set_excerpt($value) {
2343
+		$this->set_description($value);
2344 2344
     }
2345 2345
 
2346 2346
     /**
@@ -2349,8 +2349,8 @@  discard block
 block discarded – undo
2349 2349
 	 * @since 1.0.19
2350 2350
 	 * @param  string $value New description.
2351 2351
 	 */
2352
-	public function set_summary( $value ) {
2353
-		$this->set_description( $value );
2352
+	public function set_summary($value) {
2353
+		$this->set_description($value);
2354 2354
     }
2355 2355
 
2356 2356
     /**
@@ -2359,12 +2359,12 @@  discard block
 block discarded – undo
2359 2359
 	 * @since 1.0.19
2360 2360
 	 * @param  int $value New author.
2361 2361
 	 */
2362
-	public function set_author( $value ) {
2363
-		$user = get_user_by( 'id', (int) $value );
2362
+	public function set_author($value) {
2363
+		$user = get_user_by('id', (int) $value);
2364 2364
 
2365
-		if ( $user && $user->ID ) {
2366
-			$this->set_prop( 'author', $user->ID );
2367
-			$this->set_prop( 'email', $user->user_email );
2365
+		if ($user && $user->ID) {
2366
+			$this->set_prop('author', $user->ID);
2367
+			$this->set_prop('email', $user->user_email);
2368 2368
 		}
2369 2369
 
2370 2370
     }
@@ -2375,8 +2375,8 @@  discard block
 block discarded – undo
2375 2375
 	 * @since 1.0.19
2376 2376
 	 * @param  int $value New user id.
2377 2377
 	 */
2378
-	public function set_user_id( $value ) {
2379
-		$this->set_author( $value );
2378
+	public function set_user_id($value) {
2379
+		$this->set_author($value);
2380 2380
     }
2381 2381
 
2382 2382
     /**
@@ -2385,8 +2385,8 @@  discard block
 block discarded – undo
2385 2385
 	 * @since 1.0.19
2386 2386
 	 * @param  int $value New user id.
2387 2387
 	 */
2388
-	public function set_customer_id( $value ) {
2389
-		$this->set_prop( 'customer_id', (int) $value );
2388
+	public function set_customer_id($value) {
2389
+		$this->set_prop('customer_id', (int) $value);
2390 2390
     }
2391 2391
 
2392 2392
     /**
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 	 * @since 1.0.19
2396 2396
 	 * @param  string $value ip address.
2397 2397
 	 */
2398
-	public function set_ip( $value ) {
2399
-		$this->set_prop( 'ip', $value );
2398
+	public function set_ip($value) {
2399
+		$this->set_prop('ip', $value);
2400 2400
     }
2401 2401
 
2402 2402
     /**
@@ -2405,8 +2405,8 @@  discard block
 block discarded – undo
2405 2405
 	 * @since 1.0.19
2406 2406
 	 * @param  string $value ip address.
2407 2407
 	 */
2408
-	public function set_user_ip( $value ) {
2409
-		$this->set_ip( $value );
2408
+	public function set_user_ip($value) {
2409
+		$this->set_ip($value);
2410 2410
     }
2411 2411
 
2412 2412
     /**
@@ -2415,8 +2415,8 @@  discard block
 block discarded – undo
2415 2415
 	 * @since 1.0.19
2416 2416
 	 * @param  string $value first name.
2417 2417
 	 */
2418
-	public function set_first_name( $value ) {
2419
-		$this->set_prop( 'first_name', $value );
2418
+	public function set_first_name($value) {
2419
+		$this->set_prop('first_name', $value);
2420 2420
     }
2421 2421
 
2422 2422
     /**
@@ -2425,8 +2425,8 @@  discard block
 block discarded – undo
2425 2425
 	 * @since 1.0.19
2426 2426
 	 * @param  string $value first name.
2427 2427
 	 */
2428
-	public function set_user_first_name( $value ) {
2429
-		$this->set_first_name( $value );
2428
+	public function set_user_first_name($value) {
2429
+		$this->set_first_name($value);
2430 2430
     }
2431 2431
 
2432 2432
     /**
@@ -2435,8 +2435,8 @@  discard block
 block discarded – undo
2435 2435
 	 * @since 1.0.19
2436 2436
 	 * @param  string $value first name.
2437 2437
 	 */
2438
-	public function set_customer_first_name( $value ) {
2439
-		$this->set_first_name( $value );
2438
+	public function set_customer_first_name($value) {
2439
+		$this->set_first_name($value);
2440 2440
     }
2441 2441
 
2442 2442
     /**
@@ -2445,8 +2445,8 @@  discard block
 block discarded – undo
2445 2445
 	 * @since 1.0.19
2446 2446
 	 * @param  string $value last name.
2447 2447
 	 */
2448
-	public function set_last_name( $value ) {
2449
-		$this->set_prop( 'last_name', $value );
2448
+	public function set_last_name($value) {
2449
+		$this->set_prop('last_name', $value);
2450 2450
     }
2451 2451
 
2452 2452
     /**
@@ -2455,8 +2455,8 @@  discard block
 block discarded – undo
2455 2455
 	 * @since 1.0.19
2456 2456
 	 * @param  string $value last name.
2457 2457
 	 */
2458
-	public function set_user_last_name( $value ) {
2459
-		$this->set_last_name( $value );
2458
+	public function set_user_last_name($value) {
2459
+		$this->set_last_name($value);
2460 2460
     }
2461 2461
 
2462 2462
     /**
@@ -2465,8 +2465,8 @@  discard block
 block discarded – undo
2465 2465
 	 * @since 1.0.19
2466 2466
 	 * @param  string $value last name.
2467 2467
 	 */
2468
-	public function set_customer_last_name( $value ) {
2469
-		$this->set_last_name( $value );
2468
+	public function set_customer_last_name($value) {
2469
+		$this->set_last_name($value);
2470 2470
     }
2471 2471
 
2472 2472
     /**
@@ -2475,8 +2475,8 @@  discard block
 block discarded – undo
2475 2475
 	 * @since 1.0.19
2476 2476
 	 * @param  string $value phone.
2477 2477
 	 */
2478
-	public function set_phone( $value ) {
2479
-		$this->set_prop( 'phone', $value );
2478
+	public function set_phone($value) {
2479
+		$this->set_prop('phone', $value);
2480 2480
     }
2481 2481
 
2482 2482
     /**
@@ -2485,8 +2485,8 @@  discard block
 block discarded – undo
2485 2485
 	 * @since 1.0.19
2486 2486
 	 * @param  string $value phone.
2487 2487
 	 */
2488
-	public function set_user_phone( $value ) {
2489
-		$this->set_phone( $value );
2488
+	public function set_user_phone($value) {
2489
+		$this->set_phone($value);
2490 2490
     }
2491 2491
 
2492 2492
     /**
@@ -2495,8 +2495,8 @@  discard block
 block discarded – undo
2495 2495
 	 * @since 1.0.19
2496 2496
 	 * @param  string $value phone.
2497 2497
 	 */
2498
-	public function set_customer_phone( $value ) {
2499
-		$this->set_phone( $value );
2498
+	public function set_customer_phone($value) {
2499
+		$this->set_phone($value);
2500 2500
     }
2501 2501
 
2502 2502
     /**
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 	 * @since 1.0.19
2506 2506
 	 * @param  string $value phone.
2507 2507
 	 */
2508
-	public function set_phone_number( $value ) {
2509
-		$this->set_phone( $value );
2508
+	public function set_phone_number($value) {
2509
+		$this->set_phone($value);
2510 2510
     }
2511 2511
 
2512 2512
     /**
@@ -2515,8 +2515,8 @@  discard block
 block discarded – undo
2515 2515
 	 * @since 1.0.19
2516 2516
 	 * @param  string $value email address.
2517 2517
 	 */
2518
-	public function set_email( $value ) {
2519
-		$this->set_prop( 'email', $value );
2518
+	public function set_email($value) {
2519
+		$this->set_prop('email', $value);
2520 2520
     }
2521 2521
 
2522 2522
     /**
@@ -2525,8 +2525,8 @@  discard block
 block discarded – undo
2525 2525
 	 * @since 1.0.19
2526 2526
 	 * @param  string $value email address.
2527 2527
 	 */
2528
-	public function set_user_email( $value ) {
2529
-		$this->set_email( $value );
2528
+	public function set_user_email($value) {
2529
+		$this->set_email($value);
2530 2530
     }
2531 2531
 
2532 2532
     /**
@@ -2535,8 +2535,8 @@  discard block
 block discarded – undo
2535 2535
 	 * @since 1.0.19
2536 2536
 	 * @param  string $value email address.
2537 2537
 	 */
2538
-	public function set_email_address( $value ) {
2539
-		$this->set_email( $value );
2538
+	public function set_email_address($value) {
2539
+		$this->set_email($value);
2540 2540
     }
2541 2541
 
2542 2542
     /**
@@ -2545,8 +2545,8 @@  discard block
 block discarded – undo
2545 2545
 	 * @since 1.0.19
2546 2546
 	 * @param  string $value email address.
2547 2547
 	 */
2548
-	public function set_customer_email( $value ) {
2549
-		$this->set_email( $value );
2548
+	public function set_customer_email($value) {
2549
+		$this->set_email($value);
2550 2550
     }
2551 2551
 
2552 2552
     /**
@@ -2555,8 +2555,8 @@  discard block
 block discarded – undo
2555 2555
 	 * @since 1.0.19
2556 2556
 	 * @param  string $value country.
2557 2557
 	 */
2558
-	public function set_country( $value ) {
2559
-		$this->set_prop( 'country', $value );
2558
+	public function set_country($value) {
2559
+		$this->set_prop('country', $value);
2560 2560
     }
2561 2561
 
2562 2562
     /**
@@ -2565,8 +2565,8 @@  discard block
 block discarded – undo
2565 2565
 	 * @since 1.0.19
2566 2566
 	 * @param  string $value country.
2567 2567
 	 */
2568
-	public function set_user_country( $value ) {
2569
-		$this->set_country( $value );
2568
+	public function set_user_country($value) {
2569
+		$this->set_country($value);
2570 2570
     }
2571 2571
 
2572 2572
     /**
@@ -2575,8 +2575,8 @@  discard block
 block discarded – undo
2575 2575
 	 * @since 1.0.19
2576 2576
 	 * @param  string $value country.
2577 2577
 	 */
2578
-	public function set_customer_country( $value ) {
2579
-		$this->set_country( $value );
2578
+	public function set_customer_country($value) {
2579
+		$this->set_country($value);
2580 2580
     }
2581 2581
 
2582 2582
     /**
@@ -2585,8 +2585,8 @@  discard block
 block discarded – undo
2585 2585
 	 * @since 1.0.19
2586 2586
 	 * @param  string $value state.
2587 2587
 	 */
2588
-	public function set_state( $value ) {
2589
-		$this->set_prop( 'state', $value );
2588
+	public function set_state($value) {
2589
+		$this->set_prop('state', $value);
2590 2590
     }
2591 2591
 
2592 2592
     /**
@@ -2595,8 +2595,8 @@  discard block
 block discarded – undo
2595 2595
 	 * @since 1.0.19
2596 2596
 	 * @param  string $value state.
2597 2597
 	 */
2598
-	public function set_user_state( $value ) {
2599
-		$this->set_state( $value );
2598
+	public function set_user_state($value) {
2599
+		$this->set_state($value);
2600 2600
     }
2601 2601
 
2602 2602
     /**
@@ -2605,8 +2605,8 @@  discard block
 block discarded – undo
2605 2605
 	 * @since 1.0.19
2606 2606
 	 * @param  string $value state.
2607 2607
 	 */
2608
-	public function set_customer_state( $value ) {
2609
-		$this->set_state( $value );
2608
+	public function set_customer_state($value) {
2609
+		$this->set_state($value);
2610 2610
     }
2611 2611
 
2612 2612
     /**
@@ -2615,8 +2615,8 @@  discard block
 block discarded – undo
2615 2615
 	 * @since 1.0.19
2616 2616
 	 * @param  string $value city.
2617 2617
 	 */
2618
-	public function set_city( $value ) {
2619
-		$this->set_prop( 'city', $value );
2618
+	public function set_city($value) {
2619
+		$this->set_prop('city', $value);
2620 2620
     }
2621 2621
 
2622 2622
     /**
@@ -2625,8 +2625,8 @@  discard block
 block discarded – undo
2625 2625
 	 * @since 1.0.19
2626 2626
 	 * @param  string $value city.
2627 2627
 	 */
2628
-	public function set_user_city( $value ) {
2629
-		$this->set_city( $value );
2628
+	public function set_user_city($value) {
2629
+		$this->set_city($value);
2630 2630
     }
2631 2631
 
2632 2632
     /**
@@ -2635,8 +2635,8 @@  discard block
 block discarded – undo
2635 2635
 	 * @since 1.0.19
2636 2636
 	 * @param  string $value city.
2637 2637
 	 */
2638
-	public function set_customer_city( $value ) {
2639
-		$this->set_city( $value );
2638
+	public function set_customer_city($value) {
2639
+		$this->set_city($value);
2640 2640
     }
2641 2641
 
2642 2642
     /**
@@ -2645,8 +2645,8 @@  discard block
 block discarded – undo
2645 2645
 	 * @since 1.0.19
2646 2646
 	 * @param  string $value zip.
2647 2647
 	 */
2648
-	public function set_zip( $value ) {
2649
-		$this->set_prop( 'zip', $value );
2648
+	public function set_zip($value) {
2649
+		$this->set_prop('zip', $value);
2650 2650
     }
2651 2651
 
2652 2652
     /**
@@ -2655,8 +2655,8 @@  discard block
 block discarded – undo
2655 2655
 	 * @since 1.0.19
2656 2656
 	 * @param  string $value zip.
2657 2657
 	 */
2658
-	public function set_user_zip( $value ) {
2659
-		$this->set_zip( $value );
2658
+	public function set_user_zip($value) {
2659
+		$this->set_zip($value);
2660 2660
     }
2661 2661
 
2662 2662
     /**
@@ -2665,8 +2665,8 @@  discard block
 block discarded – undo
2665 2665
 	 * @since 1.0.19
2666 2666
 	 * @param  string $value zip.
2667 2667
 	 */
2668
-	public function set_customer_zip( $value ) {
2669
-		$this->set_zip( $value );
2668
+	public function set_customer_zip($value) {
2669
+		$this->set_zip($value);
2670 2670
     }
2671 2671
 
2672 2672
     /**
@@ -2675,8 +2675,8 @@  discard block
 block discarded – undo
2675 2675
 	 * @since 1.0.19
2676 2676
 	 * @param  string $value company.
2677 2677
 	 */
2678
-	public function set_company( $value ) {
2679
-		$this->set_prop( 'company', $value );
2678
+	public function set_company($value) {
2679
+		$this->set_prop('company', $value);
2680 2680
     }
2681 2681
 
2682 2682
     /**
@@ -2685,8 +2685,8 @@  discard block
 block discarded – undo
2685 2685
 	 * @since 1.0.19
2686 2686
 	 * @param  string $value company.
2687 2687
 	 */
2688
-	public function set_user_company( $value ) {
2689
-		$this->set_company( $value );
2688
+	public function set_user_company($value) {
2689
+		$this->set_company($value);
2690 2690
     }
2691 2691
 
2692 2692
     /**
@@ -2695,8 +2695,8 @@  discard block
 block discarded – undo
2695 2695
 	 * @since 1.0.19
2696 2696
 	 * @param  string $value company.
2697 2697
 	 */
2698
-	public function set_customer_company( $value ) {
2699
-		$this->set_company( $value );
2698
+	public function set_customer_company($value) {
2699
+		$this->set_company($value);
2700 2700
     }
2701 2701
 
2702 2702
 	/**
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @since 1.0.19
2706 2706
 	 * @param  string $value company id.
2707 2707
 	 */
2708
-	public function set_company_id( $value ) {
2709
-		$this->set_prop( 'company_id', $value );
2708
+	public function set_company_id($value) {
2709
+		$this->set_prop('company_id', $value);
2710 2710
     }
2711 2711
 
2712 2712
     /**
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 	 * @since 1.0.19
2716 2716
 	 * @param  string $value var number.
2717 2717
 	 */
2718
-	public function set_vat_number( $value ) {
2719
-		$this->set_prop( 'vat_number', $value );
2718
+	public function set_vat_number($value) {
2719
+		$this->set_prop('vat_number', $value);
2720 2720
     }
2721 2721
 
2722 2722
     /**
@@ -2725,8 +2725,8 @@  discard block
 block discarded – undo
2725 2725
 	 * @since 1.0.19
2726 2726
 	 * @param  string $value var number.
2727 2727
 	 */
2728
-	public function set_user_vat_number( $value ) {
2729
-		$this->set_vat_number( $value );
2728
+	public function set_user_vat_number($value) {
2729
+		$this->set_vat_number($value);
2730 2730
     }
2731 2731
 
2732 2732
     /**
@@ -2735,8 +2735,8 @@  discard block
 block discarded – undo
2735 2735
 	 * @since 1.0.19
2736 2736
 	 * @param  string $value var number.
2737 2737
 	 */
2738
-	public function set_customer_vat_number( $value ) {
2739
-		$this->set_vat_number( $value );
2738
+	public function set_customer_vat_number($value) {
2739
+		$this->set_vat_number($value);
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2745,8 +2745,8 @@  discard block
 block discarded – undo
2745 2745
 	 * @since 1.0.19
2746 2746
 	 * @param  string $value var rate.
2747 2747
 	 */
2748
-	public function set_vat_rate( $value ) {
2749
-		$this->set_prop( 'vat_rate', $value );
2748
+	public function set_vat_rate($value) {
2749
+		$this->set_prop('vat_rate', $value);
2750 2750
     }
2751 2751
 
2752 2752
     /**
@@ -2755,8 +2755,8 @@  discard block
 block discarded – undo
2755 2755
 	 * @since 1.0.19
2756 2756
 	 * @param  string $value var number.
2757 2757
 	 */
2758
-	public function set_user_vat_rate( $value ) {
2759
-		$this->set_vat_rate( $value );
2758
+	public function set_user_vat_rate($value) {
2759
+		$this->set_vat_rate($value);
2760 2760
     }
2761 2761
 
2762 2762
     /**
@@ -2765,8 +2765,8 @@  discard block
 block discarded – undo
2765 2765
 	 * @since 1.0.19
2766 2766
 	 * @param  string $value var number.
2767 2767
 	 */
2768
-	public function set_customer_vat_rate( $value ) {
2769
-		$this->set_vat_rate( $value );
2768
+	public function set_customer_vat_rate($value) {
2769
+		$this->set_vat_rate($value);
2770 2770
     }
2771 2771
 
2772 2772
     /**
@@ -2775,8 +2775,8 @@  discard block
 block discarded – undo
2775 2775
 	 * @since 1.0.19
2776 2776
 	 * @param  string $value address.
2777 2777
 	 */
2778
-	public function set_address( $value ) {
2779
-		$this->set_prop( 'address', $value );
2778
+	public function set_address($value) {
2779
+		$this->set_prop('address', $value);
2780 2780
     }
2781 2781
 
2782 2782
     /**
@@ -2785,8 +2785,8 @@  discard block
 block discarded – undo
2785 2785
 	 * @since 1.0.19
2786 2786
 	 * @param  string $value address.
2787 2787
 	 */
2788
-	public function set_user_address( $value ) {
2789
-		$this->set_address( $value );
2788
+	public function set_user_address($value) {
2789
+		$this->set_address($value);
2790 2790
     }
2791 2791
 
2792 2792
     /**
@@ -2795,8 +2795,8 @@  discard block
 block discarded – undo
2795 2795
 	 * @since 1.0.19
2796 2796
 	 * @param  string $value address.
2797 2797
 	 */
2798
-	public function set_customer_address( $value ) {
2799
-		$this->set_address( $value );
2798
+	public function set_customer_address($value) {
2799
+		$this->set_address($value);
2800 2800
     }
2801 2801
 
2802 2802
     /**
@@ -2805,8 +2805,8 @@  discard block
 block discarded – undo
2805 2805
 	 * @since 1.0.19
2806 2806
 	 * @param  int|bool $value confirmed.
2807 2807
 	 */
2808
-	public function set_is_viewed( $value ) {
2809
-		$this->set_prop( 'is_viewed', $value );
2808
+	public function set_is_viewed($value) {
2809
+		$this->set_prop('is_viewed', $value);
2810 2810
 	}
2811 2811
 
2812 2812
 	/**
@@ -2815,8 +2815,8 @@  discard block
 block discarded – undo
2815 2815
 	 * @since 1.0.19
2816 2816
 	 * @param  string $value email recipients.
2817 2817
 	 */
2818
-	public function set_email_cc( $value ) {
2819
-		$this->set_prop( 'email_cc', $value );
2818
+	public function set_email_cc($value) {
2819
+		$this->set_prop('email_cc', $value);
2820 2820
 	}
2821 2821
 
2822 2822
 	/**
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	 * @since 1.0.19
2826 2826
 	 * @param  string $value template.
2827 2827
 	 */
2828
-	public function set_template( $value ) {
2829
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2830
-			$this->set_prop( 'template', $value );
2828
+	public function set_template($value) {
2829
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2830
+			$this->set_prop('template', $value);
2831 2831
 		}
2832 2832
 	}
2833 2833
 
@@ -2838,8 +2838,8 @@  discard block
 block discarded – undo
2838 2838
 	 * @param  string $value source.
2839 2839
 	 * @deprecated
2840 2840
 	 */
2841
-	public function created_via( $value ) {
2842
-		$this->set_created_via( sanitize_text_field( $value ) );
2841
+	public function created_via($value) {
2842
+		$this->set_created_via(sanitize_text_field($value));
2843 2843
 	}
2844 2844
 
2845 2845
 	/**
@@ -2848,8 +2848,8 @@  discard block
 block discarded – undo
2848 2848
 	 * @since 1.0.19
2849 2849
 	 * @param  string $value source.
2850 2850
 	 */
2851
-	public function set_created_via( $value ) {
2852
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2851
+	public function set_created_via($value) {
2852
+		$this->set_prop('created_via', sanitize_text_field($value));
2853 2853
 	}
2854 2854
 
2855 2855
 	/**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
 	 * @since 1.0.19
2859 2859
 	 * @param  int|bool $value confirmed.
2860 2860
 	 */
2861
-	public function set_address_confirmed( $value ) {
2862
-		$this->set_prop( 'address_confirmed', $value );
2861
+	public function set_address_confirmed($value) {
2862
+		$this->set_prop('address_confirmed', $value);
2863 2863
     }
2864 2864
 
2865 2865
     /**
@@ -2868,8 +2868,8 @@  discard block
 block discarded – undo
2868 2868
 	 * @since 1.0.19
2869 2869
 	 * @param  int|bool $value confirmed.
2870 2870
 	 */
2871
-	public function set_user_address_confirmed( $value ) {
2872
-		$this->set_address_confirmed( $value );
2871
+	public function set_user_address_confirmed($value) {
2872
+		$this->set_address_confirmed($value);
2873 2873
     }
2874 2874
 
2875 2875
     /**
@@ -2878,8 +2878,8 @@  discard block
 block discarded – undo
2878 2878
 	 * @since 1.0.19
2879 2879
 	 * @param  int|bool $value confirmed.
2880 2880
 	 */
2881
-	public function set_customer_address_confirmed( $value ) {
2882
-		$this->set_address_confirmed( $value );
2881
+	public function set_customer_address_confirmed($value) {
2882
+		$this->set_address_confirmed($value);
2883 2883
     }
2884 2884
 
2885 2885
     /**
@@ -2888,13 +2888,13 @@  discard block
 block discarded – undo
2888 2888
 	 * @since 1.0.19
2889 2889
 	 * @param  float $value shipping amount.
2890 2890
 	 */
2891
-	public function set_shipping( $value ) {
2891
+	public function set_shipping($value) {
2892 2892
 
2893
-		if ( ! is_numeric( $value ) ) {
2894
-			return $this->set_prop( 'shipping', null );
2893
+		if (!is_numeric($value)) {
2894
+			return $this->set_prop('shipping', null);
2895 2895
 		}
2896 2896
 
2897
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2897
+		$this->set_prop('shipping', max(0, floatval($value)));
2898 2898
 	}
2899 2899
 
2900 2900
 	/**
@@ -2903,8 +2903,8 @@  discard block
 block discarded – undo
2903 2903
 	 * @since 1.0.19
2904 2904
 	 * @param  float $value sub total.
2905 2905
 	 */
2906
-	public function set_subtotal( $value ) {
2907
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2906
+	public function set_subtotal($value) {
2907
+		$this->set_prop('subtotal', max(0, $value));
2908 2908
 	}
2909 2909
 
2910 2910
 	/**
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 	 * @since 1.0.19
2914 2914
 	 * @param  float $value sub total.
2915 2915
 	 */
2916
-	public function set_total( $value ) {
2917
-		$this->set_prop( 'total', max( 0, $value ) );
2916
+	public function set_total($value) {
2917
+		$this->set_prop('total', max(0, $value));
2918 2918
     }
2919 2919
 
2920 2920
     /**
@@ -2923,8 +2923,8 @@  discard block
 block discarded – undo
2923 2923
 	 * @since 1.0.19
2924 2924
 	 * @param  float $value discount total.
2925 2925
 	 */
2926
-	public function set_total_discount( $value ) {
2927
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2926
+	public function set_total_discount($value) {
2927
+		$this->set_prop('total_discount', max(0, $value));
2928 2928
     }
2929 2929
 
2930 2930
     /**
@@ -2933,8 +2933,8 @@  discard block
 block discarded – undo
2933 2933
 	 * @since 1.0.19
2934 2934
 	 * @param  float $value discount total.
2935 2935
 	 */
2936
-	public function set_discount( $value ) {
2937
-		$this->set_total_discount( $value );
2936
+	public function set_discount($value) {
2937
+		$this->set_total_discount($value);
2938 2938
     }
2939 2939
 
2940 2940
     /**
@@ -2943,8 +2943,8 @@  discard block
 block discarded – undo
2943 2943
 	 * @since 1.0.19
2944 2944
 	 * @param  float $value tax total.
2945 2945
 	 */
2946
-	public function set_total_tax( $value ) {
2947
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2946
+	public function set_total_tax($value) {
2947
+		$this->set_prop('total_tax', max(0, $value));
2948 2948
     }
2949 2949
 
2950 2950
     /**
@@ -2953,8 +2953,8 @@  discard block
 block discarded – undo
2953 2953
 	 * @since 1.0.19
2954 2954
 	 * @param  float $value tax total.
2955 2955
 	 */
2956
-	public function set_tax_total( $value ) {
2957
-		$this->set_total_tax( $value );
2956
+	public function set_tax_total($value) {
2957
+		$this->set_total_tax($value);
2958 2958
     }
2959 2959
 
2960 2960
     /**
@@ -2963,8 +2963,8 @@  discard block
 block discarded – undo
2963 2963
 	 * @since 1.0.19
2964 2964
 	 * @param  float $value fees total.
2965 2965
 	 */
2966
-	public function set_total_fees( $value ) {
2967
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2966
+	public function set_total_fees($value) {
2967
+		$this->set_prop('total_fees', max(0, $value));
2968 2968
     }
2969 2969
 
2970 2970
     /**
@@ -2973,8 +2973,8 @@  discard block
 block discarded – undo
2973 2973
 	 * @since 1.0.19
2974 2974
 	 * @param  float $value fees total.
2975 2975
 	 */
2976
-	public function set_fees_total( $value ) {
2977
-		$this->set_total_fees( $value );
2976
+	public function set_fees_total($value) {
2977
+		$this->set_total_fees($value);
2978 2978
     }
2979 2979
 
2980 2980
     /**
@@ -2983,13 +2983,13 @@  discard block
 block discarded – undo
2983 2983
 	 * @since 1.0.19
2984 2984
 	 * @param  array $value fees.
2985 2985
 	 */
2986
-	public function set_fees( $value ) {
2986
+	public function set_fees($value) {
2987 2987
 
2988
-		if ( ! is_array( $value ) ) {
2988
+		if (!is_array($value)) {
2989 2989
 			$value = array();
2990 2990
 		}
2991 2991
 
2992
-		$this->set_prop( 'fees', $value );
2992
+		$this->set_prop('fees', $value);
2993 2993
 
2994 2994
     }
2995 2995
 
@@ -2999,13 +2999,13 @@  discard block
 block discarded – undo
2999 2999
 	 * @since 1.0.19
3000 3000
 	 * @param  array $value taxes.
3001 3001
 	 */
3002
-	public function set_taxes( $value ) {
3002
+	public function set_taxes($value) {
3003 3003
 
3004
-		if ( ! is_array( $value ) ) {
3004
+		if (!is_array($value)) {
3005 3005
 			$value = array();
3006 3006
 		}
3007 3007
 
3008
-		$this->set_prop( 'taxes', $value );
3008
+		$this->set_prop('taxes', $value);
3009 3009
 
3010 3010
     }
3011 3011
 
@@ -3015,13 +3015,13 @@  discard block
 block discarded – undo
3015 3015
 	 * @since 1.0.19
3016 3016
 	 * @param  array $value discounts.
3017 3017
 	 */
3018
-	public function set_discounts( $value ) {
3018
+	public function set_discounts($value) {
3019 3019
 
3020
-		if ( ! is_array( $value ) ) {
3020
+		if (!is_array($value)) {
3021 3021
 			$value = array();
3022 3022
 		}
3023 3023
 
3024
-		$this->set_prop( 'discounts', $value );
3024
+		$this->set_prop('discounts', $value);
3025 3025
     }
3026 3026
 
3027 3027
     /**
@@ -3030,19 +3030,19 @@  discard block
 block discarded – undo
3030 3030
 	 * @since 1.0.19
3031 3031
 	 * @param  GetPaid_Form_Item[] $value items.
3032 3032
 	 */
3033
-	public function set_items( $value ) {
3033
+	public function set_items($value) {
3034 3034
 
3035 3035
         // Remove existing items.
3036
-        $this->set_prop( 'items', array() );
3036
+        $this->set_prop('items', array());
3037 3037
 		$this->recurring_item = null;
3038 3038
 
3039 3039
         // Ensure that we have an array.
3040
-        if ( ! is_array( $value ) ) {
3040
+        if (!is_array($value)) {
3041 3041
             return;
3042 3042
         }
3043 3043
 
3044
-        foreach ( $value as $item ) {
3045
-            $this->add_item( $item );
3044
+        foreach ($value as $item) {
3045
+            $this->add_item($item);
3046 3046
         }
3047 3047
 
3048 3048
     }
@@ -3053,8 +3053,8 @@  discard block
 block discarded – undo
3053 3053
 	 * @since 1.0.19
3054 3054
 	 * @param  int $value payment form.
3055 3055
 	 */
3056
-	public function set_payment_form( $value ) {
3057
-		$this->set_prop( 'payment_form', $value );
3056
+	public function set_payment_form($value) {
3057
+		$this->set_prop('payment_form', $value);
3058 3058
     }
3059 3059
 
3060 3060
     /**
@@ -3063,8 +3063,8 @@  discard block
 block discarded – undo
3063 3063
 	 * @since 1.0.19
3064 3064
 	 * @param  string $value submission id.
3065 3065
 	 */
3066
-	public function set_submission_id( $value ) {
3067
-		$this->set_prop( 'submission_id', $value );
3066
+	public function set_submission_id($value) {
3067
+		$this->set_prop('submission_id', $value);
3068 3068
     }
3069 3069
 
3070 3070
     /**
@@ -3073,8 +3073,8 @@  discard block
 block discarded – undo
3073 3073
 	 * @since 1.0.19
3074 3074
 	 * @param  string $value discount code.
3075 3075
 	 */
3076
-	public function set_discount_code( $value ) {
3077
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3076
+	public function set_discount_code($value) {
3077
+		$this->set_prop('discount_code', sanitize_text_field($value));
3078 3078
     }
3079 3079
 
3080 3080
     /**
@@ -3083,8 +3083,8 @@  discard block
 block discarded – undo
3083 3083
 	 * @since 1.0.19
3084 3084
 	 * @param  string $value gateway.
3085 3085
 	 */
3086
-	public function set_gateway( $value ) {
3087
-		$this->set_prop( 'gateway', $value );
3086
+	public function set_gateway($value) {
3087
+		$this->set_prop('gateway', $value);
3088 3088
     }
3089 3089
 
3090 3090
     /**
@@ -3093,9 +3093,9 @@  discard block
 block discarded – undo
3093 3093
 	 * @since 1.0.19
3094 3094
 	 * @param  string $value transaction id.
3095 3095
 	 */
3096
-	public function set_transaction_id( $value ) {
3097
-		if ( ! empty( $value ) ) {
3098
-			$this->set_prop( 'transaction_id', $value );
3096
+	public function set_transaction_id($value) {
3097
+		if (!empty($value)) {
3098
+			$this->set_prop('transaction_id', $value);
3099 3099
 		}
3100 3100
     }
3101 3101
 
@@ -3105,8 +3105,8 @@  discard block
 block discarded – undo
3105 3105
 	 * @since 1.0.19
3106 3106
 	 * @param  string $value currency id.
3107 3107
 	 */
3108
-	public function set_currency( $value ) {
3109
-		$this->set_prop( 'currency', $value );
3108
+	public function set_currency($value) {
3109
+		$this->set_prop('currency', $value);
3110 3110
     }
3111 3111
 
3112 3112
 	/**
@@ -3115,8 +3115,8 @@  discard block
 block discarded – undo
3115 3115
 	 * @since 1.0.19
3116 3116
 	 * @param  bool $value value.
3117 3117
 	 */
3118
-	public function set_disable_taxes( $value ) {
3119
-		$this->set_prop( 'disable_taxes', (bool) $value );
3118
+	public function set_disable_taxes($value) {
3119
+		$this->set_prop('disable_taxes', (bool) $value);
3120 3120
 	}
3121 3121
 
3122 3122
     /**
@@ -3125,8 +3125,8 @@  discard block
 block discarded – undo
3125 3125
 	 * @since 1.0.19
3126 3126
 	 * @param  string $value subscription id.
3127 3127
 	 */
3128
-	public function set_subscription_id( $value ) {
3129
-		$this->set_prop( 'subscription_id', $value );
3128
+	public function set_subscription_id($value) {
3129
+		$this->set_prop('subscription_id', $value);
3130 3130
 	}
3131 3131
 
3132 3132
 	/**
@@ -3135,8 +3135,8 @@  discard block
 block discarded – undo
3135 3135
 	 * @since 1.0.19
3136 3136
 	 * @param  string $value subscription id.
3137 3137
 	 */
3138
-	public function set_remote_subscription_id( $value ) {
3139
-		$this->set_prop( 'remote_subscription_id', $value );
3138
+	public function set_remote_subscription_id($value) {
3139
+		$this->set_prop('remote_subscription_id', $value);
3140 3140
     }
3141 3141
 
3142 3142
 	/**
@@ -3145,8 +3145,8 @@  discard block
 block discarded – undo
3145 3145
 	 * @since 2.8.22
3146 3146
 	 * @param  bool $is_anonymized is anonymized.
3147 3147
 	 */
3148
-	public function set_is_anonymized( $is_anonymized ) {
3149
-		$this->set_prop( 'is_anonymized', (bool) $is_anonymized );
3148
+	public function set_is_anonymized($is_anonymized) {
3149
+		$this->set_prop('is_anonymized', (bool) $is_anonymized);
3150 3150
     }
3151 3151
 
3152 3152
     /*
@@ -3163,28 +3163,28 @@  discard block
 block discarded – undo
3163 3163
      */
3164 3164
     public function is_parent() {
3165 3165
         $parent = $this->get_parent_id();
3166
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
3166
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
3167 3167
     }
3168 3168
 
3169 3169
     /**
3170 3170
      * Checks if this is a renewal invoice.
3171 3171
      */
3172 3172
     public function is_renewal() {
3173
-        return $this->is_recurring() && ! $this->is_parent();
3173
+        return $this->is_recurring() && !$this->is_parent();
3174 3174
     }
3175 3175
 
3176 3176
     /**
3177 3177
      * Checks if this is a recurring invoice.
3178 3178
      */
3179 3179
     public function is_recurring() {
3180
-        return ! empty( $this->recurring_item );
3180
+        return !empty($this->recurring_item);
3181 3181
     }
3182 3182
 
3183 3183
     /**
3184 3184
      * Checks if this is a taxable invoice.
3185 3185
      */
3186 3186
     public function is_taxable() {
3187
-        return ! $this->get_disable_taxes();
3187
+        return !$this->get_disable_taxes();
3188 3188
 	}
3189 3189
 
3190 3190
 	/**
@@ -3198,45 +3198,45 @@  discard block
 block discarded – undo
3198 3198
 	 * Checks to see if the invoice requires payment.
3199 3199
 	 */
3200 3200
 	public function is_free() {
3201
-        $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3201
+        $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0);
3202 3202
 
3203
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3203
+		if ($this->is_recurring() && $this->get_recurring_total() > 0) {
3204 3204
 			$is_free = false;
3205 3205
 		}
3206 3206
 
3207
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3207
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
3208 3208
     }
3209 3209
 
3210 3210
     /**
3211 3211
      * Checks if the invoice is paid.
3212 3212
      */
3213 3213
     public function is_paid() {
3214
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3215
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3214
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
3215
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
3216 3216
 	}
3217 3217
 
3218 3218
 	/**
3219 3219
      * Checks if the invoice needs payment.
3220 3220
      */
3221 3221
 	public function needs_payment() {
3222
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3223
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3222
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
3223
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
3224 3224
     }
3225 3225
 
3226 3226
 	/**
3227 3227
      * Checks if the invoice is refunded.
3228 3228
      */
3229 3229
 	public function is_refunded() {
3230
-        $is_refunded = $this->has_status( 'wpi-refunded' );
3231
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3230
+        $is_refunded = $this->has_status('wpi-refunded');
3231
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
3232 3232
 	}
3233 3233
 
3234 3234
 	/**
3235 3235
      * Checks if the invoice is held.
3236 3236
      */
3237 3237
 	public function is_held() {
3238
-        $is_held = $this->has_status( 'wpi-onhold' );
3239
-        return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3238
+        $is_held = $this->has_status('wpi-onhold');
3239
+        return apply_filters('wpinv_invoice_is_held', $is_held, $this);
3240 3240
 	}
3241 3241
 
3242 3242
 	/**
@@ -3244,30 +3244,30 @@  discard block
 block discarded – undo
3244 3244
      */
3245 3245
 	public function is_due() {
3246 3246
 		$due_date = $this->get_due_date();
3247
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3247
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
3248 3248
 	}
3249 3249
 
3250 3250
 	/**
3251 3251
      * Checks if the invoice is draft.
3252 3252
      */
3253 3253
 	public function is_draft() {
3254
-        return $this->has_status( 'draft, auto-draft' );
3254
+        return $this->has_status('draft, auto-draft');
3255 3255
 	}
3256 3256
 
3257 3257
     /**
3258 3258
      * Checks if the invoice has a given status.
3259 3259
      */
3260
-    public function has_status( $status ) {
3261
-        $status = wpinv_parse_list( $status );
3262
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3260
+    public function has_status($status) {
3261
+        $status = wpinv_parse_list($status);
3262
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
3263 3263
 	}
3264 3264
 
3265 3265
 	/**
3266 3266
      * Checks if the invoice is of a given type.
3267 3267
      */
3268
-    public function is_type( $type ) {
3269
-        $type = wpinv_parse_list( $type );
3270
-        return in_array( $this->get_type(), $type );
3268
+    public function is_type($type) {
3269
+        $type = wpinv_parse_list($type);
3270
+        return in_array($this->get_type(), $type);
3271 3271
     }
3272 3272
 
3273 3273
     /**
@@ -3299,8 +3299,8 @@  discard block
 block discarded – undo
3299 3299
      *
3300 3300
      */
3301 3301
 	public function is_initial_free() {
3302
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3303
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3302
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
3303
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
3304 3304
     }
3305 3305
 
3306 3306
 	/**
@@ -3310,11 +3310,11 @@  discard block
 block discarded – undo
3310 3310
     public function item_has_free_trial() {
3311 3311
 
3312 3312
         // Ensure we have a recurring item.
3313
-        if ( ! $this->is_recurring() ) {
3313
+        if (!$this->is_recurring()) {
3314 3314
             return false;
3315 3315
         }
3316 3316
 
3317
-        $item = $this->get_recurring( true );
3317
+        $item = $this->get_recurring(true);
3318 3318
         return $item->has_free_trial();
3319 3319
 	}
3320 3320
 
@@ -3322,7 +3322,7 @@  discard block
 block discarded – undo
3322 3322
      * Check if the free trial is a result of a discount.
3323 3323
      */
3324 3324
     public function is_free_trial_from_discount() {
3325
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3325
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3326 3326
 	}
3327 3327
 
3328 3328
 	/**
@@ -3339,12 +3339,12 @@  discard block
 block discarded – undo
3339 3339
      */
3340 3340
     public function discount_first_payment_only() {
3341 3341
 
3342
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3343
-        if ( ! $discount->exists() || ! $this->is_recurring() ) {
3342
+		$discount = wpinv_get_discount_obj($this->get_discount_code());
3343
+        if (!$discount->exists() || !$this->is_recurring()) {
3344 3344
             return true;
3345 3345
         }
3346 3346
 
3347
-        return ! $discount->get_is_recurring();
3347
+        return !$discount->get_is_recurring();
3348 3348
     }
3349 3349
 
3350 3350
     /*
@@ -3362,23 +3362,23 @@  discard block
 block discarded – undo
3362 3362
      * @param GetPaid_Form_Item|array $item
3363 3363
      * @return WP_Error|Bool
3364 3364
      */
3365
-    public function add_item( $item ) {
3365
+    public function add_item($item) {
3366 3366
 
3367
-		if ( is_array( $item ) ) {
3368
-			$item = $this->process_array_item( $item );
3367
+		if (is_array($item)) {
3368
+			$item = $this->process_array_item($item);
3369 3369
 		}
3370 3370
 
3371
-		if ( is_numeric( $item ) ) {
3372
-			$item = new GetPaid_Form_Item( $item );
3371
+		if (is_numeric($item)) {
3372
+			$item = new GetPaid_Form_Item($item);
3373 3373
 		}
3374 3374
 
3375 3375
         // Make sure that it is available for purchase.
3376
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3377
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3376
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3377
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3378 3378
         }
3379 3379
 
3380 3380
         // Do we have a recurring item?
3381
-		if ( $item->is_recurring() ) {
3381
+		if ($item->is_recurring()) {
3382 3382
 			$this->recurring_item = $item->get_id();
3383 3383
         }
3384 3384
 
@@ -3386,9 +3386,9 @@  discard block
 block discarded – undo
3386 3386
         $item->invoice_id = (int) $this->get_id();
3387 3387
 
3388 3388
 		// Remove duplicates.
3389
-		$this->remove_item( $item->get_id() );
3389
+		$this->remove_item($item->get_id());
3390 3390
 
3391
-		if ( 0 == $item->get_quantity() ) {
3391
+		if (0 == $item->get_quantity()) {
3392 3392
 			return;
3393 3393
 		}
3394 3394
 
@@ -3398,7 +3398,7 @@  discard block
 block discarded – undo
3398 3398
 		// Add new item.
3399 3399
         $items[] = $item;
3400 3400
 
3401
-        $this->set_prop( 'items', $items );
3401
+        $this->set_prop('items', $items);
3402 3402
 
3403 3403
 		return true;
3404 3404
 	}
@@ -3409,26 +3409,26 @@  discard block
 block discarded – undo
3409 3409
 	 * @since 1.0.19
3410 3410
 	 * @return GetPaid_Form_Item
3411 3411
 	 */
3412
-	protected function process_array_item( $array ) {
3412
+	protected function process_array_item($array) {
3413 3413
 
3414
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3415
-		$item    = new GetPaid_Form_Item( $item_id );
3414
+		$item_id = isset($array['item_id']) ? $array['item_id'] : 0;
3415
+		$item    = new GetPaid_Form_Item($item_id);
3416 3416
 
3417 3417
 		// Set item data.
3418
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3419
-			if ( isset( $array[ "item_$key" ] ) ) {
3418
+		foreach (array('name', 'price', 'description') as $key) {
3419
+			if (isset($array["item_$key"])) {
3420 3420
 				$method = "set_$key";
3421
-				$item->$method( $array[ "item_$key" ] );
3421
+				$item->$method($array["item_$key"]);
3422 3422
 			}
3423 3423
 		}
3424 3424
 
3425
-		if ( isset( $array['quantity'] ) ) {
3426
-			$item->set_quantity( $array['quantity'] );
3425
+		if (isset($array['quantity'])) {
3426
+			$item->set_quantity($array['quantity']);
3427 3427
 		}
3428 3428
 
3429 3429
 		// Set item meta.
3430
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3431
-			$item->set_item_meta( $array['meta'] );
3430
+		if (isset($array['meta']) && is_array($array['meta'])) {
3431
+			$item->set_item_meta($array['meta']);
3432 3432
 		}
3433 3433
 
3434 3434
 		return $item;
@@ -3441,10 +3441,10 @@  discard block
 block discarded – undo
3441 3441
 	 * @since 1.0.19
3442 3442
 	 * @return GetPaid_Form_Item|null
3443 3443
 	 */
3444
-	public function get_item( $item_id ) {
3444
+	public function get_item($item_id) {
3445 3445
 
3446
-		foreach ( $this->get_items() as $item ) {
3447
-			if ( (int) $item_id == $item->get_id() ) {
3446
+		foreach ($this->get_items() as $item) {
3447
+			if ((int) $item_id == $item->get_id()) {
3448 3448
 				return $item;
3449 3449
 			}
3450 3450
 		}
@@ -3457,16 +3457,16 @@  discard block
 block discarded – undo
3457 3457
 	 *
3458 3458
 	 * @since 1.0.19
3459 3459
 	 */
3460
-	public function remove_item( $item_id ) {
3460
+	public function remove_item($item_id) {
3461 3461
 		$items   = $this->get_items();
3462 3462
 		$item_id = (int) $item_id;
3463 3463
 
3464
-		foreach ( $items as $index => $item ) {
3465
-			if ( (int) $item_id == $item->get_id() ) {
3466
-				unset( $items[ $index ] );
3467
-				$this->set_prop( 'items', $items );
3464
+		foreach ($items as $index => $item) {
3465
+			if ((int) $item_id == $item->get_id()) {
3466
+				unset($items[$index]);
3467
+				$this->set_prop('items', $items);
3468 3468
 
3469
-				if ( $item_id == $this->recurring_item ) {
3469
+				if ($item_id == $this->recurring_item) {
3470 3470
 					$this->recurring_item = null;
3471 3471
 				}
3472 3472
 }
@@ -3480,11 +3480,11 @@  discard block
 block discarded – undo
3480 3480
 	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3481 3481
 	 * @since 1.0.19
3482 3482
 	 */
3483
-    public function add_fee( $fee ) {
3483
+    public function add_fee($fee) {
3484 3484
 
3485 3485
 		$fees                 = $this->get_fees();
3486
-		$fees[ $fee['name'] ] = $fee;
3487
-		$this->set_prop( 'fees', $fees );
3486
+		$fees[$fee['name']] = $fee;
3487
+		$this->set_prop('fees', $fees);
3488 3488
 
3489 3489
     }
3490 3490
 
@@ -3493,9 +3493,9 @@  discard block
 block discarded – undo
3493 3493
 	 *
3494 3494
 	 * @since 1.0.19
3495 3495
 	 */
3496
-	public function get_fee( $fee ) {
3496
+	public function get_fee($fee) {
3497 3497
         $fees = $this->get_fees();
3498
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3498
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3499 3499
     }
3500 3500
 
3501 3501
     /**
@@ -3503,11 +3503,11 @@  discard block
 block discarded – undo
3503 3503
 	 *
3504 3504
 	 * @since 1.0.19
3505 3505
 	 */
3506
-	public function remove_fee( $fee ) {
3506
+	public function remove_fee($fee) {
3507 3507
         $fees = $this->get_fees();
3508
-        if ( isset( $fees[ $fee ] ) ) {
3509
-            unset( $fees[ $fee ] );
3510
-            $this->set_prop( 'fees', $fees );
3508
+        if (isset($fees[$fee])) {
3509
+            unset($fees[$fee]);
3510
+            $this->set_prop('fees', $fees);
3511 3511
         }
3512 3512
     }
3513 3513
 
@@ -3517,11 +3517,11 @@  discard block
 block discarded – undo
3517 3517
 	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3518 3518
 	 * @since 1.0.19
3519 3519
 	 */
3520
-	public function add_discount( $discount ) {
3520
+	public function add_discount($discount) {
3521 3521
 
3522 3522
 		$discounts = $this->get_discounts();
3523
-		$discounts[ $discount['name'] ] = $discount;
3524
-		$this->set_prop( 'discounts', $discounts );
3523
+		$discounts[$discount['name']] = $discount;
3524
+		$this->set_prop('discounts', $discounts);
3525 3525
 
3526 3526
 	}
3527 3527
 
@@ -3531,15 +3531,15 @@  discard block
 block discarded – undo
3531 3531
 	 * @since 1.0.19
3532 3532
 	 * @return float
3533 3533
 	 */
3534
-	public function get_discount( $discount = false ) {
3534
+	public function get_discount($discount = false) {
3535 3535
 
3536 3536
 		// Backwards compatibility.
3537
-		if ( empty( $discount ) ) {
3537
+		if (empty($discount)) {
3538 3538
 			return $this->get_total_discount();
3539 3539
 		}
3540 3540
 
3541 3541
         $discounts = $this->get_discounts();
3542
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3542
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3543 3543
     }
3544 3544
 
3545 3545
     /**
@@ -3547,15 +3547,15 @@  discard block
 block discarded – undo
3547 3547
 	 *
3548 3548
 	 * @since 1.0.19
3549 3549
 	 */
3550
-	public function remove_discount( $discount ) {
3550
+	public function remove_discount($discount) {
3551 3551
         $discounts = $this->get_discounts();
3552
-        if ( isset( $discounts[ $discount ] ) ) {
3553
-            unset( $discounts[ $discount ] );
3554
-            $this->set_prop( 'discounts', $discounts );
3552
+        if (isset($discounts[$discount])) {
3553
+            unset($discounts[$discount]);
3554
+            $this->set_prop('discounts', $discounts);
3555 3555
         }
3556 3556
 
3557
-		if ( 'discount_code' == $discount ) {
3558
-			foreach ( $this->get_items() as $item ) {
3557
+		if ('discount_code' == $discount) {
3558
+			foreach ($this->get_items() as $item) {
3559 3559
 				$item->item_discount           = 0;
3560 3560
 				$item->recurring_item_discount = 0;
3561 3561
 			}
@@ -3568,12 +3568,12 @@  discard block
 block discarded – undo
3568 3568
      *
3569 3569
      * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required.
3570 3570
      */
3571
-    public function add_tax( $tax ) {
3572
-        if ( $this->is_taxable() ) {
3571
+    public function add_tax($tax) {
3572
+        if ($this->is_taxable()) {
3573 3573
 
3574
-            $taxes                 = $this->get_taxes();
3575
-			$taxes[ $tax['name'] ] = $tax;
3576
-			$this->set_prop( 'taxes', $tax );
3574
+            $taxes = $this->get_taxes();
3575
+			$taxes[$tax['name']] = $tax;
3576
+			$this->set_prop('taxes', $tax);
3577 3577
 
3578 3578
         }
3579 3579
     }
@@ -3583,29 +3583,29 @@  discard block
 block discarded – undo
3583 3583
 	 *
3584 3584
 	 * @since 1.0.19
3585 3585
 	 */
3586
-	public function get_tax( $tax = null ) {
3586
+	public function get_tax($tax = null) {
3587 3587
 
3588 3588
 		// Backwards compatibility.
3589
-		if ( empty( $tax ) ) {
3589
+		if (empty($tax)) {
3590 3590
 			return $this->get_total_tax();
3591 3591
 		}
3592 3592
 
3593 3593
         $taxes = $this->get_taxes();
3594
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3594
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3595 3595
     }
3596 3596
 
3597
-	public function get_tax_total_by_name( $name ) {
3598
-		if ( $name && 0 === strpos( $name, 'tax__' ) ) {
3599
-			$name = str_replace( 'tax__', '', $name );
3597
+	public function get_tax_total_by_name($name) {
3598
+		if ($name && 0 === strpos($name, 'tax__')) {
3599
+			$name = str_replace('tax__', '', $name);
3600 3600
 		}
3601 3601
 
3602
-		if ( empty( $name ) ) {
3602
+		if (empty($name)) {
3603 3603
 			return 0;
3604 3604
 		}
3605 3605
 
3606
-		$tax = $this->get_tax( $name );
3606
+		$tax = $this->get_tax($name);
3607 3607
 
3608
-		if ( empty( $tax ) ) {
3608
+		if (empty($tax)) {
3609 3609
 			return 0;
3610 3610
 		}
3611 3611
 
@@ -3617,18 +3617,18 @@  discard block
 block discarded – undo
3617 3617
 	 *
3618 3618
 	 * @since 2.8.8
3619 3619
 	 */
3620
-	public function get_tax_item_name( $tax_key, $tax_item, $suffix = '' ) {
3621
-		$tax_name = _x( 'Tax', 'Tax name', 'invoicing' );
3620
+	public function get_tax_item_name($tax_key, $tax_item, $suffix = '') {
3621
+		$tax_name = _x('Tax', 'Tax name', 'invoicing');
3622 3622
 
3623
-		if ( ! empty( $tax_item ) && is_array( $tax_item ) && ! empty( $tax_item['name'] ) ) {
3624
-			$tax_name = __( $tax_item['name'], 'invoicing' );
3623
+		if (!empty($tax_item) && is_array($tax_item) && !empty($tax_item['name'])) {
3624
+			$tax_name = __($tax_item['name'], 'invoicing');
3625 3625
 		}
3626 3626
 
3627
-		if ( $suffix ) {
3627
+		if ($suffix) {
3628 3628
 			$tax_name .= $suffix;
3629 3629
 		}
3630 3630
 
3631
-		return apply_filters( 'wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix );
3631
+		return apply_filters('wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix);
3632 3632
 	}
3633 3633
 
3634 3634
 	/**
@@ -3636,44 +3636,44 @@  discard block
 block discarded – undo
3636 3636
 	 *
3637 3637
 	 * @since 2.8.8
3638 3638
 	 */
3639
-	public function get_tax_item_amount( $tax_key, $tax_item, $with_currency = false ) {
3640
-		$tax_amount = $this->get_tax_total_by_name( $tax_key );
3639
+	public function get_tax_item_amount($tax_key, $tax_item, $with_currency = false) {
3640
+		$tax_amount = $this->get_tax_total_by_name($tax_key);
3641 3641
 
3642
-		if ( $with_currency ) {
3643
-			$tax_amount = wpinv_price( $tax_amount, $this->get_currency() );
3642
+		if ($with_currency) {
3643
+			$tax_amount = wpinv_price($tax_amount, $this->get_currency());
3644 3644
 		}
3645 3645
 
3646
-		return apply_filters( 'wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency );
3646
+		return apply_filters('wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency);
3647 3647
 	}
3648 3648
 
3649
-	public function get_item_tax_name( $percentage = true, $sep = ' + ' ) {
3649
+	public function get_item_tax_name($percentage = true, $sep = ' + ') {
3650 3650
 		$taxes = $this->get_taxes();
3651 3651
 
3652
-		if ( ! empty( $taxes ) && is_array( $taxes ) && count( $taxes ) == 1 && wpinv_display_individual_tax_rates() ) {
3652
+		if (!empty($taxes) && is_array($taxes) && count($taxes) == 1 && wpinv_display_individual_tax_rates()) {
3653 3653
 			$names = array();
3654 3654
 
3655
-			foreach ( $taxes as $key => $tax ) {
3656
-				if ( ! empty( $tax ) && ! empty( $tax['name'] ) ) {
3657
-					$name = __( $tax['name'], 'invoicing' );
3655
+			foreach ($taxes as $key => $tax) {
3656
+				if (!empty($tax) && !empty($tax['name'])) {
3657
+					$name = __($tax['name'], 'invoicing');
3658 3658
 
3659 3659
 					$names[] = $name;
3660 3660
 				}
3661 3661
 			}
3662 3662
 
3663
-			if ( ! empty( $names ) ) {
3664
-				$names = array_unique( $names );
3663
+			if (!empty($names)) {
3664
+				$names = array_unique($names);
3665 3665
 
3666
-				$tax_name = implode( $sep, $names );
3666
+				$tax_name = implode($sep, $names);
3667 3667
 			}
3668 3668
 
3669
-			if ( $percentage ) {
3670
-				$tax_name = wp_sprintf( _x( '%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing' ), $tax_name );
3669
+			if ($percentage) {
3670
+				$tax_name = wp_sprintf(_x('%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing'), $tax_name);
3671 3671
 			}
3672 3672
 		} else {
3673
-			$tax_name = $percentage ? __( 'Tax (%)', 'invoicing' ) : _x( 'Tax', 'Tax name', 'invoicing' );
3673
+			$tax_name = $percentage ? __('Tax (%)', 'invoicing') : _x('Tax', 'Tax name', 'invoicing');
3674 3674
 		}
3675 3675
 
3676
-		return apply_filters( 'wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep );
3676
+		return apply_filters('wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep);
3677 3677
 	}
3678 3678
 
3679 3679
     /**
@@ -3681,11 +3681,11 @@  discard block
 block discarded – undo
3681 3681
 	 *
3682 3682
 	 * @since 1.0.19
3683 3683
 	 */
3684
-	public function remove_tax( $tax ) {
3684
+	public function remove_tax($tax) {
3685 3685
         $taxes = $this->get_taxes();
3686
-        if ( isset( $taxes[ $tax ] ) ) {
3687
-            unset( $taxes[ $tax ] );
3688
-            $this->set_prop( 'taxes', $taxes );
3686
+        if (isset($taxes[$tax])) {
3687
+            unset($taxes[$tax]);
3688
+            $this->set_prop('taxes', $taxes);
3689 3689
         }
3690 3690
     }
3691 3691
 
@@ -3696,22 +3696,22 @@  discard block
 block discarded – undo
3696 3696
 	 * @return float The recalculated subtotal
3697 3697
 	 */
3698 3698
 	public function recalculate_subtotal() {
3699
-        $items     = $this->get_items();
3699
+        $items = $this->get_items();
3700 3700
 		$subtotal  = 0;
3701 3701
 		$recurring = 0;
3702 3702
 
3703
-        foreach ( $items as $item ) {
3704
-			$subtotal  += $item->get_sub_total( 'edit' );
3705
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3703
+        foreach ($items as $item) {
3704
+			$subtotal  += $item->get_sub_total('edit');
3705
+			$recurring += $item->get_recurring_sub_total('edit');
3706 3706
         }
3707 3707
 
3708
-		if ( wpinv_prices_include_tax() ) {
3709
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3710
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3708
+		if (wpinv_prices_include_tax()) {
3709
+			$subtotal  = max(0, $subtotal - $this->totals['tax']['initial']);
3710
+			$recurring = max(0, $recurring - $this->totals['tax']['recurring']);
3711 3711
 		}
3712 3712
 
3713 3713
 		$current = $this->is_renewal() ? $recurring : $subtotal;
3714
-		$this->set_subtotal( $current );
3714
+		$this->set_subtotal($current);
3715 3715
 
3716 3716
 		$this->totals['subtotal'] = array(
3717 3717
 			'initial'   => $subtotal,
@@ -3729,12 +3729,12 @@  discard block
 block discarded – undo
3729 3729
 	 */
3730 3730
 	public function recalculate_total_discount() {
3731 3731
 		// Fix renewal invoice amount when tax + recurring discount applied.
3732
-		if ( $this->is_renewal() && $this->get_discount_code() ) {
3732
+		if ($this->is_renewal() && $this->get_discount_code()) {
3733 3733
 			// Maybe recalculate discount (Pre-GetPaid Fix).
3734
-			$discount = new WPInv_Discount( $this->get_discount_code() );
3734
+			$discount = new WPInv_Discount($this->get_discount_code());
3735 3735
 
3736
-			if ( $discount->exists() && $discount->is_recurring() ) {
3737
-				getpaid_calculate_invoice_discount( $this, $discount );
3736
+			if ($discount->exists() && $discount->is_recurring()) {
3737
+				getpaid_calculate_invoice_discount($this, $discount);
3738 3738
 			}
3739 3739
 		}
3740 3740
 
@@ -3742,14 +3742,14 @@  discard block
 block discarded – undo
3742 3742
 		$discount  = 0;
3743 3743
 		$recurring = 0;
3744 3744
 
3745
-        foreach ( $discounts as $data ) {
3746
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3747
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3745
+        foreach ($discounts as $data) {
3746
+			$discount  += wpinv_sanitize_amount($data['initial_discount']);
3747
+			$recurring += wpinv_sanitize_amount($data['recurring_discount']);
3748 3748
 		}
3749 3749
 
3750 3750
 		$current = $this->is_renewal() ? $recurring : $discount;
3751 3751
 
3752
-		$this->set_total_discount( $current );
3752
+		$this->set_total_discount($current);
3753 3753
 
3754 3754
 		$this->totals['discount'] = array(
3755 3755
 			'initial'   => $discount,
@@ -3770,13 +3770,13 @@  discard block
 block discarded – undo
3770 3770
 
3771 3771
 		// Maybe disable taxes.
3772 3772
 		$vat_number = $this->get_vat_number();
3773
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3773
+		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number);
3774 3774
 
3775
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3775
+		if (wpinv_is_base_country($this->get_country()) && 'vat_too' === wpinv_get_option('vat_same_country_rule', 'vat_too')) {
3776 3776
 			$skip_tax = false;
3777 3777
 		}
3778 3778
 
3779
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3779
+		if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) {
3780 3780
 
3781 3781
 			$this->totals['tax'] = array(
3782 3782
 				'initial'   => 0,
@@ -3785,36 +3785,36 @@  discard block
 block discarded – undo
3785 3785
 
3786 3786
 			$this->tax_rate = 0;
3787 3787
 
3788
-			$this->set_taxes( array() );
3788
+			$this->set_taxes(array());
3789 3789
 			$current = 0;
3790 3790
 		} else {
3791 3791
 
3792 3792
 			$item_taxes = array();
3793 3793
 
3794
-			foreach ( $this->get_items() as $item ) {
3795
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3796
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3797
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3798
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3799
-				foreach ( $taxes as $name => $amount ) {
3800
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3801
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3802
-
3803
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3804
-						$item_taxes[ $name ] = $tax;
3794
+			foreach ($this->get_items() as $item) {
3795
+				$rates    = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state());
3796
+				$rates    = getpaid_filter_item_tax_rates($item, $rates);
3797
+				$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
3798
+				$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
3799
+				foreach ($taxes as $name => $amount) {
3800
+					$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
3801
+					$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
3802
+
3803
+					if (!isset($item_taxes[$name])) {
3804
+						$item_taxes[$name] = $tax;
3805 3805
 						continue;
3806 3806
 					}
3807 3807
 
3808
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3809
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3808
+					$item_taxes[$name]['initial_tax']   += $tax['initial_tax'];
3809
+					$item_taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
3810 3810
 
3811 3811
 				}
3812 3812
 			}
3813 3813
 
3814
-			$this->set_taxes( $item_taxes );
3814
+			$this->set_taxes($item_taxes);
3815 3815
 
3816
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3817
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3816
+			$initial_tax   = array_sum(wp_list_pluck($item_taxes, 'initial_tax'));
3817
+			$recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax'));
3818 3818
 
3819 3819
 			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3820 3820
 
@@ -3825,7 +3825,7 @@  discard block
 block discarded – undo
3825 3825
 
3826 3826
 		}
3827 3827
 
3828
-		$this->set_total_tax( $current );
3828
+		$this->set_total_tax($current);
3829 3829
 
3830 3830
 		return $current;
3831 3831
 
@@ -3842,25 +3842,25 @@  discard block
 block discarded – undo
3842 3842
 		$fee       = 0;
3843 3843
 		$recurring = 0;
3844 3844
 
3845
-        foreach ( $fees as $data ) {
3846
-			if( isset( $data['initial_fee'] ) ){
3847
-				$fee += wpinv_sanitize_amount( $data['initial_fee'] );
3845
+        foreach ($fees as $data) {
3846
+			if (isset($data['initial_fee'])) {
3847
+				$fee += wpinv_sanitize_amount($data['initial_fee']);
3848 3848
 			}
3849 3849
 
3850
-			if( isset( $data['recurring_fee'] ) ){
3851
-				$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3850
+			if (isset($data['recurring_fee'])) {
3851
+				$recurring += wpinv_sanitize_amount($data['recurring_fee']);
3852 3852
 			}
3853 3853
 		}
3854 3854
 
3855 3855
 		$current = $this->is_renewal() ? $recurring : $fee;
3856
-		$this->set_total_fees( $current );
3856
+		$this->set_total_fees($current);
3857 3857
 
3858 3858
 		$this->totals['fee'] = array(
3859 3859
 			'initial'   => $fee,
3860 3860
 			'recurring' => $recurring,
3861 3861
 		);
3862 3862
 
3863
-        $this->set_total_fees( $fee );
3863
+        $this->set_total_fees($fee);
3864 3864
         return $current;
3865 3865
     }
3866 3866
 
@@ -3875,7 +3875,7 @@  discard block
 block discarded – undo
3875 3875
         $this->recalculate_total_discount();
3876 3876
 		$this->recalculate_total_tax();
3877 3877
 		$this->recalculate_subtotal();
3878
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3878
+		$this->set_total($this->get_total_tax('edit') + $this->get_total_fees('edit') + $this->get_subtotal('edit') - $this->get_total_discount('edit'));
3879 3879
 		return $this->get_total();
3880 3880
 	}
3881 3881
 
@@ -3884,7 +3884,7 @@  discard block
 block discarded – undo
3884 3884
 	 */
3885 3885
     public function recalculate_totals() {
3886 3886
         $this->recalculate_total();
3887
-        $this->save( true );
3887
+        $this->save(true);
3888 3888
         return $this;
3889 3889
     }
3890 3890
 
@@ -3902,8 +3902,8 @@  discard block
 block discarded – undo
3902 3902
 	 * @return int|false The new note's ID on success, false on failure.
3903 3903
      *
3904 3904
      */
3905
-    public function add_system_note( $note ) {
3906
-		return $this->add_note( $note, false, false, true );
3905
+    public function add_system_note($note) {
3906
+		return $this->add_note($note, false, false, true);
3907 3907
 	}
3908 3908
 
3909 3909
     /**
@@ -3913,10 +3913,10 @@  discard block
 block discarded – undo
3913 3913
 	 * @return int|false The new note's ID on success, false on failure.
3914 3914
      *
3915 3915
      */
3916
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3916
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3917 3917
 
3918 3918
         // Bail if no note specified or this invoice is not yet saved.
3919
-        if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) {
3919
+        if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) {
3920 3920
             return false;
3921 3921
         }
3922 3922
 
@@ -3924,23 +3924,23 @@  discard block
 block discarded – undo
3924 3924
 		$author_email = '[email protected]';
3925 3925
 
3926 3926
 		// If this is an admin comment or it has been added by the user.
3927
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3928
-			$user         = get_user_by( 'id', get_current_user_id() );
3927
+		if (is_user_logged_in() && (!$system || $added_by_user)) {
3928
+			$user = get_user_by('id', get_current_user_id());
3929 3929
             $author       = $user->display_name;
3930 3930
             $author_email = $user->user_email;
3931 3931
 		}
3932 3932
 
3933
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3933
+		return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type);
3934 3934
 
3935 3935
 	}
3936 3936
 
3937 3937
 	/**
3938 3938
      * Generates a unique key for the invoice.
3939 3939
      */
3940
-    public function generate_key( $string = '' ) {
3941
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3940
+    public function generate_key($string = '') {
3941
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3942 3942
         return strtolower(
3943
-            $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3943
+            $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3944 3944
         );
3945 3945
     }
3946 3946
 
@@ -3950,11 +3950,11 @@  discard block
 block discarded – undo
3950 3950
     public function generate_number() {
3951 3951
         $number = $this->get_id();
3952 3952
 
3953
-        if ( wpinv_sequential_number_active( $this->get_post_type() ) ) {
3954
-            $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3953
+        if (wpinv_sequential_number_active($this->get_post_type())) {
3954
+            $number = wpinv_get_next_invoice_number($this->get_post_type());
3955 3955
         }
3956 3956
 
3957
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3957
+		return wpinv_format_invoice_number($number, $this->get_post_type());
3958 3958
 
3959 3959
 	}
3960 3960
 
@@ -3967,55 +3967,55 @@  discard block
 block discarded – undo
3967 3967
 		// Reset status transition variable.
3968 3968
 		$this->status_transition = false;
3969 3969
 
3970
-		if ( $status_transition ) {
3970
+		if ($status_transition) {
3971 3971
 			try {
3972 3972
 
3973 3973
 				// Fire a hook for the status change.
3974
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3974
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition);
3975 3975
 
3976 3976
 				// @deprecated this is deprecated and will be removed in the future.
3977
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3977
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3978 3978
 
3979
-				if ( ! empty( $status_transition['from'] ) ) {
3979
+				if (!empty($status_transition['from'])) {
3980 3980
 
3981 3981
 					/* translators: 1: old invoice status 2: new invoice status */
3982
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3982
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this));
3983 3983
 
3984 3984
 					// Fire another hook.
3985
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3986
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3985
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this);
3986
+					do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']);
3987 3987
 
3988 3988
 					// @deprecated this is deprecated and will be removed in the future.
3989
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3989
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3990 3990
 
3991 3991
 					// Note the transition occurred.
3992
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3992
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']);
3993 3993
 
3994 3994
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3995 3995
 					if (
3996
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3997
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3996
+						in_array($status_transition['from'], array('wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3997
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3998 3998
 					) {
3999
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3999
+						do_action('getpaid_invoice_payment_status_changed', $this, $status_transition);
4000 4000
 					}
4001 4001
 
4002 4002
 					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
4003 4003
 					if (
4004
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
4005
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
4004
+						in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
4005
+						&& in_array($status_transition['to'], array('wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
4006 4006
 					) {
4007
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
4007
+						do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition);
4008 4008
 					}
4009 4009
 				} else {
4010 4010
 					/* translators: %s: new invoice status */
4011
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
4011
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this));
4012 4012
 
4013 4013
 					// Note the transition occurred.
4014
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
4014
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
4015 4015
 
4016 4016
 				}
4017
-			} catch ( Exception $e ) {
4018
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
4017
+			} catch (Exception $e) {
4018
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
4019 4019
 			}
4020 4020
 		}
4021 4021
 	}
@@ -4023,13 +4023,13 @@  discard block
 block discarded – undo
4023 4023
 	/**
4024 4024
 	 * Updates an invoice status.
4025 4025
 	 */
4026
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
4026
+	public function update_status($new_status = false, $note = '', $manual = false) {
4027 4027
 
4028 4028
 		// Fires before updating a status.
4029
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
4029
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
4030 4030
 
4031 4031
 		// Update the status.
4032
-		$this->set_status( $new_status, $note, $manual );
4032
+		$this->set_status($new_status, $note, $manual);
4033 4033
 
4034 4034
 		// Save the order.
4035 4035
 		return $this->save();
@@ -4040,18 +4040,18 @@  discard block
 block discarded – undo
4040 4040
 	 * @deprecated
4041 4041
 	 */
4042 4042
 	public function refresh_item_ids() {
4043
-        $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
4044
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
4043
+        $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id')));
4044
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
4045 4045
 	}
4046 4046
 
4047 4047
 	/**
4048 4048
 	 * @deprecated
4049 4049
 	 */
4050
-	public function update_items( $temp = false ) {
4050
+	public function update_items($temp = false) {
4051 4051
 
4052
-		$this->set_items( $this->get_items() );
4052
+		$this->set_items($this->get_items());
4053 4053
 
4054
-		if ( ! $temp ) {
4054
+		if (!$temp) {
4055 4055
 			$this->save();
4056 4056
 		}
4057 4057
 
@@ -4065,11 +4065,11 @@  discard block
 block discarded – undo
4065 4065
 
4066 4066
         $discount_code = $this->get_discount_code();
4067 4067
 
4068
-        if ( empty( $discount_code ) ) {
4068
+        if (empty($discount_code)) {
4069 4069
             return false;
4070 4070
         }
4071 4071
 
4072
-        $discount = wpinv_get_discount_obj( $discount_code );
4072
+        $discount = wpinv_get_discount_obj($discount_code);
4073 4073
 
4074 4074
         // Ensure it is active.
4075 4075
         return $discount->exists();
@@ -4080,7 +4080,7 @@  discard block
 block discarded – undo
4080 4080
 	 * Refunds an invoice.
4081 4081
 	 */
4082 4082
     public function refund() {
4083
-		$this->set_status( 'wpi-refunded' );
4083
+		$this->set_status('wpi-refunded');
4084 4084
         $this->save();
4085 4085
 	}
4086 4086
 
@@ -4089,53 +4089,53 @@  discard block
 block discarded – undo
4089 4089
 	 *
4090 4090
 	 * @param string $transaction_id
4091 4091
 	 */
4092
-    public function mark_paid( $transaction_id = null, $note = '' ) {
4092
+    public function mark_paid($transaction_id = null, $note = '') {
4093 4093
 
4094 4094
 		// Set the transaction id.
4095
-		if ( empty( $transaction_id ) ) {
4096
-			$transaction_id = $this->generate_key( 'trans_' );
4095
+		if (empty($transaction_id)) {
4096
+			$transaction_id = $this->generate_key('trans_');
4097 4097
 		}
4098 4098
 
4099
-		if ( ! $this->get_transaction_id() ) {
4100
-			$this->set_transaction_id( $transaction_id );
4099
+		if (!$this->get_transaction_id()) {
4100
+			$this->set_transaction_id($transaction_id);
4101 4101
 		}
4102 4102
 
4103
-		if ( $this->is_paid() && 'wpi-processing' !== $this->get_status() ) {
4103
+		if ($this->is_paid() && 'wpi-processing' !== $this->get_status()) {
4104 4104
 			return $this->save();
4105 4105
 		}
4106 4106
 
4107 4107
 		// Set the completed date.
4108
-		$this->set_date_completed( current_time( 'mysql' ) );
4108
+		$this->set_date_completed(current_time('mysql'));
4109 4109
 
4110 4110
 		// Set the new status.
4111
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
4112
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
4111
+		$gateway = sanitize_text_field($this->get_gateway_title());
4112
+		if ($this->is_renewal() || !$this->is_parent()) {
4113 4113
 
4114
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
4115
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4114
+			$_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway);
4115
+			$_note = $_note . empty($note) ? '' : " ($note)";
4116 4116
 
4117
-			if ( 'none' == $this->get_gateway() ) {
4117
+			if ('none' == $this->get_gateway()) {
4118 4118
 				$_note = $note;
4119 4119
 			}
4120 4120
 
4121
-			$this->set_status( 'wpi-renewal', $_note );
4121
+			$this->set_status('wpi-renewal', $_note);
4122 4122
 
4123 4123
 		} else {
4124 4124
 
4125
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
4126
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4125
+			$_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway);
4126
+			$_note = $_note . empty($note) ? '' : " ($note)";
4127 4127
 
4128
-			if ( 'none' == $this->get_gateway() ) {
4128
+			if ('none' == $this->get_gateway()) {
4129 4129
 				$_note = $note;
4130 4130
 			}
4131 4131
 
4132
-			$this->set_status( 'publish', $_note );
4132
+			$this->set_status('publish', $_note);
4133 4133
 
4134 4134
 		}
4135 4135
 
4136 4136
 		// Set checkout mode.
4137
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4138
-		$this->set_mode( $mode );
4137
+		$mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live';
4138
+		$this->set_mode($mode);
4139 4139
 
4140 4140
 		// Save the invoice.
4141 4141
         $this->save();
@@ -4160,16 +4160,16 @@  discard block
 block discarded – undo
4160 4160
      * Clears the subscription's cache.
4161 4161
      */
4162 4162
     public function clear_cache() {
4163
-		if ( $this->get_key() ) {
4164
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4163
+		if ($this->get_key()) {
4164
+			wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids');
4165 4165
 		}
4166 4166
 
4167
-		if ( $this->get_number() ) {
4168
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4167
+		if ($this->get_number()) {
4168
+			wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids');
4169 4169
 		}
4170 4170
 
4171
-		if ( $this->get_transaction_id() ) {
4172
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4171
+		if ($this->get_transaction_id()) {
4172
+			wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
4173 4173
 		}
4174 4174
 	}
4175 4175
 
Please login to merge, or discard this patch.
widgets/subscriptions.php 2 patches
Indentation   +349 added lines, -349 removed lines patch added patch discarded remove patch
@@ -14,144 +14,144 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class WPInv_Subscriptions_Widget extends WP_Super_Duper {
16 16
 
17
-	/**
18
-	 * Register the widget with WordPress.
19
-	 *
20
-	 */
21
-	public function __construct() {
22
-
23
-		$options = array(
24
-			'textdomain'     => 'invoicing',
25
-			'block-icon'     => 'controls-repeat',
26
-			'block-category' => 'widgets',
27
-			'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28
-			'class_name'     => __CLASS__,
29
-			'base_id'        => 'wpinv_subscriptions',
30
-			'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
31
-			'widget_ops'     => array(
32
-				'classname'   => 'getpaid-subscriptions bsui',
33
-				'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
34
-			),
35
-			'arguments'      => array(
36
-				'title' => array(
37
-					'title'    => __( 'Widget title', 'invoicing' ),
38
-					'desc'     => __( 'Enter widget title.', 'invoicing' ),
39
-					'type'     => 'text',
40
-					'desc_tip' => true,
41
-					'default'  => '',
42
-					'advanced' => false,
43
-				),
44
-			),
45
-
46
-		);
47
-
48
-		parent::__construct( $options );
49
-	}
50
-
51
-	/**
52
-	 * Retrieves current user's subscriptions.
53
-	 *
54
-	 * @return GetPaid_Subscriptions_Query
55
-	 */
56
-	public function get_subscriptions() {
57
-
58
-		// Prepare license args.
59
-		$args  = array(
60
-			'customer_in' => get_current_user_id(),
61
-			'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
62
-		);
63
-
64
-		return new GetPaid_Subscriptions_Query( $args );
65
-
66
-	}
67
-
68
-	/**
69
-	 * The Super block output function.
70
-	 *
71
-	 * @param array $args
72
-	 * @param array $widget_args
73
-	 * @param string $content
74
-	 *
75
-	 * @return mixed|string|bool
76
-	 */
77
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
78
-
79
-		// Ensure that the user is logged in.
80
-		if ( ! is_user_logged_in() ) {
81
-
82
-			return aui()->alert(
83
-				array(
84
-					'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
85
-					'type'    => 'error',
86
-				)
87
-			);
88
-
89
-		}
90
-
91
-		// Are we displaying a single subscription?
92
-		if ( isset( $_GET['subscription'] ) ) {
93
-			return $this->display_single_subscription( intval( $_GET['subscription'] ) );
94
-		}
95
-
96
-		// Retrieve the user's subscriptions.
97
-		$subscriptions = $this->get_subscriptions();
98
-
99
-		// Start the output buffer.
100
-		ob_start();
101
-
102
-		// Backwards compatibility.
103
-		do_action( 'wpinv_before_user_subscriptions' );
104
-
105
-		// Display errors and notices.
106
-		wpinv_print_errors();
107
-
108
-		do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
109
-
110
-		// Print the table header.
111
-		$this->print_table_header();
112
-
113
-		// Print table body.
114
-		$this->print_table_body( $subscriptions->get_results() );
115
-
116
-		// Print table footer.
117
-		$this->print_table_footer();
118
-
119
-		// Print the navigation.
120
-		$this->print_navigation( $subscriptions->get_total() );
121
-
122
-		// Backwards compatibility.
123
-		do_action( 'wpinv_after_user_subscriptions' );
124
-
125
-		// Return the output.
126
-		return ob_get_clean();
127
-
128
-	}
129
-
130
-	/**
131
-	 * Retrieves the subscription columns.
132
-	 *
133
-	 * @return array
134
-	 */
135
-	public function get_subscriptions_table_columns() {
136
-
137
-		$columns = array(
138
-			'subscription' => __( 'Subscription', 'invoicing' ),
139
-			'amount'       => __( 'Amount', 'invoicing' ),
140
-			'renewal-date' => __( 'Next payment', 'invoicing' ),
141
-			'status'       => __( 'Status', 'invoicing' ),
142
-			'actions'      => '',
143
-		);
17
+    /**
18
+     * Register the widget with WordPress.
19
+     *
20
+     */
21
+    public function __construct() {
22
+
23
+        $options = array(
24
+            'textdomain'     => 'invoicing',
25
+            'block-icon'     => 'controls-repeat',
26
+            'block-category' => 'widgets',
27
+            'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28
+            'class_name'     => __CLASS__,
29
+            'base_id'        => 'wpinv_subscriptions',
30
+            'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
31
+            'widget_ops'     => array(
32
+                'classname'   => 'getpaid-subscriptions bsui',
33
+                'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
34
+            ),
35
+            'arguments'      => array(
36
+                'title' => array(
37
+                    'title'    => __( 'Widget title', 'invoicing' ),
38
+                    'desc'     => __( 'Enter widget title.', 'invoicing' ),
39
+                    'type'     => 'text',
40
+                    'desc_tip' => true,
41
+                    'default'  => '',
42
+                    'advanced' => false,
43
+                ),
44
+            ),
45
+
46
+        );
47
+
48
+        parent::__construct( $options );
49
+    }
50
+
51
+    /**
52
+     * Retrieves current user's subscriptions.
53
+     *
54
+     * @return GetPaid_Subscriptions_Query
55
+     */
56
+    public function get_subscriptions() {
57
+
58
+        // Prepare license args.
59
+        $args  = array(
60
+            'customer_in' => get_current_user_id(),
61
+            'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
62
+        );
63
+
64
+        return new GetPaid_Subscriptions_Query( $args );
65
+
66
+    }
67
+
68
+    /**
69
+     * The Super block output function.
70
+     *
71
+     * @param array $args
72
+     * @param array $widget_args
73
+     * @param string $content
74
+     *
75
+     * @return mixed|string|bool
76
+     */
77
+    public function output( $args = array(), $widget_args = array(), $content = '' ) {
78
+
79
+        // Ensure that the user is logged in.
80
+        if ( ! is_user_logged_in() ) {
81
+
82
+            return aui()->alert(
83
+                array(
84
+                    'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
85
+                    'type'    => 'error',
86
+                )
87
+            );
88
+
89
+        }
90
+
91
+        // Are we displaying a single subscription?
92
+        if ( isset( $_GET['subscription'] ) ) {
93
+            return $this->display_single_subscription( intval( $_GET['subscription'] ) );
94
+        }
95
+
96
+        // Retrieve the user's subscriptions.
97
+        $subscriptions = $this->get_subscriptions();
98
+
99
+        // Start the output buffer.
100
+        ob_start();
101
+
102
+        // Backwards compatibility.
103
+        do_action( 'wpinv_before_user_subscriptions' );
104
+
105
+        // Display errors and notices.
106
+        wpinv_print_errors();
107
+
108
+        do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
109
+
110
+        // Print the table header.
111
+        $this->print_table_header();
112
+
113
+        // Print table body.
114
+        $this->print_table_body( $subscriptions->get_results() );
115
+
116
+        // Print table footer.
117
+        $this->print_table_footer();
118
+
119
+        // Print the navigation.
120
+        $this->print_navigation( $subscriptions->get_total() );
121
+
122
+        // Backwards compatibility.
123
+        do_action( 'wpinv_after_user_subscriptions' );
124
+
125
+        // Return the output.
126
+        return ob_get_clean();
127
+
128
+    }
129
+
130
+    /**
131
+     * Retrieves the subscription columns.
132
+     *
133
+     * @return array
134
+     */
135
+    public function get_subscriptions_table_columns() {
136
+
137
+        $columns = array(
138
+            'subscription' => __( 'Subscription', 'invoicing' ),
139
+            'amount'       => __( 'Amount', 'invoicing' ),
140
+            'renewal-date' => __( 'Next payment', 'invoicing' ),
141
+            'status'       => __( 'Status', 'invoicing' ),
142
+            'actions'      => '',
143
+        );
144 144
 
145
-		return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
146
-	}
145
+        return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
146
+    }
147 147
 
148
-	/**
149
-	 * Displays the table header.
150
-	 *
151
-	 */
152
-	public function print_table_header() {
148
+    /**
149
+     * Displays the table header.
150
+     *
151
+     */
152
+    public function print_table_header() {
153 153
 
154
-		?>
154
+        ?>
155 155
 
156 156
 			<table class="table table-bordered table-striped">
157 157
 
@@ -167,122 +167,122 @@  discard block
 block discarded – undo
167 167
 
168 168
 		<?php
169 169
 
170
-	}
170
+    }
171 171
 
172
-	/**
173
-	 * Displays the table body.
174
-	 *
175
-	 * @param WPInv_Subscription[] $subscriptions
176
-	 */
177
-	public function print_table_body( $subscriptions ) {
172
+    /**
173
+     * Displays the table body.
174
+     *
175
+     * @param WPInv_Subscription[] $subscriptions
176
+     */
177
+    public function print_table_body( $subscriptions ) {
178 178
 
179
-		if ( empty( $subscriptions ) ) {
180
-			$this->print_table_body_no_subscriptions();
181
-		} else {
182
-			$this->print_table_body_subscriptions( $subscriptions );
183
-		}
179
+        if ( empty( $subscriptions ) ) {
180
+            $this->print_table_body_no_subscriptions();
181
+        } else {
182
+            $this->print_table_body_subscriptions( $subscriptions );
183
+        }
184 184
 
185
-	}
185
+    }
186 186
 
187
-	/**
188
-	 * Displays the table body if no subscriptions were found.
189
-	 *
190
-	 */
191
-	public function print_table_body_no_subscriptions() {
187
+    /**
188
+     * Displays the table body if no subscriptions were found.
189
+     *
190
+     */
191
+    public function print_table_body_no_subscriptions() {
192 192
 
193
-		?>
193
+        ?>
194 194
 		<tbody>
195 195
 
196 196
 			<tr>
197 197
 				<td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>">
198 198
 
199 199
 					<?php
200
-						aui()->alert(
201
-							array(
202
-								'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
203
-								'type'    => 'warning',
204
-							),
200
+                        aui()->alert(
201
+                            array(
202
+                                'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
203
+                                'type'    => 'warning',
204
+                            ),
205 205
                             true
206
-						);
207
-					?>
206
+                        );
207
+                    ?>
208 208
 
209 209
 				</td>
210 210
 			</tr>
211 211
 
212 212
 		</tbody>
213 213
 		<?php
214
-	}
214
+    }
215 215
 
216
-	/**
217
-	 * Displays the table body if subscriptions were found.
218
-	 *
219
-	 * @param WPInv_Subscription[] $subscriptions
220
-	 */
221
-	public function print_table_body_subscriptions( $subscriptions ) {
216
+    /**
217
+     * Displays the table body if subscriptions were found.
218
+     *
219
+     * @param WPInv_Subscription[] $subscriptions
220
+     */
221
+    public function print_table_body_subscriptions( $subscriptions ) {
222 222
 
223
-		?>
223
+        ?>
224 224
 		<tbody>
225 225
 
226 226
 			<?php foreach ( $subscriptions as $subscription ) : ?>
227 227
 				<tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>">
228 228
 					<?php
229
-						wpinv_get_template(
230
-							'subscriptions/subscriptions-table-row.php',
231
-							array(
232
-								'subscription' => $subscription,
233
-								'widget'       => $this,
234
-							)
235
-						);
236
-					?>
229
+                        wpinv_get_template(
230
+                            'subscriptions/subscriptions-table-row.php',
231
+                            array(
232
+                                'subscription' => $subscription,
233
+                                'widget'       => $this,
234
+                            )
235
+                        );
236
+                    ?>
237 237
 				</tr>
238 238
 			<?php endforeach; ?>
239 239
 
240 240
 		</tbody>
241 241
 		<?php
242
-	}
243
-
244
-	/**
245
-	 * Adds row actions to a column
246
-	 *
247
-	 * @param string $content column content
248
-	 * @param WPInv_Subscription $subscription
249
-	 * @since       1.0.0
250
-	 * @return      string
251
-	 */
252
-	public function add_row_actions( $content, $subscription ) {
253
-
254
-		// Prepare row actions.
255
-		$actions = array();
256
-
257
-		// View subscription action.
258
-		$view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
259
-		$view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
260
-		$actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __( 'Manage', 'invoicing' ) . '</a>';
261
-
262
-		// Filter the actions.
263
-		$actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
264
-
265
-		$sanitized  = array();
266
-		foreach ( $actions as $key => $action ) {
267
-			$key         = sanitize_html_class( $key );
268
-			$action      = wp_kses_post( $action );
269
-			$sanitized[] = "<span class='$key'>$action</span>";
270
-		}
271
-
272
-		$row_actions  = "<small class='form-text getpaid-subscription-item-btn-actions'>";
273
-		$row_actions .= implode( ' | ', $sanitized );
274
-		$row_actions .= '</small>';
275
-
276
-		return $content . $row_actions;
277
-	}
278
-
279
-	/**
280
-	 * Displays the table footer.
281
-	 *
282
-	 */
283
-	public function print_table_footer() {
284
-
285
-		?>
242
+    }
243
+
244
+    /**
245
+     * Adds row actions to a column
246
+     *
247
+     * @param string $content column content
248
+     * @param WPInv_Subscription $subscription
249
+     * @since       1.0.0
250
+     * @return      string
251
+     */
252
+    public function add_row_actions( $content, $subscription ) {
253
+
254
+        // Prepare row actions.
255
+        $actions = array();
256
+
257
+        // View subscription action.
258
+        $view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
259
+        $view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
260
+        $actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __( 'Manage', 'invoicing' ) . '</a>';
261
+
262
+        // Filter the actions.
263
+        $actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
264
+
265
+        $sanitized  = array();
266
+        foreach ( $actions as $key => $action ) {
267
+            $key         = sanitize_html_class( $key );
268
+            $action      = wp_kses_post( $action );
269
+            $sanitized[] = "<span class='$key'>$action</span>";
270
+        }
271
+
272
+        $row_actions  = "<small class='form-text getpaid-subscription-item-btn-actions'>";
273
+        $row_actions .= implode( ' | ', $sanitized );
274
+        $row_actions .= '</small>';
275
+
276
+        return $content . $row_actions;
277
+    }
278
+
279
+    /**
280
+     * Displays the table footer.
281
+     *
282
+     */
283
+    public function print_table_footer() {
284
+
285
+        ?>
286 286
 
287 287
 				<tfoot>
288 288
 					<tr>
@@ -297,145 +297,145 @@  discard block
 block discarded – undo
297 297
 			</table>
298 298
 		<?php
299 299
 
300
-	}
300
+    }
301 301
 
302
-	/**
303
-	 * Displays the navigation.
304
-	 *
305
-	 * @param int $total
306
-	 */
307
-	public function print_navigation( $total ) {
302
+    /**
303
+     * Displays the navigation.
304
+     *
305
+     * @param int $total
306
+     */
307
+    public function print_navigation( $total ) {
308 308
 
309
-		if ( $total < 1 ) {
309
+        if ( $total < 1 ) {
310 310
 
311
-			// Out-of-bounds, run the query again without LIMIT for total count.
312
-			$args  = array(
313
-				'customer_in' => get_current_user_id(),
314
-				'fields'      => 'id',
315
-			);
311
+            // Out-of-bounds, run the query again without LIMIT for total count.
312
+            $args  = array(
313
+                'customer_in' => get_current_user_id(),
314
+                'fields'      => 'id',
315
+            );
316 316
 
317
-			$count_query = new GetPaid_Subscriptions_Query( $args );
318
-			$total       = $count_query->get_total();
319
-		}
317
+            $count_query = new GetPaid_Subscriptions_Query( $args );
318
+            $total       = $count_query->get_total();
319
+        }
320 320
 
321
-		// Abort if we do not have pages.
322
-		if ( 2 > $total ) {
323
-			return;
324
-		}
321
+        // Abort if we do not have pages.
322
+        if ( 2 > $total ) {
323
+            return;
324
+        }
325 325
 
326
-		?>
326
+        ?>
327 327
 
328 328
 		<div class="getpaid-subscriptions-pagination">
329 329
 			<?php
330
-				$big = 999999;
331
-
332
-				echo wp_kses_post(
333
-					getpaid_paginate_links(
334
-						array(
335
-							'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
336
-							'format' => '?paged=%#%',
337
-							'total'  => (int) ceil( $total / 10 ),
338
-						)
339
-					)
340
-				);
341
-			?>
330
+                $big = 999999;
331
+
332
+                echo wp_kses_post(
333
+                    getpaid_paginate_links(
334
+                        array(
335
+                            'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
336
+                            'format' => '?paged=%#%',
337
+                            'total'  => (int) ceil( $total / 10 ),
338
+                        )
339
+                    )
340
+                );
341
+            ?>
342 342
 		</div>
343 343
 
344 344
 		<?php
345
-	}
346
-
347
-	/**
348
-	 * Returns a single subscription's columns.
349
-	 *
350
-	 * @param WPInv_Subscription $subscription
351
-	 *
352
-	 * @return array
353
-	 */
354
-	public function get_single_subscription_columns( $subscription ) {
355
-
356
-		// Prepare subscription detail columns.
357
-		$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
358
-		$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
359
-		$fields             = apply_filters(
360
-			'getpaid_single_subscription_details_fields',
361
-			array(
362
-				'status'           => __( 'Status', 'invoicing' ),
363
-				'initial_amount'   => __( 'Initial amount', 'invoicing' ),
364
-				'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
365
-				'start_date'       => __( 'Start date', 'invoicing' ),
366
-				'expiry_date'      => __( 'Next payment', 'invoicing' ),
367
-				'payments'         => __( 'Payments', 'invoicing' ),
368
-				'item'             => $items_count > 1 ? __( 'Items', $items_count, 'invoicing' ) : __( 'Item', 'invoicing' )
369
-			),
370
-			$subscription,
371
-			$items_count
372
-		);
373
-
374
-		if ( isset( $fields['expiry_date'] ) ) {
375
-
376
-			if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
377
-				$fields['expiry_date'] = __( 'End date', 'invoicing' );
378
-			}
379
-
380
-			if ( 'pending' === $subscription->get_status() ) {
381
-				unset( $fields['expiry_date'] );
382
-			}
383
-		}
384
-
385
-		if ( isset( $fields['start_date'] ) && 'pending' === $subscription->get_status() ) {
386
-			unset( $fields['start_date'] );
387
-		}
388
-
389
-		if ( $subscription->get_initial_amount() === $subscription->get_recurring_amount() ) {
390
-			unset( $fields['initial_amount'] );
391
-		}
392
-
393
-		return $fields;
394
-	}
395
-
396
-	/**
397
-	 * Displays a single subscription.
398
-	 *
399
-	 * @param string $subscription
400
-	 *
401
-	 * @return string
402
-	 */
403
-	public function display_single_subscription( $subscription ) {
404
-
405
-		// Fetch the subscription.
406
-		$subscription = new WPInv_Subscription( (int) $subscription );
407
-
408
-		if ( ! $subscription->exists() ) {
409
-
410
-			return aui()->alert(
411
-				array(
412
-					'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
413
-					'type'    => 'error',
414
-				)
415
-			);
416
-
417
-		}
418
-
419
-		// Ensure that the user owns this subscription key.
420
-		if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
421
-
422
-			return aui()->alert(
423
-				array(
424
-					'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
425
-					'type'    => 'error',
426
-				)
427
-			);
428
-
429
-		}
430
-
431
-		return wpinv_get_template_html(
432
-			'subscriptions/subscription-details.php',
433
-			array(
434
-				'subscription' => $subscription,
435
-				'widget'       => $this,
436
-			)
437
-		);
438
-
439
-	}
345
+    }
346
+
347
+    /**
348
+     * Returns a single subscription's columns.
349
+     *
350
+     * @param WPInv_Subscription $subscription
351
+     *
352
+     * @return array
353
+     */
354
+    public function get_single_subscription_columns( $subscription ) {
355
+
356
+        // Prepare subscription detail columns.
357
+        $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
358
+        $items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
359
+        $fields             = apply_filters(
360
+            'getpaid_single_subscription_details_fields',
361
+            array(
362
+                'status'           => __( 'Status', 'invoicing' ),
363
+                'initial_amount'   => __( 'Initial amount', 'invoicing' ),
364
+                'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
365
+                'start_date'       => __( 'Start date', 'invoicing' ),
366
+                'expiry_date'      => __( 'Next payment', 'invoicing' ),
367
+                'payments'         => __( 'Payments', 'invoicing' ),
368
+                'item'             => $items_count > 1 ? __( 'Items', $items_count, 'invoicing' ) : __( 'Item', 'invoicing' )
369
+            ),
370
+            $subscription,
371
+            $items_count
372
+        );
373
+
374
+        if ( isset( $fields['expiry_date'] ) ) {
375
+
376
+            if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
377
+                $fields['expiry_date'] = __( 'End date', 'invoicing' );
378
+            }
379
+
380
+            if ( 'pending' === $subscription->get_status() ) {
381
+                unset( $fields['expiry_date'] );
382
+            }
383
+        }
384
+
385
+        if ( isset( $fields['start_date'] ) && 'pending' === $subscription->get_status() ) {
386
+            unset( $fields['start_date'] );
387
+        }
388
+
389
+        if ( $subscription->get_initial_amount() === $subscription->get_recurring_amount() ) {
390
+            unset( $fields['initial_amount'] );
391
+        }
392
+
393
+        return $fields;
394
+    }
395
+
396
+    /**
397
+     * Displays a single subscription.
398
+     *
399
+     * @param string $subscription
400
+     *
401
+     * @return string
402
+     */
403
+    public function display_single_subscription( $subscription ) {
404
+
405
+        // Fetch the subscription.
406
+        $subscription = new WPInv_Subscription( (int) $subscription );
407
+
408
+        if ( ! $subscription->exists() ) {
409
+
410
+            return aui()->alert(
411
+                array(
412
+                    'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
413
+                    'type'    => 'error',
414
+                )
415
+            );
416
+
417
+        }
418
+
419
+        // Ensure that the user owns this subscription key.
420
+        if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
421
+
422
+            return aui()->alert(
423
+                array(
424
+                    'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
425
+                    'type'    => 'error',
426
+                )
427
+            );
428
+
429
+        }
430
+
431
+        return wpinv_get_template_html(
432
+            'subscriptions/subscription-details.php',
433
+            array(
434
+                'subscription' => $subscription,
435
+                'widget'       => $this,
436
+            )
437
+        );
438
+
439
+    }
440 440
 
441 441
 }
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @version 1.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Contains the subscriptions widget.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 			'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28 28
 			'class_name'     => __CLASS__,
29 29
 			'base_id'        => 'wpinv_subscriptions',
30
-			'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
30
+			'name'           => __('GetPaid > Subscriptions', 'invoicing'),
31 31
 			'widget_ops'     => array(
32 32
 				'classname'   => 'getpaid-subscriptions bsui',
33
-				'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
33
+				'description' => esc_html__("Displays the current user's subscriptions.", 'invoicing'),
34 34
 			),
35 35
 			'arguments'      => array(
36 36
 				'title' => array(
37
-					'title'    => __( 'Widget title', 'invoicing' ),
38
-					'desc'     => __( 'Enter widget title.', 'invoicing' ),
37
+					'title'    => __('Widget title', 'invoicing'),
38
+					'desc'     => __('Enter widget title.', 'invoicing'),
39 39
 					'type'     => 'text',
40 40
 					'desc_tip' => true,
41 41
 					'default'  => '',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		);
47 47
 
48
-		parent::__construct( $options );
48
+		parent::__construct($options);
49 49
 	}
50 50
 
51 51
 	/**
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	public function get_subscriptions() {
57 57
 
58 58
 		// Prepare license args.
59
-		$args  = array(
59
+		$args = array(
60 60
 			'customer_in' => get_current_user_id(),
61
-			'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
61
+			'paged'       => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1,
62 62
 		);
63 63
 
64
-		return new GetPaid_Subscriptions_Query( $args );
64
+		return new GetPaid_Subscriptions_Query($args);
65 65
 
66 66
 	}
67 67
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed|string|bool
76 76
 	 */
77
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
+	public function output($args = array(), $widget_args = array(), $content = '') {
78 78
 
79 79
 		// Ensure that the user is logged in.
80
-		if ( ! is_user_logged_in() ) {
80
+		if (!is_user_logged_in()) {
81 81
 
82 82
 			return aui()->alert(
83 83
 				array(
84
-					'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
84
+					'content' => wp_kses_post(__('You need to log-in or create an account to view this section.', 'invoicing')),
85 85
 					'type'    => 'error',
86 86
 				)
87 87
 			);
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 		}
90 90
 
91 91
 		// Are we displaying a single subscription?
92
-		if ( isset( $_GET['subscription'] ) ) {
93
-			return $this->display_single_subscription( intval( $_GET['subscription'] ) );
92
+		if (isset($_GET['subscription'])) {
93
+			return $this->display_single_subscription(intval($_GET['subscription']));
94 94
 		}
95 95
 
96 96
 		// Retrieve the user's subscriptions.
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
 		ob_start();
101 101
 
102 102
 		// Backwards compatibility.
103
-		do_action( 'wpinv_before_user_subscriptions' );
103
+		do_action('wpinv_before_user_subscriptions');
104 104
 
105 105
 		// Display errors and notices.
106 106
 		wpinv_print_errors();
107 107
 
108
-		do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
108
+		do_action('getpaid_license_manager_before_subscriptions', $subscriptions);
109 109
 
110 110
 		// Print the table header.
111 111
 		$this->print_table_header();
112 112
 
113 113
 		// Print table body.
114
-		$this->print_table_body( $subscriptions->get_results() );
114
+		$this->print_table_body($subscriptions->get_results());
115 115
 
116 116
 		// Print table footer.
117 117
 		$this->print_table_footer();
118 118
 
119 119
 		// Print the navigation.
120
-		$this->print_navigation( $subscriptions->get_total() );
120
+		$this->print_navigation($subscriptions->get_total());
121 121
 
122 122
 		// Backwards compatibility.
123
-		do_action( 'wpinv_after_user_subscriptions' );
123
+		do_action('wpinv_after_user_subscriptions');
124 124
 
125 125
 		// Return the output.
126 126
 		return ob_get_clean();
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 	public function get_subscriptions_table_columns() {
136 136
 
137 137
 		$columns = array(
138
-			'subscription' => __( 'Subscription', 'invoicing' ),
139
-			'amount'       => __( 'Amount', 'invoicing' ),
140
-			'renewal-date' => __( 'Next payment', 'invoicing' ),
141
-			'status'       => __( 'Status', 'invoicing' ),
138
+			'subscription' => __('Subscription', 'invoicing'),
139
+			'amount'       => __('Amount', 'invoicing'),
140
+			'renewal-date' => __('Next payment', 'invoicing'),
141
+			'status'       => __('Status', 'invoicing'),
142 142
 			'actions'      => '',
143 143
 		);
144 144
 
145
-		return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
145
+		return apply_filters('getpaid_frontend_subscriptions_table_columns', $columns);
146 146
 	}
147 147
 
148 148
 	/**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 
158 158
 				<thead>
159 159
 					<tr>
160
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
161
-							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr( $key ); ?>">
162
-								<?php echo esc_html( $label ); ?>
160
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
161
+							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr($key); ?>">
162
+								<?php echo esc_html($label); ?>
163 163
 							</th>
164 164
 						<?php endforeach; ?>
165 165
 					</tr>
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @param WPInv_Subscription[] $subscriptions
176 176
 	 */
177
-	public function print_table_body( $subscriptions ) {
177
+	public function print_table_body($subscriptions) {
178 178
 
179
-		if ( empty( $subscriptions ) ) {
179
+		if (empty($subscriptions)) {
180 180
 			$this->print_table_body_no_subscriptions();
181 181
 		} else {
182
-			$this->print_table_body_subscriptions( $subscriptions );
182
+			$this->print_table_body_subscriptions($subscriptions);
183 183
 		}
184 184
 
185 185
 	}
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 		<tbody>
195 195
 
196 196
 			<tr>
197
-				<td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>">
197
+				<td colspan="<?php echo count($this->get_subscriptions_table_columns()); ?>">
198 198
 
199 199
 					<?php
200 200
 						aui()->alert(
201 201
 							array(
202
-								'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
202
+								'content' => wp_kses_post(__('No subscriptions found.', 'invoicing')),
203 203
 								'type'    => 'warning',
204 204
 							),
205 205
                             true
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @param WPInv_Subscription[] $subscriptions
220 220
 	 */
221
-	public function print_table_body_subscriptions( $subscriptions ) {
221
+	public function print_table_body_subscriptions($subscriptions) {
222 222
 
223 223
 		?>
224 224
 		<tbody>
225 225
 
226
-			<?php foreach ( $subscriptions as $subscription ) : ?>
226
+			<?php foreach ($subscriptions as $subscription) : ?>
227 227
 				<tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>">
228 228
 					<?php
229 229
 						wpinv_get_template(
@@ -249,28 +249,28 @@  discard block
 block discarded – undo
249 249
 	 * @since       1.0.0
250 250
 	 * @return      string
251 251
 	 */
252
-	public function add_row_actions( $content, $subscription ) {
252
+	public function add_row_actions($content, $subscription) {
253 253
 
254 254
 		// Prepare row actions.
255 255
 		$actions = array();
256 256
 
257 257
 		// View subscription action.
258
-		$view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
259
-		$view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
260
-		$actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __( 'Manage', 'invoicing' ) . '</a>';
258
+		$view_url        = getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')));
259
+		$view_url        = esc_url(add_query_arg('subscription', (int) $subscription->get_id(), $view_url));
260
+		$actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __('Manage', 'invoicing') . '</a>';
261 261
 
262 262
 		// Filter the actions.
263
-		$actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
263
+		$actions = apply_filters('getpaid_subscriptions_table_subscription_actions', $actions, $subscription);
264 264
 
265
-		$sanitized  = array();
266
-		foreach ( $actions as $key => $action ) {
267
-			$key         = sanitize_html_class( $key );
268
-			$action      = wp_kses_post( $action );
265
+		$sanitized = array();
266
+		foreach ($actions as $key => $action) {
267
+			$key         = sanitize_html_class($key);
268
+			$action      = wp_kses_post($action);
269 269
 			$sanitized[] = "<span class='$key'>$action</span>";
270 270
 		}
271 271
 
272 272
 		$row_actions  = "<small class='form-text getpaid-subscription-item-btn-actions'>";
273
-		$row_actions .= implode( ' | ', $sanitized );
273
+		$row_actions .= implode(' | ', $sanitized);
274 274
 		$row_actions .= '</small>';
275 275
 
276 276
 		return $content . $row_actions;
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
 
287 287
 				<tfoot>
288 288
 					<tr>
289
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
290
-							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr( $key ); ?>">
291
-								<?php echo esc_html( $label ); ?>
289
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
290
+							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr($key); ?>">
291
+								<?php echo esc_html($label); ?>
292 292
 							</th>
293 293
 						<?php endforeach; ?>
294 294
 					</tr>
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @param int $total
306 306
 	 */
307
-	public function print_navigation( $total ) {
307
+	public function print_navigation($total) {
308 308
 
309
-		if ( $total < 1 ) {
309
+		if ($total < 1) {
310 310
 
311 311
 			// Out-of-bounds, run the query again without LIMIT for total count.
312
-			$args  = array(
312
+			$args = array(
313 313
 				'customer_in' => get_current_user_id(),
314 314
 				'fields'      => 'id',
315 315
 			);
316 316
 
317
-			$count_query = new GetPaid_Subscriptions_Query( $args );
317
+			$count_query = new GetPaid_Subscriptions_Query($args);
318 318
 			$total       = $count_query->get_total();
319 319
 		}
320 320
 
321 321
 		// Abort if we do not have pages.
322
-		if ( 2 > $total ) {
322
+		if (2 > $total) {
323 323
 			return;
324 324
 		}
325 325
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
 				echo wp_kses_post(
333 333
 					getpaid_paginate_links(
334 334
 						array(
335
-							'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
335
+							'base'   => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
336 336
 							'format' => '?paged=%#%',
337
-							'total'  => (int) ceil( $total / 10 ),
337
+							'total'  => (int) ceil($total / 10),
338 338
 						)
339 339
 					)
340 340
 				);
@@ -351,43 +351,43 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return array
353 353
 	 */
354
-	public function get_single_subscription_columns( $subscription ) {
354
+	public function get_single_subscription_columns($subscription) {
355 355
 
356 356
 		// Prepare subscription detail columns.
357
-		$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
358
-		$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
357
+		$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id());
358
+		$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
359 359
 		$fields             = apply_filters(
360 360
 			'getpaid_single_subscription_details_fields',
361 361
 			array(
362
-				'status'           => __( 'Status', 'invoicing' ),
363
-				'initial_amount'   => __( 'Initial amount', 'invoicing' ),
364
-				'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
365
-				'start_date'       => __( 'Start date', 'invoicing' ),
366
-				'expiry_date'      => __( 'Next payment', 'invoicing' ),
367
-				'payments'         => __( 'Payments', 'invoicing' ),
368
-				'item'             => $items_count > 1 ? __( 'Items', $items_count, 'invoicing' ) : __( 'Item', 'invoicing' )
362
+				'status'           => __('Status', 'invoicing'),
363
+				'initial_amount'   => __('Initial amount', 'invoicing'),
364
+				'recurring_amount' => __('Recurring amount', 'invoicing'),
365
+				'start_date'       => __('Start date', 'invoicing'),
366
+				'expiry_date'      => __('Next payment', 'invoicing'),
367
+				'payments'         => __('Payments', 'invoicing'),
368
+				'item'             => $items_count > 1 ? __('Items', $items_count, 'invoicing') : __('Item', 'invoicing')
369 369
 			),
370 370
 			$subscription,
371 371
 			$items_count
372 372
 		);
373 373
 
374
-		if ( isset( $fields['expiry_date'] ) ) {
374
+		if (isset($fields['expiry_date'])) {
375 375
 
376
-			if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
377
-				$fields['expiry_date'] = __( 'End date', 'invoicing' );
376
+			if (!$subscription->is_active() || $subscription->is_last_renewal()) {
377
+				$fields['expiry_date'] = __('End date', 'invoicing');
378 378
 			}
379 379
 
380
-			if ( 'pending' === $subscription->get_status() ) {
381
-				unset( $fields['expiry_date'] );
380
+			if ('pending' === $subscription->get_status()) {
381
+				unset($fields['expiry_date']);
382 382
 			}
383 383
 		}
384 384
 
385
-		if ( isset( $fields['start_date'] ) && 'pending' === $subscription->get_status() ) {
386
-			unset( $fields['start_date'] );
385
+		if (isset($fields['start_date']) && 'pending' === $subscription->get_status()) {
386
+			unset($fields['start_date']);
387 387
 		}
388 388
 
389
-		if ( $subscription->get_initial_amount() === $subscription->get_recurring_amount() ) {
390
-			unset( $fields['initial_amount'] );
389
+		if ($subscription->get_initial_amount() === $subscription->get_recurring_amount()) {
390
+			unset($fields['initial_amount']);
391 391
 		}
392 392
 
393 393
 		return $fields;
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return string
402 402
 	 */
403
-	public function display_single_subscription( $subscription ) {
403
+	public function display_single_subscription($subscription) {
404 404
 
405 405
 		// Fetch the subscription.
406
-		$subscription = new WPInv_Subscription( (int) $subscription );
406
+		$subscription = new WPInv_Subscription((int) $subscription);
407 407
 
408
-		if ( ! $subscription->exists() ) {
408
+		if (!$subscription->exists()) {
409 409
 
410 410
 			return aui()->alert(
411 411
 				array(
412
-					'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
412
+					'content' => wp_kses_post(__('Subscription not found.', 'invoicing')),
413 413
 					'type'    => 'error',
414 414
 				)
415 415
 			);
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
 		}
418 418
 
419 419
 		// Ensure that the user owns this subscription key.
420
-		if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
420
+		if (get_current_user_id() != $subscription->get_customer_id() && !wpinv_current_user_can_manage_invoicing()) {
421 421
 
422 422
 			return aui()->alert(
423 423
 				array(
424
-					'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
424
+					'content' => wp_kses_post(__('You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing')),
425 425
 					'type'    => 'error',
426 426
 				)
427 427
 			);
Please login to merge, or discard this patch.
includes/invoice-functions.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * Checks if the current user cna view an invoice receipt.
68 68
  */
69 69
 function wpinv_can_view_receipt( $invoice ) {
70
-	return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice );
70
+    return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice );
71 71
 }
72 72
 
73 73
 /**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * @param string $post_type The post type to check for.
97 97
  */
98 98
 function getpaid_is_invoice_post_type( $post_type ) {
99
-	return is_scalar( $post_type ) && ! empty( $post_type ) && strpos( $post_type, 'wpi_' ) === 0 && array_key_exists( $post_type, getpaid_get_invoice_post_types() );
99
+    return is_scalar( $post_type ) && ! empty( $post_type ) && strpos( $post_type, 'wpi_' ) === 0 && array_key_exists( $post_type, getpaid_get_invoice_post_types() );
100 100
 }
101 101
 
102 102
 /**
@@ -556,37 +556,37 @@  discard block
 block discarded – undo
556 556
     $label   = empty( $label ) ? __( 'Invoice', 'invoicing' ) : sanitize_text_field( $label );
557 557
     $columns = array(
558 558
 
559
-		'invoice-number'  => array(
560
-			'title' => $label,
561
-			'class' => 'text-left',
562
-		),
559
+        'invoice-number'  => array(
560
+            'title' => $label,
561
+            'class' => 'text-left',
562
+        ),
563 563
 
564
-		'created-date'    => array(
565
-			'title' => __( 'Created Date', 'invoicing' ),
566
-			'class' => 'text-left',
567
-		),
564
+        'created-date'    => array(
565
+            'title' => __( 'Created Date', 'invoicing' ),
566
+            'class' => 'text-left',
567
+        ),
568 568
 
569
-		'payment-date'    => array(
570
-			'title' => __( 'Payment Date', 'invoicing' ),
571
-			'class' => 'text-left',
572
-		),
569
+        'payment-date'    => array(
570
+            'title' => __( 'Payment Date', 'invoicing' ),
571
+            'class' => 'text-left',
572
+        ),
573 573
 
574
-		'invoice-status'  => array(
575
-			'title' => __( 'Status', 'invoicing' ),
576
-			'class' => 'text-center',
577
-		),
574
+        'invoice-status'  => array(
575
+            'title' => __( 'Status', 'invoicing' ),
576
+            'class' => 'text-center',
577
+        ),
578 578
 
579
-		'invoice-total'   => array(
580
-			'title' => __( 'Total', 'invoicing' ),
581
-			'class' => 'text-right',
582
-		),
579
+        'invoice-total'   => array(
580
+            'title' => __( 'Total', 'invoicing' ),
581
+            'class' => 'text-right',
582
+        ),
583 583
 
584
-		'invoice-actions' => array(
585
-			'title' => '&nbsp;',
586
-			'class' => 'text-center',
587
-		),
584
+        'invoice-actions' => array(
585
+            'title' => '&nbsp;',
586
+            'class' => 'text-center',
587
+        ),
588 588
 
589
-	);
589
+    );
590 590
 
591 591
     return apply_filters( 'wpinv_user_invoices_columns', $columns, $post_type );
592 592
 }
@@ -1297,22 +1297,22 @@  discard block
 block discarded – undo
1297 1297
  */
1298 1298
 function getpaid_get_invoice_status_classes() {
1299 1299
 
1300
-	return apply_filters(
1301
-		'getpaid_get_invoice_status_classes',
1302
-		array(
1300
+    return apply_filters(
1301
+        'getpaid_get_invoice_status_classes',
1302
+        array(
1303 1303
             'wpi-quote-declined' => 'bg-danger',
1304 1304
             'wpi-failed'         => 'bg-danger',
1305
-			'wpi-processing'     => 'bg-info',
1306
-			'wpi-onhold'         => 'bg-warning text-dark',
1307
-			'wpi-quote-accepted' => 'bg-success',
1308
-			'publish'            => 'bg-success',
1309
-			'wpi-renewal'        => 'bg-primary',
1305
+            'wpi-processing'     => 'bg-info',
1306
+            'wpi-onhold'         => 'bg-warning text-dark',
1307
+            'wpi-quote-accepted' => 'bg-success',
1308
+            'publish'            => 'bg-success',
1309
+            'wpi-renewal'        => 'bg-primary',
1310 1310
             'wpi-cancelled'      => 'bg-secondary',
1311 1311
             'wpi-pending'        => 'bg-dark text-white',
1312 1312
             'wpi-quote-pending'  => 'bg-dark text-white',
1313 1313
             'wpi-refunded'       => 'bg-secondary',
1314
-		)
1315
-	);
1314
+        )
1315
+    );
1316 1316
 
1317 1317
 }
1318 1318
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 function getpaid_get_invoice_tax_rate( $invoice, $item ) {
1327 1327
 
1328 1328
     $rates   = getpaid_get_item_tax_rates( $item, $invoice->get_country(), $invoice->get_state() );
1329
-	$rates   = getpaid_filter_item_tax_rates( $item, $rates );
1329
+    $rates   = getpaid_filter_item_tax_rates( $item, $rates );
1330 1330
     $rates   = wp_list_pluck( $rates, 'rate' );
1331 1331
 
1332 1332
     return array_sum( $rates );
Please login to merge, or discard this patch.
Spacing   +373 added lines, -373 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 the current invoice.
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 function getpaid_get_current_invoice_id() {
15 15
 
16 16
     // Ensure that we have an invoice key.
17
-    if ( empty( $_GET['invoice_key'] ) ) {
17
+    if (empty($_GET['invoice_key'])) {
18 18
         return 0;
19 19
     }
20 20
 
21 21
     // Retrieve an invoice using the key.
22
-    $invoice = new WPInv_Invoice( sanitize_text_field( $_GET['invoice_key'] ) );
22
+    $invoice = new WPInv_Invoice(sanitize_text_field($_GET['invoice_key']));
23 23
 
24 24
     // Compare the invoice key and the parsed key.
25
-    if ( $invoice->get_id() != 0 && $invoice->get_key() == sanitize_text_field( $_GET['invoice_key'] ) ) {
25
+    if ($invoice->get_id() != 0 && $invoice->get_key() == sanitize_text_field($_GET['invoice_key'])) {
26 26
         return $invoice->get_id();
27 27
     }
28 28
 
@@ -32,42 +32,42 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Checks if the current user cna view an invoice.
34 34
  */
35
-function wpinv_user_can_view_invoice( $invoice ) {
36
-    $invoice = new WPInv_Invoice( $invoice );
35
+function wpinv_user_can_view_invoice($invoice) {
36
+    $invoice = new WPInv_Invoice($invoice);
37 37
 
38 38
     // Abort if the invoice does not exist.
39
-    if ( 0 == $invoice->get_id() ) {
39
+    if (0 == $invoice->get_id()) {
40 40
         return false;
41 41
     }
42 42
 
43 43
     // Don't allow trash, draft status
44
-    if ( $invoice->is_draft() ) {
44
+    if ($invoice->is_draft()) {
45 45
         return false;
46 46
     }
47 47
 
48 48
     // If users are not required to login to check out, compare the invoice keys.
49
-    if ( ! wpinv_require_login_to_checkout() && isset( $_GET['invoice_key'] ) && sanitize_text_field( $_GET['invoice_key'] ) == $invoice->get_key() ) {
49
+    if (!wpinv_require_login_to_checkout() && isset($_GET['invoice_key']) && sanitize_text_field($_GET['invoice_key']) == $invoice->get_key()) {
50 50
         return true;
51 51
     }
52 52
 
53 53
     // Always enable for admins..
54
-    if ( wpinv_current_user_can( 'view_invoice', array( 'invoice' => $invoice ) ) || current_user_can( 'view_invoices', $invoice->get_id() ) ) { // Admin user
54
+    if (wpinv_current_user_can('view_invoice', array('invoice' => $invoice)) || current_user_can('view_invoices', $invoice->get_id())) { // Admin user
55 55
         return true;
56 56
     }
57 57
 
58 58
     // Else, ensure that this is their invoice.
59
-    if ( is_user_logged_in() && $invoice->get_user_id() == get_current_user_id() ) {
59
+    if (is_user_logged_in() && $invoice->get_user_id() == get_current_user_id()) {
60 60
         return true;
61 61
     }
62 62
 
63
-    return apply_filters( 'wpinv_current_user_can_view_invoice', false, $invoice );
63
+    return apply_filters('wpinv_current_user_can_view_invoice', false, $invoice);
64 64
 }
65 65
 
66 66
 /**
67 67
  * Checks if the current user cna view an invoice receipt.
68 68
  */
69
-function wpinv_can_view_receipt( $invoice ) {
70
-	return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice );
69
+function wpinv_can_view_receipt($invoice) {
70
+	return (bool) apply_filters('wpinv_can_view_receipt', wpinv_user_can_view_invoice($invoice), $invoice);
71 71
 }
72 72
 
73 73
 /**
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function getpaid_get_invoice_post_types() {
79 79
     $post_types = array(
80
-        'wpi_quote'   => __( 'Quote', 'invoicing' ),
81
-        'wpi_invoice' => __( 'Invoice', 'invoicing' ),
80
+        'wpi_quote'   => __('Quote', 'invoicing'),
81
+        'wpi_invoice' => __('Invoice', 'invoicing'),
82 82
     );
83 83
 
84 84
     // Ensure the quotes addon is installed.
85
-    if ( ! defined( 'WPINV_QUOTES_VERSION' ) ) {
86
-        unset( $post_types['wpi_quote'] );
85
+    if (!defined('WPINV_QUOTES_VERSION')) {
86
+        unset($post_types['wpi_quote']);
87 87
     }
88 88
 
89
-    return apply_filters( 'getpaid_invoice_post_types', $post_types );
89
+    return apply_filters('getpaid_invoice_post_types', $post_types);
90 90
 }
91 91
 
92 92
 /**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @param string $post_type The post type to check for.
97 97
  */
98
-function getpaid_is_invoice_post_type( $post_type ) {
99
-	return is_scalar( $post_type ) && ! empty( $post_type ) && strpos( $post_type, 'wpi_' ) === 0 && array_key_exists( $post_type, getpaid_get_invoice_post_types() );
98
+function getpaid_is_invoice_post_type($post_type) {
99
+	return is_scalar($post_type) && !empty($post_type) && strpos($post_type, 'wpi_') === 0 && array_key_exists($post_type, getpaid_get_invoice_post_types());
100 100
 }
101 101
 
102 102
 /**
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
107 107
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
108 108
  */
109
-function wpinv_create_invoice( $data = array(), $deprecated = null, $wp_error = false ) {
109
+function wpinv_create_invoice($data = array(), $deprecated = null, $wp_error = false) {
110 110
     $data['invoice_id'] = 0;
111
-    return wpinv_insert_invoice( $data, $wp_error );
111
+    return wpinv_insert_invoice($data, $wp_error);
112 112
 }
113 113
 
114 114
 /**
@@ -118,35 +118,35 @@  discard block
 block discarded – undo
118 118
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
119 119
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
120 120
  */
121
-function wpinv_update_invoice( $data = array(), $wp_error = false ) {
121
+function wpinv_update_invoice($data = array(), $wp_error = false) {
122 122
 
123 123
     // Backwards compatibility.
124
-    if ( ! empty( $data['ID'] ) ) {
124
+    if (!empty($data['ID'])) {
125 125
         $data['invoice_id'] = $data['ID'];
126 126
     }
127 127
 
128 128
     // Do we have an invoice id?
129
-    if ( empty( $data['invoice_id'] ) ) {
130
-        return $wp_error ? new WP_Error( 'invalid_invoice_id', __( 'Invalid invoice ID.', 'invoicing' ) ) : 0;
129
+    if (empty($data['invoice_id'])) {
130
+        return $wp_error ? new WP_Error('invalid_invoice_id', __('Invalid invoice ID.', 'invoicing')) : 0;
131 131
     }
132 132
 
133 133
     // Retrieve the invoice.
134
-    $invoice = wpinv_get_invoice( $data['invoice_id'] );
134
+    $invoice = wpinv_get_invoice($data['invoice_id']);
135 135
 
136 136
     // And abort if it does not exist.
137
-    if ( empty( $invoice ) ) {
138
-        return $wp_error ? new WP_Error( 'missing_invoice', __( 'Invoice not found.', 'invoicing' ) ) : 0;
137
+    if (empty($invoice)) {
138
+        return $wp_error ? new WP_Error('missing_invoice', __('Invoice not found.', 'invoicing')) : 0;
139 139
     }
140 140
 
141 141
     // Do not update totals for paid / refunded invoices.
142
-    if ( $invoice->is_paid() || $invoice->is_refunded() ) {
142
+    if ($invoice->is_paid() || $invoice->is_refunded()) {
143 143
 
144
-        if ( ! empty( $data['items'] ) || ! empty( $data['cart_details'] ) ) {
145
-            return $wp_error ? new WP_Error( 'paid_invoice', __( 'You can not update cart items for invoices that have already been paid for.', 'invoicing' ) ) : 0;
144
+        if (!empty($data['items']) || !empty($data['cart_details'])) {
145
+            return $wp_error ? new WP_Error('paid_invoice', __('You can not update cart items for invoices that have already been paid for.', 'invoicing')) : 0;
146 146
         }
147 147
 }
148 148
 
149
-    return wpinv_insert_invoice( $data, $wp_error );
149
+    return wpinv_insert_invoice($data, $wp_error);
150 150
 
151 151
 }
152 152
 
@@ -157,62 +157,62 @@  discard block
 block discarded – undo
157 157
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
158 158
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
159 159
  */
160
-function wpinv_insert_invoice( $data = array(), $wp_error = false ) {
160
+function wpinv_insert_invoice($data = array(), $wp_error = false) {
161 161
 
162 162
     // Ensure that we have invoice data.
163
-    if ( empty( $data ) ) {
163
+    if (empty($data)) {
164 164
         return false;
165 165
     }
166 166
 
167 167
     // The invoice id will be provided when updating an invoice.
168
-    $data['invoice_id'] = ! empty( $data['invoice_id'] ) ? (int) $data['invoice_id'] : false;
168
+    $data['invoice_id'] = !empty($data['invoice_id']) ? (int) $data['invoice_id'] : false;
169 169
 
170 170
     // Retrieve the invoice.
171
-    $invoice = new WPInv_Invoice( $data['invoice_id'] );
171
+    $invoice = new WPInv_Invoice($data['invoice_id']);
172 172
 
173 173
     // Do we have an error?
174
-    if ( ! empty( $invoice->last_error ) ) {
175
-        return $wp_error ? new WP_Error( 'invalid_invoice_id', $invoice->last_error ) : 0;
174
+    if (!empty($invoice->last_error)) {
175
+        return $wp_error ? new WP_Error('invalid_invoice_id', $invoice->last_error) : 0;
176 176
     }
177 177
 
178 178
     // Backwards compatibility (billing address).
179
-    if ( ! empty( $data['user_info'] ) ) {
179
+    if (!empty($data['user_info'])) {
180 180
 
181
-        foreach ( $data['user_info'] as $key => $value ) {
181
+        foreach ($data['user_info'] as $key => $value) {
182 182
 
183
-            if ( $key == 'discounts' ) {
183
+            if ($key == 'discounts') {
184 184
                 $value = (array) $value;
185
-                $data['discount_code'] = empty( $value ) ? null : $value[0];
185
+                $data['discount_code'] = empty($value) ? null : $value[0];
186 186
             } else {
187
-                $data[ $key ] = $value;
187
+                $data[$key] = $value;
188 188
             }
189 189
 }
190 190
 }
191 191
 
192 192
     // Backwards compatibility.
193
-    if ( ! empty( $data['payment_details'] ) ) {
193
+    if (!empty($data['payment_details'])) {
194 194
 
195
-        foreach ( $data['payment_details'] as $key => $value ) {
196
-            $data[ $key ] = $value;
195
+        foreach ($data['payment_details'] as $key => $value) {
196
+            $data[$key] = $value;
197 197
         }
198 198
 }
199 199
 
200 200
     // Set up the owner of the invoice.
201
-    $user_id = ! empty( $data['user_id'] ) ? wpinv_clean( $data['user_id'] ) : get_current_user_id();
201
+    $user_id = !empty($data['user_id']) ? wpinv_clean($data['user_id']) : get_current_user_id();
202 202
 
203 203
     // Make sure the user exists.
204
-    if ( ! get_userdata( $user_id ) ) {
205
-        return $wp_error ? new WP_Error( 'wpinv_invalid_user', __( 'There is no user with that ID.', 'invoicing' ) ) : 0;
204
+    if (!get_userdata($user_id)) {
205
+        return $wp_error ? new WP_Error('wpinv_invalid_user', __('There is no user with that ID.', 'invoicing')) : 0;
206 206
     }
207 207
 
208
-    $address = wpinv_get_user_address( $user_id );
208
+    $address = wpinv_get_user_address($user_id);
209 209
 
210
-    foreach ( $address as $key => $value ) {
210
+    foreach ($address as $key => $value) {
211 211
 
212
-        if ( $value == '' ) {
213
-            $address[ $key ] = null;
212
+        if ($value == '') {
213
+            $address[$key] = null;
214 214
         } else {
215
-            $address[ $key ] = wpinv_clean( $value );
215
+            $address[$key] = wpinv_clean($value);
216 216
         }
217 217
 }
218 218
 
@@ -221,101 +221,101 @@  discard block
 block discarded – undo
221 221
         array(
222 222
 
223 223
             // Basic info.
224
-            'template'          => isset( $data['template'] ) ? wpinv_clean( $data['template'] ) : null,
225
-            'email_cc'          => isset( $data['email_cc'] ) ? wpinv_clean( $data['email_cc'] ) : null,
226
-            'date_created'      => isset( $data['created_date'] ) ? wpinv_clean( $data['created_date'] ) : null,
227
-            'due_date'          => isset( $data['due_date'] ) ? wpinv_clean( $data['due_date'] ) : null,
228
-            'date_completed'    => isset( $data['date_completed'] ) ? wpinv_clean( $data['date_completed'] ) : null,
229
-            'number'            => isset( $data['number'] ) ? wpinv_clean( $data['number'] ) : null,
230
-            'key'               => isset( $data['key'] ) ? wpinv_clean( $data['key'] ) : null,
231
-            'status'            => isset( $data['status'] ) ? wpinv_clean( $data['status'] ) : null,
232
-            'post_type'         => isset( $data['post_type'] ) ? wpinv_clean( $data['post_type'] ) : null,
233
-            'user_ip'           => isset( $data['ip'] ) ? wpinv_clean( $data['ip'] ) : wpinv_get_ip(),
234
-            'parent_id'         => isset( $data['parent'] ) ? intval( $data['parent'] ) : null,
235
-            'mode'              => isset( $data['mode'] ) ? wpinv_clean( $data['mode'] ) : null,
236
-            'description'       => isset( $data['description'] ) ? wp_kses_post( $data['description'] ) : null,
224
+            'template'          => isset($data['template']) ? wpinv_clean($data['template']) : null,
225
+            'email_cc'          => isset($data['email_cc']) ? wpinv_clean($data['email_cc']) : null,
226
+            'date_created'      => isset($data['created_date']) ? wpinv_clean($data['created_date']) : null,
227
+            'due_date'          => isset($data['due_date']) ? wpinv_clean($data['due_date']) : null,
228
+            'date_completed'    => isset($data['date_completed']) ? wpinv_clean($data['date_completed']) : null,
229
+            'number'            => isset($data['number']) ? wpinv_clean($data['number']) : null,
230
+            'key'               => isset($data['key']) ? wpinv_clean($data['key']) : null,
231
+            'status'            => isset($data['status']) ? wpinv_clean($data['status']) : null,
232
+            'post_type'         => isset($data['post_type']) ? wpinv_clean($data['post_type']) : null,
233
+            'user_ip'           => isset($data['ip']) ? wpinv_clean($data['ip']) : wpinv_get_ip(),
234
+            'parent_id'         => isset($data['parent']) ? intval($data['parent']) : null,
235
+            'mode'              => isset($data['mode']) ? wpinv_clean($data['mode']) : null,
236
+            'description'       => isset($data['description']) ? wp_kses_post($data['description']) : null,
237 237
 
238 238
             // Payment info.
239
-            'disable_taxes'     => ! empty( $data['disable_taxes'] ),
240
-            'currency'          => isset( $data['currency'] ) ? wpinv_clean( $data['currency'] ) : wpinv_get_currency(),
241
-            'gateway'           => isset( $data['gateway'] ) ? wpinv_clean( $data['gateway'] ) : null,
242
-            'transaction_id'    => isset( $data['transaction_id'] ) ? wpinv_clean( $data['transaction_id'] ) : null,
243
-            'discount_code'     => isset( $data['discount_code'] ) ? wpinv_clean( $data['discount_code'] ) : null,
244
-            'payment_form'      => isset( $data['payment_form'] ) ? intval( $data['payment_form'] ) : null,
245
-            'submission_id'     => isset( $data['submission_id'] ) ? wpinv_clean( $data['submission_id'] ) : null,
246
-            'subscription_id'   => isset( $data['subscription_id'] ) ? wpinv_clean( $data['subscription_id'] ) : null,
247
-            'is_viewed'         => isset( $data['is_viewed'] ) ? wpinv_clean( $data['is_viewed'] ) : null,
248
-            'fees'              => isset( $data['fees'] ) ? wpinv_clean( $data['fees'] ) : null,
249
-            'discounts'         => isset( $data['discounts'] ) ? wpinv_clean( $data['discounts'] ) : null,
250
-            'taxes'             => isset( $data['taxes'] ) ? wpinv_clean( $data['taxes'] ) : null,
239
+            'disable_taxes'     => !empty($data['disable_taxes']),
240
+            'currency'          => isset($data['currency']) ? wpinv_clean($data['currency']) : wpinv_get_currency(),
241
+            'gateway'           => isset($data['gateway']) ? wpinv_clean($data['gateway']) : null,
242
+            'transaction_id'    => isset($data['transaction_id']) ? wpinv_clean($data['transaction_id']) : null,
243
+            'discount_code'     => isset($data['discount_code']) ? wpinv_clean($data['discount_code']) : null,
244
+            'payment_form'      => isset($data['payment_form']) ? intval($data['payment_form']) : null,
245
+            'submission_id'     => isset($data['submission_id']) ? wpinv_clean($data['submission_id']) : null,
246
+            'subscription_id'   => isset($data['subscription_id']) ? wpinv_clean($data['subscription_id']) : null,
247
+            'is_viewed'         => isset($data['is_viewed']) ? wpinv_clean($data['is_viewed']) : null,
248
+            'fees'              => isset($data['fees']) ? wpinv_clean($data['fees']) : null,
249
+            'discounts'         => isset($data['discounts']) ? wpinv_clean($data['discounts']) : null,
250
+            'taxes'             => isset($data['taxes']) ? wpinv_clean($data['taxes']) : null,
251 251
 
252 252
             // Billing details.
253 253
             'user_id'           => $data['user_id'],
254
-            'first_name'        => isset( $data['first_name'] ) ? wpinv_clean( $data['first_name'] ) : $address['first_name'],
255
-            'last_name'         => isset( $data['last_name'] ) ? wpinv_clean( $data['last_name'] ) : $address['last_name'],
256
-            'address'           => isset( $data['address'] ) ? wpinv_clean( $data['address'] ) : $address['address'],
257
-            'vat_number'        => isset( $data['vat_number'] ) ? wpinv_clean( $data['vat_number'] ) : $address['vat_number'],
258
-            'company'           => isset( $data['company'] ) ? wpinv_clean( $data['company'] ) : $address['company'],
259
-            'zip'               => isset( $data['zip'] ) ? wpinv_clean( $data['zip'] ) : $address['zip'],
260
-            'state'             => isset( $data['state'] ) ? wpinv_clean( $data['state'] ) : $address['state'],
261
-            'city'              => isset( $data['city'] ) ? wpinv_clean( $data['city'] ) : $address['city'],
262
-            'country'           => isset( $data['country'] ) ? wpinv_clean( $data['country'] ) : $address['country'],
263
-            'phone'             => isset( $data['phone'] ) ? wpinv_clean( $data['phone'] ) : $address['phone'],
264
-            'address_confirmed' => ! empty( $data['address_confirmed'] ),
254
+            'first_name'        => isset($data['first_name']) ? wpinv_clean($data['first_name']) : $address['first_name'],
255
+            'last_name'         => isset($data['last_name']) ? wpinv_clean($data['last_name']) : $address['last_name'],
256
+            'address'           => isset($data['address']) ? wpinv_clean($data['address']) : $address['address'],
257
+            'vat_number'        => isset($data['vat_number']) ? wpinv_clean($data['vat_number']) : $address['vat_number'],
258
+            'company'           => isset($data['company']) ? wpinv_clean($data['company']) : $address['company'],
259
+            'zip'               => isset($data['zip']) ? wpinv_clean($data['zip']) : $address['zip'],
260
+            'state'             => isset($data['state']) ? wpinv_clean($data['state']) : $address['state'],
261
+            'city'              => isset($data['city']) ? wpinv_clean($data['city']) : $address['city'],
262
+            'country'           => isset($data['country']) ? wpinv_clean($data['country']) : $address['country'],
263
+            'phone'             => isset($data['phone']) ? wpinv_clean($data['phone']) : $address['phone'],
264
+            'address_confirmed' => !empty($data['address_confirmed']),
265 265
 
266 266
         )
267 267
     );
268 268
 
269 269
     // Backwards compatibililty.
270
-    if ( ! empty( $data['cart_details'] ) && is_array( $data['cart_details'] ) ) {
270
+    if (!empty($data['cart_details']) && is_array($data['cart_details'])) {
271 271
         $data['items'] = array();
272 272
 
273
-        foreach ( $data['cart_details'] as $_item ) {
273
+        foreach ($data['cart_details'] as $_item) {
274 274
 
275 275
             // Ensure that we have an item id.
276
-            if ( empty( $_item['id'] ) ) {
276
+            if (empty($_item['id'])) {
277 277
                 continue;
278 278
             }
279 279
 
280 280
             // Retrieve the item.
281
-            $item = new GetPaid_Form_Item( $_item['id'] );
281
+            $item = new GetPaid_Form_Item($_item['id']);
282 282
 
283 283
             // Ensure that it is purchasable.
284
-            if ( ! $item->can_purchase() ) {
284
+            if (!$item->can_purchase()) {
285 285
                 continue;
286 286
             }
287 287
 
288 288
             // Set quantity.
289
-            if ( ! empty( $_item['quantity'] ) && is_numeric( $_item['quantity'] ) ) {
290
-                $item->set_quantity( $_item['quantity'] );
289
+            if (!empty($_item['quantity']) && is_numeric($_item['quantity'])) {
290
+                $item->set_quantity($_item['quantity']);
291 291
             }
292 292
 
293 293
             // Set price.
294
-            if ( isset( $_item['item_price'] ) ) {
295
-                $item->set_price( $_item['item_price'] );
294
+            if (isset($_item['item_price'])) {
295
+                $item->set_price($_item['item_price']);
296 296
             }
297 297
 
298
-            if ( isset( $_item['custom_price'] ) ) {
299
-                $item->set_price( $_item['custom_price'] );
298
+            if (isset($_item['custom_price'])) {
299
+                $item->set_price($_item['custom_price']);
300 300
             }
301 301
 
302 302
             // Set name.
303
-            if ( ! empty( $_item['name'] ) ) {
304
-                $item->set_name( $_item['name'] );
303
+            if (!empty($_item['name'])) {
304
+                $item->set_name($_item['name']);
305 305
             }
306 306
 
307 307
             // Set description.
308
-            if ( isset( $_item['description'] ) ) {
309
-                $item->set_custom_description( $_item['description'] );
308
+            if (isset($_item['description'])) {
309
+                $item->set_custom_description($_item['description']);
310 310
             }
311 311
 
312 312
             // Set meta.
313
-            if ( isset( $_item['meta'] ) && is_array( $_item['meta'] ) ) {
313
+            if (isset($_item['meta']) && is_array($_item['meta'])) {
314 314
 
315
-                $item->set_item_meta( $_item['meta'] );
315
+                $item->set_item_meta($_item['meta']);
316 316
 
317
-                if ( isset( $_item['meta']['description'] ) ) {
318
-                    $item->set_custom_description( $_item['meta']['description'] );
317
+                if (isset($_item['meta']['description'])) {
318
+                    $item->set_custom_description($_item['meta']['description']);
319 319
                 }
320 320
             }
321 321
 
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
     }
326 326
 
327 327
     // Add invoice items.
328
-    if ( ! empty( $data['items'] ) && is_array( $data['items'] ) ) {
328
+    if (!empty($data['items']) && is_array($data['items'])) {
329 329
 
330
-        $invoice->set_items( array() );
330
+        $invoice->set_items(array());
331 331
 
332
-        foreach ( $data['items'] as $item ) {
332
+        foreach ($data['items'] as $item) {
333 333
 
334
-            if ( is_object( $item ) && is_a( $item, 'GetPaid_Form_Item' ) && $item->can_purchase() ) {
335
-                $invoice->add_item( $item );
334
+            if (is_object($item) && is_a($item, 'GetPaid_Form_Item') && $item->can_purchase()) {
335
+                $invoice->add_item($item);
336 336
             }
337 337
 }
338 338
 }
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
     $invoice->recalculate_total();
342 342
     $invoice->save();
343 343
 
344
-    if ( ! $invoice->get_id() ) {
345
-        return $wp_error ? new WP_Error( 'wpinv_insert_invoice_error', __( 'An error occured when saving your invoice.', 'invoicing' ) ) : 0;
344
+    if (!$invoice->get_id()) {
345
+        return $wp_error ? new WP_Error('wpinv_insert_invoice_error', __('An error occured when saving your invoice.', 'invoicing')) : 0;
346 346
     }
347 347
 
348 348
     // Add private note.
349
-    if ( ! empty( $data['private_note'] ) ) {
350
-        $invoice->add_note( $data['private_note'] );
349
+    if (!empty($data['private_note'])) {
350
+        $invoice->add_note($data['private_note']);
351 351
     }
352 352
 
353 353
     // User notes.
354
-    if ( ! empty( $data['user_note'] ) ) {
355
-        $invoice->add_note( $data['user_note'], true );
354
+    if (!empty($data['user_note'])) {
355
+        $invoice->add_note($data['user_note'], true);
356 356
     }
357 357
 
358 358
     // Created via.
359
-    if ( isset( $data['created_via'] ) ) {
360
-        update_post_meta( $invoice->get_id(), 'wpinv_created_via', $data['created_via'] );
359
+    if (isset($data['created_via'])) {
360
+        update_post_meta($invoice->get_id(), 'wpinv_created_via', $data['created_via']);
361 361
     }
362 362
 
363 363
     // Backwards compatiblity.
364
-    if ( $invoice->is_quote() ) {
364
+    if ($invoice->is_quote()) {
365 365
 
366
-        if ( isset( $data['valid_until'] ) ) {
367
-            update_post_meta( $invoice->get_id(), 'wpinv_quote_valid_until', $data['valid_until'] );
366
+        if (isset($data['valid_until'])) {
367
+            update_post_meta($invoice->get_id(), 'wpinv_quote_valid_until', $data['valid_until']);
368 368
         }
369 369
 }
370 370
 
@@ -378,20 +378,20 @@  discard block
 block discarded – undo
378 378
  * @param $bool $deprecated
379 379
  * @return WPInv_Invoice|null
380 380
  */
381
-function wpinv_get_invoice( $invoice = 0, $deprecated = false ) {
381
+function wpinv_get_invoice($invoice = 0, $deprecated = false) {
382 382
 
383 383
     // If we are retrieving the invoice from the cart...
384
-    if ( $deprecated && empty( $invoice ) ) {
384
+    if ($deprecated && empty($invoice)) {
385 385
         $invoice = (int) getpaid_get_current_invoice_id();
386 386
     }
387 387
 
388 388
     // Retrieve the invoice.
389
-    if ( ! is_a( $invoice, 'WPInv_Invoice' ) ) {
390
-        $invoice = new WPInv_Invoice( $invoice );
389
+    if (!is_a($invoice, 'WPInv_Invoice')) {
390
+        $invoice = new WPInv_Invoice($invoice);
391 391
     }
392 392
 
393 393
     // Check if it exists.
394
-    if ( $invoice->exists() ) {
394
+    if ($invoice->exists()) {
395 395
         return $invoice;
396 396
     }
397 397
 
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
  * @param array $args Args to search for.
405 405
  * @return WPInv_Invoice[]|int[]|object
406 406
  */
407
-function wpinv_get_invoices( $args ) {
407
+function wpinv_get_invoices($args) {
408 408
 
409 409
     // Prepare args.
410 410
     $args = wp_parse_args(
411 411
         $args,
412 412
         array(
413
-            'status' => array_keys( wpinv_get_invoice_statuses() ),
413
+            'status' => array_keys(wpinv_get_invoice_statuses()),
414 414
             'type'   => 'wpi_invoice',
415
-            'limit'  => get_option( 'posts_per_page' ),
415
+            'limit'  => get_option('posts_per_page'),
416 416
             'return' => 'objects',
417 417
         )
418 418
     );
@@ -430,24 +430,24 @@  discard block
 block discarded – undo
430 430
         'post__in'       => 'include',
431 431
     );
432 432
 
433
-    foreach ( $map_legacy as $to => $from ) {
434
-        if ( isset( $args[ $from ] ) ) {
435
-            $args[ $to ] = $args[ $from ];
436
-            unset( $args[ $from ] );
433
+    foreach ($map_legacy as $to => $from) {
434
+        if (isset($args[$from])) {
435
+            $args[$to] = $args[$from];
436
+            unset($args[$from]);
437 437
         }
438 438
     }
439 439
 
440 440
     // Backwards compatibility.
441
-    if ( ! empty( $args['email'] ) && empty( $args['user'] ) ) {
441
+    if (!empty($args['email']) && empty($args['user'])) {
442 442
         $args['user'] = $args['email'];
443
-        unset( $args['email'] );
443
+        unset($args['email']);
444 444
     }
445 445
 
446 446
     // Handle cases where the user is set as an email.
447
-    if ( ! empty( $args['author'] ) && is_email( $args['author'] ) ) {
448
-        $user = get_user_by( 'email', $args['user'] );
447
+    if (!empty($args['author']) && is_email($args['author'])) {
448
+        $user = get_user_by('email', $args['user']);
449 449
 
450
-        if ( $user ) {
450
+        if ($user) {
451 451
             $args['author'] = $user->user_email;
452 452
         }
453 453
 }
@@ -457,31 +457,31 @@  discard block
 block discarded – undo
457 457
 
458 458
     // Show all posts.
459 459
     $paginate = true;
460
-    if ( isset( $args['paginate'] ) ) {
460
+    if (isset($args['paginate'])) {
461 461
 
462 462
         $paginate = $args['paginate'];
463
-        $args['no_found_rows'] = empty( $args['paginate'] );
464
-        unset( $args['paginate'] );
463
+        $args['no_found_rows'] = empty($args['paginate']);
464
+        unset($args['paginate']);
465 465
 
466 466
     }
467 467
 
468 468
     // Whether to return objects or fields.
469 469
     $return = $args['return'];
470
-    unset( $args['return'] );
470
+    unset($args['return']);
471 471
 
472 472
     // Get invoices.
473
-    $invoices = new WP_Query( apply_filters( 'wpinv_get_invoices_args', $args ) );
473
+    $invoices = new WP_Query(apply_filters('wpinv_get_invoices_args', $args));
474 474
 
475 475
     // Prepare the results.
476
-    if ( 'objects' === $return ) {
477
-        $results = array_map( 'wpinv_get_invoice', $invoices->posts );
478
-    } elseif ( 'self' === $return ) {
476
+    if ('objects' === $return) {
477
+        $results = array_map('wpinv_get_invoice', $invoices->posts);
478
+    } elseif ('self' === $return) {
479 479
         return $invoices;
480 480
     } else {
481 481
         $results = $invoices->posts;
482 482
     }
483 483
 
484
-    if ( $paginate ) {
484
+    if ($paginate) {
485 485
         return (object) array(
486 486
             'invoices'      => $results,
487 487
             'total'         => $invoices->found_posts,
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
  * @param string $transaction_id The transaction id to check.
500 500
  * @return int Invoice id on success or 0 on failure
501 501
  */
502
-function wpinv_get_id_by_transaction_id( $transaction_id ) {
503
-    return WPInv_Invoice::get_invoice_id_by_field( $transaction_id, 'transaction_id' );
502
+function wpinv_get_id_by_transaction_id($transaction_id) {
503
+    return WPInv_Invoice::get_invoice_id_by_field($transaction_id, 'transaction_id');
504 504
 }
505 505
 
506 506
 /**
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
  * @param string $invoice_number The invoice number to check.
510 510
  * @return int Invoice id on success or 0 on failure
511 511
  */
512
-function wpinv_get_id_by_invoice_number( $invoice_number ) {
513
-    return WPInv_Invoice::get_invoice_id_by_field( $invoice_number, 'number' );
512
+function wpinv_get_id_by_invoice_number($invoice_number) {
513
+    return WPInv_Invoice::get_invoice_id_by_field($invoice_number, 'number');
514 514
 }
515 515
 
516 516
 /**
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
  * @param string $invoice_key The invoice key to check.
520 520
  * @return int Invoice id on success or 0 on failure
521 521
  */
522
-function wpinv_get_invoice_id_by_key( $invoice_key ) {
523
-    return WPInv_Invoice::get_invoice_id_by_field( $invoice_key, 'key' );
522
+function wpinv_get_invoice_id_by_key($invoice_key) {
523
+    return WPInv_Invoice::get_invoice_id_by_field($invoice_key, 'key');
524 524
 }
525 525
 
526 526
 /**
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
  * @param string $type Optionally filter by type i.e customer|system
531 531
  * @return array|null
532 532
  */
533
-function wpinv_get_invoice_notes( $invoice = 0, $type = '' ) {
533
+function wpinv_get_invoice_notes($invoice = 0, $type = '') {
534 534
 
535 535
     // Prepare the invoice.
536
-    $invoice = wpinv_get_invoice( $invoice );
537
-    if ( empty( $invoice ) ) {
536
+    $invoice = wpinv_get_invoice($invoice);
537
+    if (empty($invoice)) {
538 538
         return null;
539 539
     }
540 540
 
541 541
     // Fetch notes.
542
-    $notes = getpaid_notes()->get_invoice_notes( $invoice->get_id(), $type );
542
+    $notes = getpaid_notes()->get_invoice_notes($invoice->get_id(), $type);
543 543
 
544 544
     // Filter the notes.
545
-    return apply_filters( 'wpinv_invoice_notes', $notes, $invoice->get_id(), $type );
545
+    return apply_filters('wpinv_invoice_notes', $notes, $invoice->get_id(), $type);
546 546
 }
547 547
 
548 548
 /**
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
  *
551 551
  * @param string $post_type
552 552
  */
553
-function wpinv_get_user_invoices_columns( $post_type = 'wpi_invoice' ) {
553
+function wpinv_get_user_invoices_columns($post_type = 'wpi_invoice') {
554 554
 
555
-    $label   = getpaid_get_post_type_label( $post_type, false );
556
-    $label   = empty( $label ) ? __( 'Invoice', 'invoicing' ) : sanitize_text_field( $label );
555
+    $label   = getpaid_get_post_type_label($post_type, false);
556
+    $label   = empty($label) ? __('Invoice', 'invoicing') : sanitize_text_field($label);
557 557
     $columns = array(
558 558
 
559 559
 		'invoice-number'  => array(
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
 		),
563 563
 
564 564
 		'created-date'    => array(
565
-			'title' => __( 'Created Date', 'invoicing' ),
565
+			'title' => __('Created Date', 'invoicing'),
566 566
 			'class' => 'text-left',
567 567
 		),
568 568
 
569 569
 		'payment-date'    => array(
570
-			'title' => __( 'Payment Date', 'invoicing' ),
570
+			'title' => __('Payment Date', 'invoicing'),
571 571
 			'class' => 'text-left',
572 572
 		),
573 573
 
574 574
 		'invoice-status'  => array(
575
-			'title' => __( 'Status', 'invoicing' ),
575
+			'title' => __('Status', 'invoicing'),
576 576
 			'class' => 'text-center',
577 577
 		),
578 578
 
579 579
 		'invoice-total'   => array(
580
-			'title' => __( 'Total', 'invoicing' ),
580
+			'title' => __('Total', 'invoicing'),
581 581
 			'class' => 'text-right',
582 582
 		),
583 583
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
 	);
590 590
 
591
-    return apply_filters( 'wpinv_user_invoices_columns', $columns, $post_type );
591
+    return apply_filters('wpinv_user_invoices_columns', $columns, $post_type);
592 592
 }
593 593
 
594 594
 /**
@@ -598,59 +598,59 @@  discard block
 block discarded – undo
598 598
 
599 599
     // Find the invoice.
600 600
     $invoice_id = getpaid_get_current_invoice_id();
601
-    $invoice = new WPInv_Invoice( $invoice_id );
601
+    $invoice = new WPInv_Invoice($invoice_id);
602 602
 
603 603
     // Abort if non was found.
604
-    if ( empty( $invoice_id ) || $invoice->is_draft() ) {
604
+    if (empty($invoice_id) || $invoice->is_draft()) {
605 605
 
606 606
         return aui()->alert(
607 607
             array(
608 608
                 'type'    => 'warning',
609
-                'content' => __( 'We could not find your invoice', 'invoicing' ),
609
+                'content' => __('We could not find your invoice', 'invoicing'),
610 610
             )
611 611
         );
612 612
 
613 613
     }
614 614
 
615 615
     // Can the user view this invoice?
616
-    if ( ! wpinv_can_view_receipt( $invoice_id ) ) {
616
+    if (!wpinv_can_view_receipt($invoice_id)) {
617 617
 
618 618
         return aui()->alert(
619 619
             array(
620 620
                 'type'    => 'warning',
621
-                'content' => __( 'You are not allowed to view this receipt', 'invoicing' ),
621
+                'content' => __('You are not allowed to view this receipt', 'invoicing'),
622 622
             )
623 623
         );
624 624
 
625 625
     }
626 626
 
627 627
     // Load the template.
628
-    return wpinv_get_template_html( 'invoice-receipt.php', compact( 'invoice' ) );
628
+    return wpinv_get_template_html('invoice-receipt.php', compact('invoice'));
629 629
 
630 630
 }
631 631
 
632 632
 /**
633 633
  * Displays the invoice history.
634 634
  */
635
-function getpaid_invoice_history( $user_id = 0, $post_type = 'wpi_invoice' ) {
635
+function getpaid_invoice_history($user_id = 0, $post_type = 'wpi_invoice') {
636 636
 
637 637
     // Ensure that we have a user id.
638
-    if ( empty( $user_id ) || ! is_numeric( $user_id ) ) {
638
+    if (empty($user_id) || !is_numeric($user_id)) {
639 639
         $user_id = get_current_user_id();
640 640
     }
641 641
 
642
-    $label = getpaid_get_post_type_label( $post_type );
643
-    $label = empty( $label ) ? __( 'Invoices', 'invoicing' ) : sanitize_text_field( $label );
642
+    $label = getpaid_get_post_type_label($post_type);
643
+    $label = empty($label) ? __('Invoices', 'invoicing') : sanitize_text_field($label);
644 644
 
645 645
     // View user id.
646
-    if ( empty( $user_id ) ) {
646
+    if (empty($user_id)) {
647 647
 
648 648
         return aui()->alert(
649 649
             array(
650 650
                 'type'    => 'warning',
651 651
                 'content' => sprintf(
652
-                    __( 'You must be logged in to view your %s.', 'invoicing' ),
653
-                    strtolower( $label )
652
+                    __('You must be logged in to view your %s.', 'invoicing'),
653
+                    strtolower($label)
654 654
                 ),
655 655
             )
656 656
         );
@@ -660,22 +660,22 @@  discard block
 block discarded – undo
660 660
     // Fetch invoices.
661 661
     $invoices = wpinv_get_invoices(
662 662
         array(
663
-            'page'     => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
663
+            'page'     => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1,
664 664
             'user'     => $user_id,
665 665
             'paginate' => true,
666 666
             'type'     => $post_type,
667
-            'status'   => array_keys( wpinv_get_invoice_statuses( false, false, $post_type ) ),
667
+            'status'   => array_keys(wpinv_get_invoice_statuses(false, false, $post_type)),
668 668
         )
669 669
     );
670 670
 
671
-    if ( empty( $invoices->total ) ) {
671
+    if (empty($invoices->total)) {
672 672
 
673 673
         return aui()->alert(
674 674
             array(
675 675
                 'type'    => 'info',
676 676
                 'content' => sprintf(
677
-                    __( 'No %s found.', 'invoicing' ),
678
-                    strtolower( $label )
677
+                    __('No %s found.', 'invoicing'),
678
+                    strtolower($label)
679 679
                 ),
680 680
             )
681 681
         );
@@ -683,38 +683,38 @@  discard block
 block discarded – undo
683 683
     }
684 684
 
685 685
     // Load the template.
686
-    return wpinv_get_template_html( 'invoice-history.php', compact( 'invoices', 'post_type' ) );
686
+    return wpinv_get_template_html('invoice-history.php', compact('invoices', 'post_type'));
687 687
 
688 688
 }
689 689
 
690 690
 /**
691 691
  * Formats an invoice number given an invoice type.
692 692
  */
693
-function wpinv_format_invoice_number( $number, $type = '' ) {
693
+function wpinv_format_invoice_number($number, $type = '') {
694 694
 
695 695
     // Allow other plugins to overide this.
696
-    $check = apply_filters( 'wpinv_pre_format_invoice_number', null, $number, $type );
697
-    if ( null !== $check ) {
696
+    $check = apply_filters('wpinv_pre_format_invoice_number', null, $number, $type);
697
+    if (null !== $check) {
698 698
         return $check;
699 699
     }
700 700
 
701 701
     // Ensure that we have a numeric number.
702
-    if ( ! is_numeric( $number ) ) {
702
+    if (!is_numeric($number)) {
703 703
         return $number;
704 704
     }
705 705
 
706 706
     // Format the number.
707
-    $padd             = absint( (int) wpinv_get_option( 'invoice_number_padd', 5 ) );
708
-    $prefix           = sanitize_text_field( (string) wpinv_get_option( 'invoice_number_prefix', 'INV-' ) );
709
-    $prefix           = sanitize_text_field( apply_filters( 'getpaid_invoice_type_prefix', $prefix, $type ) );
710
-    $postfix          = sanitize_text_field( (string) wpinv_get_option( 'invoice_number_postfix' ) );
711
-    $postfix          = sanitize_text_field( apply_filters( 'getpaid_invoice_type_postfix', $postfix, $type ) );
712
-    $formatted_number = zeroise( absint( $number ), $padd );
707
+    $padd             = absint((int) wpinv_get_option('invoice_number_padd', 5));
708
+    $prefix           = sanitize_text_field((string) wpinv_get_option('invoice_number_prefix', 'INV-'));
709
+    $prefix           = sanitize_text_field(apply_filters('getpaid_invoice_type_prefix', $prefix, $type));
710
+    $postfix          = sanitize_text_field((string) wpinv_get_option('invoice_number_postfix'));
711
+    $postfix          = sanitize_text_field(apply_filters('getpaid_invoice_type_postfix', $postfix, $type));
712
+    $formatted_number = zeroise(absint($number), $padd);
713 713
 
714 714
     // Add the prefix and post fix.
715 715
     $formatted_number = $prefix . $formatted_number . $postfix;
716 716
 
717
-    return apply_filters( 'wpinv_format_invoice_number', $formatted_number, $number, $prefix, $postfix, $padd );
717
+    return apply_filters('wpinv_format_invoice_number', $formatted_number, $number, $prefix, $postfix, $padd);
718 718
 }
719 719
 
720 720
 /**
@@ -723,58 +723,58 @@  discard block
 block discarded – undo
723 723
  * @param string $type.
724 724
  * @return int|null|bool
725 725
  */
726
-function wpinv_get_next_invoice_number( $type = '' ) {
726
+function wpinv_get_next_invoice_number($type = '') {
727 727
 
728 728
     // Allow plugins to overide this.
729
-    $check = apply_filters( 'wpinv_get_pre_next_invoice_number', null, $type );
730
-    if ( null !== $check ) {
729
+    $check = apply_filters('wpinv_get_pre_next_invoice_number', null, $type);
730
+    if (null !== $check) {
731 731
         return $check;
732 732
     }
733 733
 
734 734
     // Ensure sequential invoice numbers is active.
735
-    if ( ! wpinv_sequential_number_active() ) {
735
+    if (!wpinv_sequential_number_active()) {
736 736
         return false;
737 737
     }
738 738
 
739 739
     // Retrieve the current number and the start number.
740
-    $number = (int) get_option( 'wpinv_last_invoice_number', 0 );
741
-    $start  = absint( (int) wpinv_get_option( 'invoice_sequence_start', 1 ) );
740
+    $number = (int) get_option('wpinv_last_invoice_number', 0);
741
+    $start  = absint((int) wpinv_get_option('invoice_sequence_start', 1));
742 742
 
743 743
     // Ensure that we are starting at a positive integer.
744
-    $start  = max( $start, 1 );
744
+    $start  = max($start, 1);
745 745
 
746 746
     // If this is the first invoice, use the start number.
747
-    $number = max( $start, $number );
747
+    $number = max($start, $number);
748 748
 
749 749
     // Format the invoice number.
750
-    $formatted_number = wpinv_format_invoice_number( $number, $type );
750
+    $formatted_number = wpinv_format_invoice_number($number, $type);
751 751
 
752 752
     // Ensure that this number is unique.
753
-    $invoice_id = WPInv_Invoice::get_invoice_id_by_field( $formatted_number, 'number' );
753
+    $invoice_id = WPInv_Invoice::get_invoice_id_by_field($formatted_number, 'number');
754 754
 
755 755
     // We found a match. Nice.
756
-    if ( empty( $invoice_id ) ) {
757
-        update_option( 'wpinv_last_invoice_number', $number );
758
-        return apply_filters( 'wpinv_get_next_invoice_number', $number );
756
+    if (empty($invoice_id)) {
757
+        update_option('wpinv_last_invoice_number', $number);
758
+        return apply_filters('wpinv_get_next_invoice_number', $number);
759 759
     }
760 760
 
761
-    update_option( 'wpinv_last_invoice_number', $number + 1 );
762
-    return wpinv_get_next_invoice_number( $type );
761
+    update_option('wpinv_last_invoice_number', $number + 1);
762
+    return wpinv_get_next_invoice_number($type);
763 763
 
764 764
 }
765 765
 
766 766
 /**
767 767
  * The prefix used for invoice paths.
768 768
  */
769
-function wpinv_post_name_prefix( $post_type = 'wpi_invoice' ) {
770
-    return apply_filters( 'wpinv_post_name_prefix', 'inv-', $post_type );
769
+function wpinv_post_name_prefix($post_type = 'wpi_invoice') {
770
+    return apply_filters('wpinv_post_name_prefix', 'inv-', $post_type);
771 771
 }
772 772
 
773
-function wpinv_generate_post_name( $post_ID ) {
774
-    $prefix = wpinv_post_name_prefix( get_post_type( $post_ID ) );
775
-    $post_name = sanitize_title( $prefix . $post_ID );
773
+function wpinv_generate_post_name($post_ID) {
774
+    $prefix = wpinv_post_name_prefix(get_post_type($post_ID));
775
+    $post_name = sanitize_title($prefix . $post_ID);
776 776
 
777
-    return apply_filters( 'wpinv_generate_post_name', $post_name, $post_ID, $prefix );
777
+    return apply_filters('wpinv_generate_post_name', $post_name, $post_ID, $prefix);
778 778
 }
779 779
 
780 780
 /**
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
  *
783 783
  * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object.
784 784
  */
785
-function wpinv_is_invoice_viewed( $invoice ) {
786
-    $invoice = new WPInv_Invoice( $invoice );
785
+function wpinv_is_invoice_viewed($invoice) {
786
+    $invoice = new WPInv_Invoice($invoice);
787 787
     return (bool) $invoice->get_is_viewed();
788 788
 }
789 789
 
@@ -792,17 +792,17 @@  discard block
 block discarded – undo
792 792
  *
793 793
  * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object.
794 794
  */
795
-function getpaid_maybe_mark_invoice_as_viewed( $invoice ) {
796
-    $invoice = new WPInv_Invoice( $invoice );
795
+function getpaid_maybe_mark_invoice_as_viewed($invoice) {
796
+    $invoice = new WPInv_Invoice($invoice);
797 797
 
798
-    if ( get_current_user_id() == $invoice->get_user_id() && ! $invoice->get_is_viewed() ) {
799
-        $invoice->set_is_viewed( true );
798
+    if (get_current_user_id() == $invoice->get_user_id() && !$invoice->get_is_viewed()) {
799
+        $invoice->set_is_viewed(true);
800 800
         $invoice->save();
801 801
     }
802 802
 
803 803
 }
804
-add_action( 'wpinv_invoice_print_before_display', 'getpaid_maybe_mark_invoice_as_viewed' );
805
-add_action( 'wpinv_before_receipt', 'getpaid_maybe_mark_invoice_as_viewed' );
804
+add_action('wpinv_invoice_print_before_display', 'getpaid_maybe_mark_invoice_as_viewed');
805
+add_action('wpinv_before_receipt', 'getpaid_maybe_mark_invoice_as_viewed');
806 806
 
807 807
 /**
808 808
  * Processes an invoice refund.
@@ -811,26 +811,26 @@  discard block
 block discarded – undo
811 811
  * @param array $status_transition
812 812
  * @todo: descrease customer/store earnings
813 813
  */
814
-function getpaid_maybe_process_refund( $invoice, $status_transition ) {
814
+function getpaid_maybe_process_refund($invoice, $status_transition) {
815 815
 
816
-    if ( empty( $status_transition['from'] ) || ! in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ) ) ) {
816
+    if (empty($status_transition['from']) || !in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'))) {
817 817
         return;
818 818
     }
819 819
 
820 820
     $discount_code = $invoice->get_discount_code();
821
-    if ( ! empty( $discount_code ) ) {
822
-        $discount = wpinv_get_discount_obj( $discount_code );
821
+    if (!empty($discount_code)) {
822
+        $discount = wpinv_get_discount_obj($discount_code);
823 823
 
824
-        if ( $discount->exists() ) {
824
+        if ($discount->exists()) {
825 825
             $discount->increase_usage( -1 );
826 826
         }
827 827
 }
828 828
 
829
-    do_action( 'wpinv_pre_refund_invoice', $invoice, $invoice->get_id() );
830
-    do_action( 'wpinv_refund_invoice', $invoice, $invoice->get_id() );
831
-    do_action( 'wpinv_post_refund_invoice', $invoice, $invoice->get_id() );
829
+    do_action('wpinv_pre_refund_invoice', $invoice, $invoice->get_id());
830
+    do_action('wpinv_refund_invoice', $invoice, $invoice->get_id());
831
+    do_action('wpinv_post_refund_invoice', $invoice, $invoice->get_id());
832 832
 }
833
-add_action( 'getpaid_invoice_status_wpi-refunded', 'getpaid_maybe_process_refund', 10, 2 );
833
+add_action('getpaid_invoice_status_wpi-refunded', 'getpaid_maybe_process_refund', 10, 2);
834 834
 
835 835
 
836 836
 /**
@@ -838,47 +838,47 @@  discard block
 block discarded – undo
838 838
  *
839 839
  * @param int $invoice_id
840 840
  */
841
-function getpaid_process_invoice_payment( $invoice_id ) {
841
+function getpaid_process_invoice_payment($invoice_id) {
842 842
 
843 843
     // Fetch the invoice.
844
-    $invoice = new WPInv_Invoice( $invoice_id );
844
+    $invoice = new WPInv_Invoice($invoice_id);
845 845
 
846 846
     // We only want to do this once.
847
-    if ( 1 == get_post_meta( $invoice->get_id(), 'wpinv_processed_payment', true ) ) {
847
+    if (1 == get_post_meta($invoice->get_id(), 'wpinv_processed_payment', true)) {
848 848
         return;
849 849
     }
850 850
 
851
-    update_post_meta( $invoice->get_id(), 'wpinv_processed_payment', 1 );
851
+    update_post_meta($invoice->get_id(), 'wpinv_processed_payment', 1);
852 852
 
853 853
     // Fires when processing a payment.
854
-    do_action( 'getpaid_process_payment', $invoice );
854
+    do_action('getpaid_process_payment', $invoice);
855 855
 
856 856
     // Fire an action for each invoice item.
857
-    foreach ( $invoice->get_items() as $item ) {
858
-        do_action( 'getpaid_process_item_payment', $item, $invoice );
857
+    foreach ($invoice->get_items() as $item) {
858
+        do_action('getpaid_process_item_payment', $item, $invoice);
859 859
     }
860 860
 
861 861
     // Increase discount usage.
862 862
     $discount_code = $invoice->get_discount_code();
863
-    if ( ! empty( $discount_code ) && ! $invoice->is_renewal() ) {
864
-        $discount = wpinv_get_discount_obj( $discount_code );
863
+    if (!empty($discount_code) && !$invoice->is_renewal()) {
864
+        $discount = wpinv_get_discount_obj($discount_code);
865 865
 
866
-        if ( $discount->exists() ) {
866
+        if ($discount->exists()) {
867 867
             $discount->increase_usage();
868 868
         }
869 869
 }
870 870
 
871 871
     // Record reverse vat.
872
-    if ( 'invoice' === $invoice->get_type() && wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
872
+    if ('invoice' === $invoice->get_type() && wpinv_use_taxes() && !$invoice->get_disable_taxes()) {
873 873
 
874 874
         $taxes = $invoice->get_total_tax();
875
-        if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
876
-            $invoice->add_note( __( 'VAT was reverse charged', 'invoicing' ), false, false, true );
875
+        if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) {
876
+            $invoice->add_note(__('VAT was reverse charged', 'invoicing'), false, false, true);
877 877
         }
878 878
 }
879 879
 
880 880
 }
881
-add_action( 'getpaid_invoice_payment_status_changed', 'getpaid_process_invoice_payment' );
881
+add_action('getpaid_invoice_payment_status_changed', 'getpaid_process_invoice_payment');
882 882
 
883 883
 /**
884 884
  * Returns an array of invoice item columns
@@ -886,13 +886,13 @@  discard block
 block discarded – undo
886 886
  * @param int|WPInv_Invoice $invoice
887 887
  * @return array
888 888
  */
889
-function getpaid_invoice_item_columns( $invoice ) {
889
+function getpaid_invoice_item_columns($invoice) {
890 890
 
891 891
     // Prepare the invoice.
892
-    $invoice = new WPInv_Invoice( $invoice );
892
+    $invoice = new WPInv_Invoice($invoice);
893 893
 
894 894
     // Abort if there is no invoice.
895
-    if ( 0 == $invoice->get_id() ) {
895
+    if (0 == $invoice->get_id()) {
896 896
         return array();
897 897
     }
898 898
 
@@ -900,52 +900,52 @@  discard block
 block discarded – undo
900 900
     $columns = apply_filters(
901 901
         'getpaid_invoice_item_columns',
902 902
         array(
903
-            'name'     => __( 'Item', 'invoicing' ),
904
-            'price'    => __( 'Price', 'invoicing' ),
905
-            'tax_rate' => __( 'Tax Rate', 'invoicing' ),
906
-            'quantity' => __( 'Quantity', 'invoicing' ),
907
-            'subtotal' => __( 'Item Subtotal', 'invoicing' ),
903
+            'name'     => __('Item', 'invoicing'),
904
+            'price'    => __('Price', 'invoicing'),
905
+            'tax_rate' => __('Tax Rate', 'invoicing'),
906
+            'quantity' => __('Quantity', 'invoicing'),
907
+            'subtotal' => __('Item Subtotal', 'invoicing'),
908 908
         ),
909 909
         $invoice
910 910
     );
911 911
 
912 912
     // Quantities.
913
-    if ( isset( $columns['quantity'] ) ) {
913
+    if (isset($columns['quantity'])) {
914 914
 
915
-        if ( 'hours' == $invoice->get_template() ) {
916
-            $columns['quantity'] = __( 'Hours', 'invoicing' );
915
+        if ('hours' == $invoice->get_template()) {
916
+            $columns['quantity'] = __('Hours', 'invoicing');
917 917
         }
918 918
 
919
-        if ( ! wpinv_item_quantities_enabled() || 'amount' == $invoice->get_template() ) {
920
-            unset( $columns['quantity'] );
919
+        if (!wpinv_item_quantities_enabled() || 'amount' == $invoice->get_template()) {
920
+            unset($columns['quantity']);
921 921
         }
922 922
     }
923 923
 
924 924
     // Price.
925
-    if ( isset( $columns['price'] ) ) {
925
+    if (isset($columns['price'])) {
926 926
 
927
-        if ( 'amount' == $invoice->get_template() ) {
928
-            $columns['price'] = __( 'Amount', 'invoicing' );
927
+        if ('amount' == $invoice->get_template()) {
928
+            $columns['price'] = __('Amount', 'invoicing');
929 929
         }
930 930
 
931
-        if ( 'hours' == $invoice->get_template() ) {
932
-            $columns['price'] = __( 'Rate', 'invoicing' );
931
+        if ('hours' == $invoice->get_template()) {
932
+            $columns['price'] = __('Rate', 'invoicing');
933 933
         }
934 934
 }
935 935
 
936 936
     // Sub total.
937
-    if ( isset( $columns['subtotal'] ) ) {
937
+    if (isset($columns['subtotal'])) {
938 938
 
939
-        if ( 'amount' == $invoice->get_template() ) {
940
-            unset( $columns['subtotal'] );
939
+        if ('amount' == $invoice->get_template()) {
940
+            unset($columns['subtotal']);
941 941
         }
942 942
 }
943 943
 
944 944
     // Tax rates.
945
-    if ( isset( $columns['tax_rate'] ) ) {
945
+    if (isset($columns['tax_rate'])) {
946 946
 
947
-        if ( 0 == $invoice->get_total_tax() ) {
948
-            unset( $columns['tax_rate'] );
947
+        if (0 == $invoice->get_total_tax()) {
948
+            unset($columns['tax_rate']);
949 949
         }
950 950
     }
951 951
 
@@ -958,53 +958,53 @@  discard block
 block discarded – undo
958 958
  * @param int|WPInv_Invoice $invoice
959 959
  * @return array
960 960
  */
961
-function getpaid_invoice_totals_rows( $invoice ) {
961
+function getpaid_invoice_totals_rows($invoice) {
962 962
 
963 963
     // Prepare the invoice.
964
-    $invoice = new WPInv_Invoice( $invoice );
964
+    $invoice = new WPInv_Invoice($invoice);
965 965
 
966 966
     // Abort if there is no invoice.
967
-    if ( 0 == $invoice->get_id() ) {
967
+    if (0 == $invoice->get_id()) {
968 968
         return array();
969 969
     }
970 970
 
971 971
     $totals = apply_filters(
972 972
         'getpaid_invoice_totals_rows',
973 973
         array(
974
-            'subtotal' => __( 'Subtotal', 'invoicing' ),
975
-            'shipping' => __( 'Shipping', 'invoicing' ),
976
-            'tax'      => __( 'Tax', 'invoicing' ),
977
-            'fee'      => __( 'Fee', 'invoicing' ),
978
-            'discount' => __( 'Discount', 'invoicing' ),
979
-            'total'    => __( 'Total', 'invoicing' ),
974
+            'subtotal' => __('Subtotal', 'invoicing'),
975
+            'shipping' => __('Shipping', 'invoicing'),
976
+            'tax'      => __('Tax', 'invoicing'),
977
+            'fee'      => __('Fee', 'invoicing'),
978
+            'discount' => __('Discount', 'invoicing'),
979
+            'total'    => __('Total', 'invoicing'),
980 980
         ),
981 981
         $invoice
982 982
     );
983 983
 
984
-    if ( ! $invoice->has_shipping() ) {
985
-        unset( $totals['shipping'] );
984
+    if (!$invoice->has_shipping()) {
985
+        unset($totals['shipping']);
986 986
     }
987 987
 
988
-    if ( ( $invoice->get_disable_taxes() || ! wpinv_use_taxes() ) && isset( $totals['tax'] ) ) {
989
-        unset( $totals['tax'] );
988
+    if (($invoice->get_disable_taxes() || !wpinv_use_taxes()) && isset($totals['tax'])) {
989
+        unset($totals['tax']);
990 990
     }
991 991
 
992 992
     // If we have taxes, display individual taxes.
993
-    if ( isset( $totals['tax'] ) && wpinv_display_individual_tax_rates() ) {
993
+    if (isset($totals['tax']) && wpinv_display_individual_tax_rates()) {
994 994
 
995 995
         $new_totals = array();
996
-        foreach ( $totals as $key => $label ) {
996
+        foreach ($totals as $key => $label) {
997 997
 
998
-            if ( 'tax' !== $key ) {
999
-                $new_totals[ $key ] = $label;
998
+            if ('tax' !== $key) {
999
+                $new_totals[$key] = $label;
1000 1000
                 continue;
1001 1001
             }
1002 1002
 
1003
-            $taxes = array_keys( $invoice->get_taxes() );
1004
-            if ( ! empty( $taxes ) ) {
1003
+            $taxes = array_keys($invoice->get_taxes());
1004
+            if (!empty($taxes)) {
1005 1005
 
1006
-                foreach ( $taxes as $tax ) {
1007
-                    $new_totals[ 'tax__' . $tax ] = $tax;
1006
+                foreach ($taxes as $tax) {
1007
+                    $new_totals['tax__' . $tax] = $tax;
1008 1008
                 }
1009 1009
             }
1010 1010
         }
@@ -1012,12 +1012,12 @@  discard block
 block discarded – undo
1012 1012
         $totals = $new_totals;
1013 1013
     }
1014 1014
 
1015
-    if ( 0 == $invoice->get_total_fees() && isset( $totals['fee'] ) ) {
1016
-        unset( $totals['fee'] );
1015
+    if (0 == $invoice->get_total_fees() && isset($totals['fee'])) {
1016
+        unset($totals['fee']);
1017 1017
     }
1018 1018
 
1019
-    if ( 0 == $invoice->get_total_discount() && isset( $totals['discount'] ) ) {
1020
-        unset( $totals['discount'] );
1019
+    if (0 == $invoice->get_total_discount() && isset($totals['discount'])) {
1020
+        unset($totals['discount']);
1021 1021
     }
1022 1022
 
1023 1023
     return $totals;
@@ -1028,47 +1028,47 @@  discard block
 block discarded – undo
1028 1028
  *
1029 1029
  * @param WPInv_Invoice $invoice
1030 1030
  */
1031
-function getpaid_new_invoice( $invoice ) {
1031
+function getpaid_new_invoice($invoice) {
1032 1032
 
1033
-    if ( ! $invoice->get_status() ) {
1033
+    if (!$invoice->get_status()) {
1034 1034
         return;
1035 1035
     }
1036 1036
 
1037 1037
     // Add an invoice created note.
1038 1038
     $invoice->add_note(
1039 1039
         sprintf(
1040
-            __( '%1$s created with the status "%2$s".', 'invoicing' ),
1041
-            ucfirst( $invoice->get_invoice_quote_type() ),
1042
-            wpinv_status_nicename( $invoice->get_status(), $invoice )
1040
+            __('%1$s created with the status "%2$s".', 'invoicing'),
1041
+            ucfirst($invoice->get_invoice_quote_type()),
1042
+            wpinv_status_nicename($invoice->get_status(), $invoice)
1043 1043
         )
1044 1044
     );
1045 1045
 
1046 1046
 }
1047
-add_action( 'getpaid_new_invoice', 'getpaid_new_invoice' );
1047
+add_action('getpaid_new_invoice', 'getpaid_new_invoice');
1048 1048
 
1049 1049
 /**
1050 1050
  * This function updates invoice caches.
1051 1051
  *
1052 1052
  * @param WPInv_Invoice $invoice
1053 1053
  */
1054
-function getpaid_update_invoice_caches( $invoice ) {
1054
+function getpaid_update_invoice_caches($invoice) {
1055 1055
 
1056 1056
     // Cache invoice number.
1057
-    wp_cache_set( $invoice->get_number(), $invoice->get_id(), 'getpaid_invoice_numbers_to_invoice_ids' );
1057
+    wp_cache_set($invoice->get_number(), $invoice->get_id(), 'getpaid_invoice_numbers_to_invoice_ids');
1058 1058
 
1059 1059
     // Cache invoice key.
1060
-    wp_cache_set( $invoice->get_key(), $invoice->get_id(), 'getpaid_invoice_keys_to_invoice_ids' );
1060
+    wp_cache_set($invoice->get_key(), $invoice->get_id(), 'getpaid_invoice_keys_to_invoice_ids');
1061 1061
 
1062 1062
     // (Maybe) cache transaction id.
1063 1063
     $transaction_id = $invoice->get_transaction_id();
1064 1064
 
1065
-    if ( ! empty( $transaction_id ) ) {
1066
-        wp_cache_set( $transaction_id, $invoice->get_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
1065
+    if (!empty($transaction_id)) {
1066
+        wp_cache_set($transaction_id, $invoice->get_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
1067 1067
     }
1068 1068
 
1069 1069
 }
1070
-add_action( 'getpaid_new_invoice', 'getpaid_update_invoice_caches', 5 );
1071
-add_action( 'getpaid_update_invoice', 'getpaid_update_invoice_caches', 5 );
1070
+add_action('getpaid_new_invoice', 'getpaid_update_invoice_caches', 5);
1071
+add_action('getpaid_update_invoice', 'getpaid_update_invoice_caches', 5);
1072 1072
 
1073 1073
 /**
1074 1074
  * Duplicates an invoice.
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
  * @param  WPInv_Invoice $old_invoice The invoice to duplicate
1079 1079
  * @return WPInv_Invoice The new invoice.
1080 1080
  */
1081
-function getpaid_duplicate_invoice( $old_invoice ) {
1081
+function getpaid_duplicate_invoice($old_invoice) {
1082 1082
 
1083 1083
     // Create the new invoice.
1084 1084
     $invoice = new WPInv_Invoice();
@@ -1138,136 +1138,136 @@  discard block
 block discarded – undo
1138 1138
  * @param WPInv_Invoice $invoice
1139 1139
  * @return array
1140 1140
  */
1141
-function getpaid_get_invoice_meta( $invoice ) {
1141
+function getpaid_get_invoice_meta($invoice) {
1142 1142
 
1143 1143
     // Load the invoice meta.
1144 1144
     $meta = array(
1145 1145
 
1146 1146
         'number'         => array(
1147 1147
             'label' => sprintf(
1148
-                __( '%s Number', 'invoicing' ),
1149
-                ucfirst( $invoice->get_invoice_quote_type() )
1148
+                __('%s Number', 'invoicing'),
1149
+                ucfirst($invoice->get_invoice_quote_type())
1150 1150
             ),
1151
-            'value' => sanitize_text_field( $invoice->get_number() ),
1151
+            'value' => sanitize_text_field($invoice->get_number()),
1152 1152
         ),
1153 1153
 
1154 1154
         'status'         => array(
1155 1155
             'label' => sprintf(
1156
-                __( '%s Status', 'invoicing' ),
1157
-                ucfirst( $invoice->get_invoice_quote_type() )
1156
+                __('%s Status', 'invoicing'),
1157
+                ucfirst($invoice->get_invoice_quote_type())
1158 1158
             ),
1159 1159
             'value' => $invoice->get_status_label_html(),
1160 1160
         ),
1161 1161
 
1162 1162
         'date'           => array(
1163 1163
             'label' => sprintf(
1164
-                __( '%s Date', 'invoicing' ),
1165
-                ucfirst( $invoice->get_invoice_quote_type() )
1164
+                __('%s Date', 'invoicing'),
1165
+                ucfirst($invoice->get_invoice_quote_type())
1166 1166
             ),
1167
-            'value' => getpaid_format_date( $invoice->get_created_date() ),
1167
+            'value' => getpaid_format_date($invoice->get_created_date()),
1168 1168
         ),
1169 1169
 
1170 1170
         'date_paid'      => array(
1171
-            'label' => __( 'Paid On', 'invoicing' ),
1172
-            'value' => getpaid_format_date( $invoice->get_completed_date() ),
1171
+            'label' => __('Paid On', 'invoicing'),
1172
+            'value' => getpaid_format_date($invoice->get_completed_date()),
1173 1173
         ),
1174 1174
 
1175 1175
         'gateway'        => array(
1176
-            'label' => __( 'Payment Method', 'invoicing' ),
1177
-            'value' => sanitize_text_field( $invoice->get_gateway_title() ),
1176
+            'label' => __('Payment Method', 'invoicing'),
1177
+            'value' => sanitize_text_field($invoice->get_gateway_title()),
1178 1178
         ),
1179 1179
 
1180 1180
         'transaction_id' => array(
1181
-            'label' => __( 'Transaction ID', 'invoicing' ),
1182
-            'value' => sanitize_text_field( $invoice->get_transaction_id() ),
1181
+            'label' => __('Transaction ID', 'invoicing'),
1182
+            'value' => sanitize_text_field($invoice->get_transaction_id()),
1183 1183
         ),
1184 1184
 
1185 1185
         'due_date'       => array(
1186
-            'label' => __( 'Due Date', 'invoicing' ),
1187
-            'value' => getpaid_format_date( $invoice->get_due_date() ),
1186
+            'label' => __('Due Date', 'invoicing'),
1187
+            'value' => getpaid_format_date($invoice->get_due_date()),
1188 1188
         ),
1189 1189
 
1190 1190
         'vat_number'     => array(
1191
-            'label' => __( 'VAT Number', 'invoicing' ),
1192
-            'value' => sanitize_text_field( $invoice->get_vat_number() ),
1191
+            'label' => __('VAT Number', 'invoicing'),
1192
+            'value' => sanitize_text_field($invoice->get_vat_number()),
1193 1193
         ),
1194 1194
 
1195 1195
     );
1196 1196
 
1197
-    $additional_meta = get_post_meta( $invoice->get_id(), 'additional_meta_data', true );
1197
+    $additional_meta = get_post_meta($invoice->get_id(), 'additional_meta_data', true);
1198 1198
 
1199
-    if ( ! empty( $additional_meta ) ) {
1199
+    if (!empty($additional_meta)) {
1200 1200
 
1201
-        foreach ( $additional_meta as $label => $value ) {
1202
-            $meta[ sanitize_key( $label ) ] = array(
1203
-                'label' => esc_html( $label ),
1204
-                'value' => esc_html( $value ),
1201
+        foreach ($additional_meta as $label => $value) {
1202
+            $meta[sanitize_key($label)] = array(
1203
+                'label' => esc_html($label),
1204
+                'value' => esc_html($value),
1205 1205
             );
1206 1206
         }
1207 1207
 }
1208 1208
     // If it is not paid, remove the date of payment.
1209
-    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
1210
-        unset( $meta['date_paid'] );
1211
-        unset( $meta['transaction_id'] );
1209
+    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
1210
+        unset($meta['date_paid']);
1211
+        unset($meta['transaction_id']);
1212 1212
     }
1213 1213
 
1214
-    if ( ! $invoice->is_paid() || 'none' == $invoice->get_gateway() ) {
1215
-        unset( $meta['gateway'] );
1214
+    if (!$invoice->is_paid() || 'none' == $invoice->get_gateway()) {
1215
+        unset($meta['gateway']);
1216 1216
     }
1217 1217
 
1218 1218
     // Only display the due date if due dates are enabled.
1219
-    if ( ! $invoice->needs_payment() || ! wpinv_get_option( 'overdue_active' ) ) {
1220
-        unset( $meta['due_date'] );
1219
+    if (!$invoice->needs_payment() || !wpinv_get_option('overdue_active')) {
1220
+        unset($meta['due_date']);
1221 1221
     }
1222 1222
 
1223 1223
     // Only display the vat number if taxes are enabled.
1224
-    if ( ! wpinv_use_taxes() ) {
1225
-        unset( $meta['vat_number'] );
1224
+    if (!wpinv_use_taxes()) {
1225
+        unset($meta['vat_number']);
1226 1226
     }
1227 1227
 
1228 1228
     // Link to the parent invoice.
1229
-    if ( $invoice->get_parent_id() > 0 ) {
1229
+    if ($invoice->get_parent_id() > 0) {
1230 1230
 
1231 1231
         $meta['parent'] = array(
1232 1232
 
1233 1233
             'label' => sprintf(
1234
-                __( 'Parent %s', 'invoicing' ),
1235
-                ucfirst( $invoice->get_invoice_quote_type() )
1234
+                __('Parent %s', 'invoicing'),
1235
+                ucfirst($invoice->get_invoice_quote_type())
1236 1236
             ),
1237 1237
 
1238
-            'value' => wpinv_invoice_link( $invoice->get_parent_id() ),
1238
+            'value' => wpinv_invoice_link($invoice->get_parent_id()),
1239 1239
 
1240 1240
         );
1241 1241
 
1242 1242
     }
1243 1243
 
1244
-    if ( $invoice->is_recurring() ) {
1244
+    if ($invoice->is_recurring()) {
1245 1245
 
1246
-        $subscription = getpaid_get_invoice_subscriptions( $invoice );
1247
-        if ( ! empty( $subscription ) && ! is_array( $subscription ) && $subscription->exists() ) {
1246
+        $subscription = getpaid_get_invoice_subscriptions($invoice);
1247
+        if (!empty($subscription) && !is_array($subscription) && $subscription->exists()) {
1248 1248
 
1249 1249
             // Display the renewal date.
1250
-            if ( $subscription->is_active() && 'cancelled' != $subscription->get_status() ) {
1250
+            if ($subscription->is_active() && 'cancelled' != $subscription->get_status()) {
1251 1251
 
1252 1252
                 $meta['renewal_date'] = array(
1253
-                    'label' => __( 'Renews On', 'invoicing' ),
1254
-                    'value' => getpaid_format_date( $subscription->get_expiration() ) .
1253
+                    'label' => __('Renews On', 'invoicing'),
1254
+                    'value' => getpaid_format_date($subscription->get_expiration()) .
1255 1255
                     sprintf(
1256 1256
                         ' <a class="small" href="%s">%s<a>',
1257 1257
                         $subscription->get_view_url(),
1258
-                        __( '(View Subscription)', 'invoicing' )
1258
+                        __('(View Subscription)', 'invoicing')
1259 1259
                     ),
1260 1260
                 );
1261 1261
 
1262 1262
             }
1263 1263
 
1264
-            if ( $invoice->is_parent() ) {
1264
+            if ($invoice->is_parent()) {
1265 1265
 
1266 1266
                 // Display the recurring amount.
1267 1267
                 $meta['recurring_total'] = array(
1268 1268
 
1269
-                    'label' => __( 'Recurring Amount', 'invoicing' ),
1270
-                    'value' => wpinv_price( $subscription->get_recurring_amount(), $invoice->get_currency() ),
1269
+                    'label' => __('Recurring Amount', 'invoicing'),
1270
+                    'value' => wpinv_price($subscription->get_recurring_amount(), $invoice->get_currency()),
1271 1271
 
1272 1272
                 );
1273 1273
 
@@ -1278,13 +1278,13 @@  discard block
 block discarded – undo
1278 1278
     // Add the invoice total to the meta.
1279 1279
     $meta['invoice_total'] = array(
1280 1280
 
1281
-        'label' => __( 'Total Amount', 'invoicing' ),
1282
-        'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
1281
+        'label' => __('Total Amount', 'invoicing'),
1282
+        'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
1283 1283
 
1284 1284
     );
1285 1285
 
1286 1286
     // Provide a way for third party plugins to filter the meta.
1287
-    $meta = apply_filters( 'getpaid_invoice_meta_data', $meta, $invoice );
1287
+    $meta = apply_filters('getpaid_invoice_meta_data', $meta, $invoice);
1288 1288
 
1289 1289
     return $meta;
1290 1290
 
@@ -1323,12 +1323,12 @@  discard block
 block discarded – undo
1323 1323
  * @param GetPaid_Form_Item $item
1324 1324
  * @return float
1325 1325
  */
1326
-function getpaid_get_invoice_tax_rate( $invoice, $item ) {
1326
+function getpaid_get_invoice_tax_rate($invoice, $item) {
1327 1327
 
1328
-    $rates   = getpaid_get_item_tax_rates( $item, $invoice->get_country(), $invoice->get_state() );
1329
-	$rates   = getpaid_filter_item_tax_rates( $item, $rates );
1330
-    $rates   = wp_list_pluck( $rates, 'rate' );
1328
+    $rates   = getpaid_get_item_tax_rates($item, $invoice->get_country(), $invoice->get_state());
1329
+	$rates = getpaid_filter_item_tax_rates($item, $rates);
1330
+    $rates   = wp_list_pluck($rates, 'rate');
1331 1331
 
1332
-    return array_sum( $rates );
1332
+    return array_sum($rates);
1333 1333
 
1334 1334
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 4 patches
Braces   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			if(!empty($this->options['nested-block'])){
61 61
 				if(empty($this->options['output_types'])){
62 62
 					$this->options['output_types'] = array('shortcode','block');
63
-				}elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
63
+				} elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64 64
 					unset($this->options['output_types'][$key]);
65 65
 				}
66 66
 			}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 				<?php
730 730
 				if(! empty( $insert_shortcode_function )){
731 731
 					echo $insert_shortcode_function;
732
-				}else{
732
+				} else{
733 733
 
734 734
 				/**
735 735
 				 * Function for super duper insert shortcode.
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 				$p_pl = 'ps-';
2304 2304
 				$p_pr = 'pe-';
2305 2305
 					<?php
2306
-				}else{
2306
+				} else{
2307 2307
 						?>
2308 2308
 				$aui_bs5 = false;
2309 2309
 				$p_ml = 'ml-';
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
 					var InnerBlocks = blockEditor.InnerBlocks;
2532 2532
 
2533 2533
 					var term_query_type = '';
2534
-					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 "[]";} ?>;
2534
+					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 "[]";} ?>;
2535 2535
 					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2536 2536
 					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2537 2537
 					const MediaUpload = wp.blockEditor.MediaUpload;
@@ -2588,9 +2588,9 @@  discard block
 block discarded – undo
2588 2588
 						$example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2589 2589
 						if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2590 2590
 							// no preview if set to false
2591
-						}elseif( !empty( $example_args ) ){
2591
+						} elseif( !empty( $example_args ) ){
2592 2592
 							echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2593
-						}elseif( !empty( $this->options['example'] ) ){
2593
+						} elseif( !empty( $this->options['example'] ) ){
2594 2594
 							unset($this->options['example']['viewportWidth']);
2595 2595
 							unset($this->options['example']['innerBlocks']);
2596 2596
 							$example_atts = $this->array_to_attributes( $this->options['example'] );
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 							if(!empty($example_parts)){
2608 2608
 								echo "example : {".implode(',', $example_parts)."},";
2609 2609
 							}
2610
-						}else{
2610
+						} else{
2611 2611
 							echo 'example : {viewportWidth: 500},';
2612 2612
 						}
2613 2613
 
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
 							<?php
2793 2793
 							if(!empty($this->options['block-edit-raw'])) {
2794 2794
 								echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2795
-							}else{
2795
+							} else{
2796 2796
 							?>
2797 2797
 
2798 2798
 function hasSelectedInnerBlock(props) {
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2928 2928
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2929 2929
 	echo 'const { deviceType } = "";';
2930
-}else{
2930
+} else{
2931 2931
 ?>
2932 2932
 /** Get device type const. */
2933 2933
 const wpVersion = '<?php global $wp_version; echo esc_attr($wp_version); ?>';
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2992 2992
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2993 2993
 										echo $post->ID;
2994
-									}else{echo '0';}?>,
2994
+									} else{echo '0';}?>,
2995 2995
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2996 2996
 									};
2997 2997
 
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
 										is_fetching = false;
3012 3012
 										prev_attributes[props.clientId] = props.attributes;
3013 3013
 											 <?php
3014
-										}else{
3014
+										} else{
3015 3015
 										?>
3016 3016
 										props.setAttributes({content: env});
3017 3017
 										is_fetching = false;
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
 //
3223 3223
 
3224 3224
 									}
3225
-									}else {
3225
+									} else {
3226 3226
 									?>
3227 3227
 									el(wp.components.PanelBody, {
3228 3228
 											title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>',
@@ -3248,9 +3248,9 @@  discard block
 block discarded – undo
3248 3248
 								// If the user sets block-output array then build it
3249 3249
 								if ( ! empty( $this->options['block-output'] ) ) {
3250 3250
 								$this->block_element( $this->options['block-output'] );
3251
-							}elseif(!empty($this->options['block-edit-return'])){
3251
+							} elseif(!empty($this->options['block-edit-return'])){
3252 3252
 								   echo $this->options['block-edit-return'];
3253
-							}else{
3253
+							} else{
3254 3254
 								// if no block-output is set then we try and get the shortcode html output via ajax.
3255 3255
 								$block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3256 3256
 								?>
@@ -3362,9 +3362,9 @@  discard block
 block discarded – undo
3362 3362
 							   );
3363 3363
 								<?php
3364 3364
 
3365
-							}elseif(!empty($this->options['block-save-return'])){
3365
+							} elseif(!empty($this->options['block-save-return'])){
3366 3366
 								   echo 'return ' . $this->options['block-save-return'];
3367
-							}elseif(!empty($this->options['nested-block'])){
3367
+							} elseif(!empty($this->options['nested-block'])){
3368 3368
 								?>
3369 3369
 							  return el(
3370 3370
 								   '',
@@ -3374,13 +3374,13 @@  discard block
 block discarded – undo
3374 3374
 								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3375 3375
 							   );
3376 3376
 								<?php
3377
-							}elseif(!empty( $this->options['block-save-return'] ) ){
3377
+							} elseif(!empty( $this->options['block-save-return'] ) ){
3378 3378
 								echo "return ". $this->options['block-edit-return'].";";
3379
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3379
+							} elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3380 3380
 							?>
3381 3381
 							return content;
3382 3382
 							<?php
3383
-							}else{
3383
+							} else{
3384 3384
 							?>
3385 3385
 							var block_wrap = 'div';
3386 3386
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -3431,9 +3431,9 @@  discard block
 block discarded – undo
3431 3431
 				$device_type_icon = '';
3432 3432
 				if($device_type=='Desktop'){
3433 3433
 					$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3434
-				}elseif($device_type=='Tablet'){
3434
+				} elseif($device_type=='Tablet'){
3435 3435
 					$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3436
-				}elseif($device_type=='Mobile'){
3436
+				} elseif($device_type=='Mobile'){
3437 3437
 					$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3438 3438
 				}
3439 3439
 				echo $element_require;
@@ -3478,7 +3478,7 @@  discard block
 block discarded – undo
3478 3478
 
3479 3479
 					<?php
3480 3480
 					if(false){?></script><?php }
3481
-				}elseif(!empty($args['row']['close'])){
3481
+				} elseif(!empty($args['row']['close'])){
3482 3482
 					if(false){?><script><?php }?>
3483 3483
 						el(
3484 3484
 							'div',
@@ -3487,7 +3487,7 @@  discard block
 block discarded – undo
3487 3487
 							},
3488 3488
 					<?php
3489 3489
 					if(false){?></script><?php }
3490
-				}else{
3490
+				} else{
3491 3491
 					if(false){?><script><?php }?>
3492 3492
 						el(
3493 3493
 							'div',
@@ -3592,9 +3592,9 @@  discard block
 block discarded – undo
3592 3592
 			$device_type_icon = '';
3593 3593
 			if($device_type=='Desktop'){
3594 3594
 				$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3595
-			}elseif($device_type=='Tablet'){
3595
+			} elseif($device_type=='Tablet'){
3596 3596
 				$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3597
-			}elseif($device_type=='Mobile'){
3597
+			} elseif($device_type=='Mobile'){
3598 3598
 				$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3599 3599
 			}
3600 3600
 
@@ -3657,7 +3657,7 @@  discard block
 block discarded – undo
3657 3657
 				$args['type'] == 'text';
3658 3658
 				// Save numbers as numbers and not strings
3659 3659
 				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3660
-			}else if ( $args['type'] == 'notice' ) {
3660
+			} else if ( $args['type'] == 'notice' ) {
3661 3661
 
3662 3662
 				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3663 3663
 				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
@@ -3732,7 +3732,7 @@  discard block
 block discarded – undo
3732 3732
 							$key: value
3733 3733
 						});
3734 3734
 					},";
3735
-			}elseif ( $args['type'] == 'gradient' ) {
3735
+			} elseif ( $args['type'] == 'gradient' ) {
3736 3736
 				$type = 'GradientPicker';
3737 3737
 				$extra .= "gradients: [{
3738 3738
 			name: 'Vivid cyan blue to vivid purple',
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
 			slug: 'cool-to-warm-spectrum',
3772 3772
 		}],";
3773 3773
 
3774
-			}elseif ( $args['type'] == 'image' ) {
3774
+			} elseif ( $args['type'] == 'image' ) {
3775 3775
 //                print_r($args);
3776 3776
 
3777 3777
 				$img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3908,8 +3908,7 @@  discard block
 block discarded – undo
3908 3908
 				$onchange = "";
3909 3909
 
3910 3910
 				//$inside_elements = ",el('div',{},'file upload')";
3911
-			}
3912
-			elseif ( $args['type'] == 'checkbox' ) {
3911
+			} elseif ( $args['type'] == 'checkbox' ) {
3913 3912
 				$type = 'CheckboxControl';
3914 3913
 				$extra .= "checked: props.attributes.$key,";
3915 3914
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
@@ -3921,9 +3920,9 @@  discard block
 block discarded – undo
3921 3920
 
3922 3921
 				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3923 3922
 					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3924
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3923
+				} elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3925 3924
 					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3926
-				}else {
3925
+				} else {
3927 3926
 
3928 3927
 					if ( ! empty( $args['options'] ) ) {
3929 3928
 						$options .= "options: [";
@@ -4087,7 +4086,7 @@  discard block
 block discarded – undo
4087 4086
 				foreach ( $custom_attributes as $key => $val ) {
4088 4087
 					if(is_array($val)){
4089 4088
 						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4090
-					}else{
4089
+					} else{
4091 4090
 						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4092 4091
 					}
4093 4092
 				}
@@ -4128,7 +4127,7 @@  discard block
 block discarded – undo
4128 4127
 
4129 4128
 							if($new_args['element']=='InnerBlocks'){
4130 4129
 								echo "\n el( InnerBlocks, {";
4131
-							}elseif($new_args['element']=='innerBlocksProps'){
4130
+							} elseif($new_args['element']=='innerBlocksProps'){
4132 4131
 								$element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4133 4132
 							  //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4134 4133
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
@@ -4141,11 +4140,11 @@  discard block
 block discarded – undo
4141 4140
 							//    echo '###';
4142 4141
 
4143 4142
 							  //  echo '###';
4144
-							}elseif($new_args['element']=='BlocksProps'){
4143
+							} elseif($new_args['element']=='BlocksProps'){
4145 4144
 
4146 4145
 								if ( isset($new_args['if_inner_element']) ) {
4147 4146
 									$element = $new_args['if_inner_element'];
4148
-								}else {
4147
+								} else {
4149 4148
 									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4150 4149
 								}
4151 4150
 
@@ -4156,7 +4155,7 @@  discard block
 block discarded – undo
4156 4155
 
4157 4156
 							   // echo "} ),";
4158 4157
 
4159
-							}else{
4158
+							} else{
4160 4159
 								echo "\n el( '" . $new_args['element'] . "', {";
4161 4160
 							}
4162 4161
 
@@ -4181,7 +4180,7 @@  discard block
 block discarded – undo
4181 4180
 
4182 4181
 									if ( $new_key === 'content' ) {
4183 4182
 										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4184
-									}else if ( $new_key === 'if_content' ) {
4183
+									} else if ( $new_key === 'if_content' ) {
4185 4184
 										echo  $this->block_props_replace(  $new_value  );
4186 4185
 									}
4187 4186
 
@@ -4211,7 +4210,7 @@  discard block
 block discarded – undo
4211 4210
 
4212 4211
 							if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4213 4212
 								echo "))";// end content
4214
-							}else{
4213
+							} else{
4215 4214
 								echo ")";// end content
4216 4215
 							}
4217 4216
 
@@ -4837,11 +4836,11 @@  discard block
 block discarded – undo
4837 4836
 		public function get_widget_icon($icon = 'box-top', $title = ''){
4838 4837
 			if($icon=='box-top'){
4839 4838
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4840
-			}elseif($icon=='box-right'){
4839
+			} elseif($icon=='box-right'){
4841 4840
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4842
-			}elseif($icon=='box-bottom'){
4841
+			} elseif($icon=='box-bottom'){
4843 4842
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4844
-			}elseif($icon=='box-left'){
4843
+			} elseif($icon=='box-left'){
4845 4844
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4846 4845
 			}
4847 4846
 		}
Please login to merge, or discard this patch.
Indentation   +2674 added lines, -2674 removed lines patch added patch discarded remove patch
@@ -1,148 +1,148 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
7 7
 
8
-	define( 'SUPER_DUPER_VER', '1.2.25' );
9
-
10
-	/**
11
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
-	 *
13
-	 * Should not be called direct but extended instead.
14
-	 *
15
-	 * Class WP_Super_Duper
16
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
-	 * @ver 1.1.1
18
-	 */
19
-	class WP_Super_Duper extends WP_Widget {
20
-
21
-		public $version = SUPER_DUPER_VER;
22
-		public $font_awesome_icon_version = "5.11.2";
23
-		public $block_code;
24
-		public $options;
25
-		public $base_id;
26
-		public $settings_hash;
27
-		public $arguments = array();
28
-		public $instance = array();
29
-		private $class_name;
30
-
31
-		/**
32
-		 * The relative url to the current folder.
33
-		 *
34
-		 * @var string
35
-		 */
36
-		public $url = '';
37
-
38
-		/**
39
-		 * Take the array options and use them to build.
40
-		 */
41
-		public function __construct( $options ) {
42
-			global $sd_widgets;
43
-
44
-			$sd_widgets[ $options['base_id'] ] = array(
45
-				'name'       => $options['name'],
46
-				'class_name' => $options['class_name'],
47
-				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
-			);
49
-			$this->base_id                     = $options['base_id'];
50
-			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
54
-			$this->options = $options;
55
-
56
-			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58
-
59
-			// nested blocks can't work as a widget
60
-			if(!empty($this->options['nested-block'])){
61
-				if(empty($this->options['output_types'])){
62
-					$this->options['output_types'] = array('shortcode','block');
63
-				}elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
-					unset($this->options['output_types'][$key]);
65
-				}
66
-			}
8
+    define( 'SUPER_DUPER_VER', '1.2.25' );
9
+
10
+    /**
11
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
+     *
13
+     * Should not be called direct but extended instead.
14
+     *
15
+     * Class WP_Super_Duper
16
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
+     * @ver 1.1.1
18
+     */
19
+    class WP_Super_Duper extends WP_Widget {
20
+
21
+        public $version = SUPER_DUPER_VER;
22
+        public $font_awesome_icon_version = "5.11.2";
23
+        public $block_code;
24
+        public $options;
25
+        public $base_id;
26
+        public $settings_hash;
27
+        public $arguments = array();
28
+        public $instance = array();
29
+        private $class_name;
67 30
 
68
-			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
-				parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
-			}
31
+        /**
32
+         * The relative url to the current folder.
33
+         *
34
+         * @var string
35
+         */
36
+        public $url = '';
37
+
38
+        /**
39
+         * Take the array options and use them to build.
40
+         */
41
+        public function __construct( $options ) {
42
+            global $sd_widgets;
43
+
44
+            $sd_widgets[ $options['base_id'] ] = array(
45
+                'name'       => $options['name'],
46
+                'class_name' => $options['class_name'],
47
+                'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
+            );
49
+            $this->base_id                     = $options['base_id'];
50
+            // lets filter the options before we do anything
51
+            $options       = apply_filters( "wp_super_duper_options", $options );
52
+            $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
+            $options       = $this->add_name_from_key( $options );
54
+            $this->options = $options;
55
+
56
+            $this->base_id   = $options['base_id'];
57
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58
+
59
+            // nested blocks can't work as a widget
60
+            if(!empty($this->options['nested-block'])){
61
+                if(empty($this->options['output_types'])){
62
+                    $this->options['output_types'] = array('shortcode','block');
63
+                }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
+                    unset($this->options['output_types'][$key]);
65
+                }
66
+            }
72 67
 
68
+            // init parent
69
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
+                parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
+            }
73 72
 
74
-			if ( isset( $options['class_name'] ) ) {
75
-				// register widget
76
-				$this->class_name = $options['class_name'];
77 73
 
78
-				// register shortcode, this needs to be done even for blocks and widgets
79
-				$this->register_shortcode();
74
+            if ( isset( $options['class_name'] ) ) {
75
+                // register widget
76
+                $this->class_name = $options['class_name'];
80 77
 
78
+                // register shortcode, this needs to be done even for blocks and widgets
79
+                $this->register_shortcode();
81 80
 
82
-				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
85
-				}
81
+
82
+                // Fusion Builder (avada) support
83
+                if ( function_exists( 'fusion_builder_map' ) ) {
84
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
85
+                }
86 86
 
87 87
                 // maybe load the Bricks transformer class
88 88
                 if( class_exists('\Bricks\Elements', false) ){
89
-					add_action( 'init', array( $this, 'load_bricks_element_class' ) );
89
+                    add_action( 'init', array( $this, 'load_bricks_element_class' ) );
90 90
                 }
91 91
 
92
-				// register block
93
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
94
-					add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
95
-				}
96
-			}
92
+                // register block
93
+                if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
94
+                    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
95
+                }
96
+            }
97 97
 
98
-			// add the CSS and JS we need ONCE
99
-			global $sd_widget_scripts;
98
+            // add the CSS and JS we need ONCE
99
+            global $sd_widget_scripts;
100 100
 
101
-			if ( ! $sd_widget_scripts ) {
102
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
103
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
104
-				wp_add_inline_style( 'widgets', $this->widget_css() );
101
+            if ( ! $sd_widget_scripts ) {
102
+                wp_add_inline_script( 'admin-widgets', $this->widget_js() );
103
+                wp_add_inline_script( 'customize-controls', $this->widget_js() );
104
+                wp_add_inline_style( 'widgets', $this->widget_css() );
105 105
 
106
-				// maybe add elementor editor styles
107
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
106
+                // maybe add elementor editor styles
107
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
108 108
 
109
-				$sd_widget_scripts = true;
109
+                $sd_widget_scripts = true;
110 110
 
111
-				// add shortcode insert button once
112
-				add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
113
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
114
-				// generatepress theme sections compatibility
115
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
116
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
117
-				}
111
+                // add shortcode insert button once
112
+                add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
113
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
114
+                // generatepress theme sections compatibility
115
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
116
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
117
+                }
118 118
 
119
-				/* Load script on Divi theme builder page */
120
-				if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) {
121
-					add_thickbox();
122
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
123
-				}
119
+                /* Load script on Divi theme builder page */
120
+                if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) {
121
+                    add_thickbox();
122
+                    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
123
+                }
124 124
 
125
-				if ( $this->is_preview() ) {
126
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
127
-					// this makes the insert button work for elementor
128
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
129
-						$this,
130
-						'shortcode_insert_button_script'
131
-					) ); // for elementor
132
-				}
133
-				// this makes the insert button work for cornerstone
134
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
125
+                if ( $this->is_preview() ) {
126
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
127
+                    // this makes the insert button work for elementor
128
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
129
+                        $this,
130
+                        'shortcode_insert_button_script'
131
+                    ) ); // for elementor
132
+                }
133
+                // this makes the insert button work for cornerstone
134
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
135 135
 
136
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
137
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
136
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
137
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
138 138
 
139
-				// add generator text to head
140
-				add_action( 'admin_head', array( $this, 'generator' ), 99 );
141
-				add_action( 'wp_head', array( $this, 'generator' ), 99 );
142
-			}
139
+                // add generator text to head
140
+                add_action( 'admin_head', array( $this, 'generator' ), 99 );
141
+                add_action( 'wp_head', array( $this, 'generator' ), 99 );
142
+            }
143 143
 
144
-			do_action( 'wp_super_duper_widget_init', $options, $this );
145
-		}
144
+            do_action( 'wp_super_duper_widget_init', $options, $this );
145
+        }
146 146
 
147 147
         /**
148 148
          * Load the Bricks conversion class if we are running Bricks.
@@ -152,163 +152,163 @@  discard block
 block discarded – undo
152 152
                     include_once __DIR__ . '/includes/class-super-duper-bricks-element.php';
153 153
         }
154 154
 
155
-		/**
156
-		 * The register widget function
157
-		 * @return void
158
-		 */
159
-		public function _register() {
160
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
161
-				parent::_register();
162
-			}
163
-		}
164
-
165
-		/**
166
-		 * Add our widget CSS to elementor editor.
167
-		 */
168
-		public function elementor_editor_styles() {
169
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
170
-		}
171
-
172
-		public function register_fusion_element() {
173
-
174
-			$options = $this->options;
175
-
176
-			if ( $this->base_id ) {
177
-
178
-				$params = $this->get_fusion_params();
179
-
180
-				$args = array(
181
-					'name'            => $options['name'],
182
-					'shortcode'       => $this->base_id,
183
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
184
-					'allow_generator' => true,
185
-				);
186
-
187
-				if ( ! empty( $params ) ) {
188
-					$args['params'] = $params;
189
-				}
190
-
191
-				fusion_builder_map( $args );
192
-			}
155
+        /**
156
+         * The register widget function
157
+         * @return void
158
+         */
159
+        public function _register() {
160
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
161
+                parent::_register();
162
+            }
163
+        }
193 164
 
194
-		}
165
+        /**
166
+         * Add our widget CSS to elementor editor.
167
+         */
168
+        public function elementor_editor_styles() {
169
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
170
+        }
195 171
 
196
-		public function get_fusion_params() {
197
-			$params    = array();
198
-			$arguments = $this->get_arguments();
199
-
200
-			if ( ! empty( $arguments ) ) {
201
-				foreach ( $arguments as $key => $val ) {
202
-					$param = array();
203
-					// type
204
-					$param['type'] = str_replace(
205
-						array(
206
-							"text",
207
-							"number",
208
-							"email",
209
-							"color",
210
-							"checkbox"
211
-						),
212
-						array(
213
-							"textfield",
214
-							"textfield",
215
-							"textfield",
216
-							"colorpicker",
217
-							"select",
172
+        public function register_fusion_element() {
218 173
 
219
-						),
220
-						$val['type'] );
174
+            $options = $this->options;
221 175
 
222
-					// multiselect
223
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
224
-						$param['type']     = 'multiple_select';
225
-						$param['multiple'] = true;
226
-					}
176
+            if ( $this->base_id ) {
227 177
 
228
-					// heading
229
-					$param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
178
+                $params = $this->get_fusion_params();
230 179
 
231
-					// description
232
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
180
+                $args = array(
181
+                    'name'            => $options['name'],
182
+                    'shortcode'       => $this->base_id,
183
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
184
+                    'allow_generator' => true,
185
+                );
233 186
 
234
-					// param_name
235
-					$param['param_name'] = $key;
187
+                if ( ! empty( $params ) ) {
188
+                    $args['params'] = $params;
189
+                }
236 190
 
237
-					// Default
238
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
191
+                fusion_builder_map( $args );
192
+            }
239 193
 
240
-					// Group
241
-					if ( isset( $val['group'] ) ) {
242
-						$param['group'] = $val['group'];
243
-					}
194
+        }
244 195
 
245
-					// value
246
-					if ( $val['type'] == 'checkbox' ) {
247
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
248
-							unset( $param['default'] );
249
-						}
250
-						$param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
251
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
252
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
253
-					} else {
254
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
255
-					}
196
+        public function get_fusion_params() {
197
+            $params    = array();
198
+            $arguments = $this->get_arguments();
199
+
200
+            if ( ! empty( $arguments ) ) {
201
+                foreach ( $arguments as $key => $val ) {
202
+                    $param = array();
203
+                    // type
204
+                    $param['type'] = str_replace(
205
+                        array(
206
+                            "text",
207
+                            "number",
208
+                            "email",
209
+                            "color",
210
+                            "checkbox"
211
+                        ),
212
+                        array(
213
+                            "textfield",
214
+                            "textfield",
215
+                            "textfield",
216
+                            "colorpicker",
217
+                            "select",
218
+
219
+                        ),
220
+                        $val['type'] );
221
+
222
+                    // multiselect
223
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
224
+                        $param['type']     = 'multiple_select';
225
+                        $param['multiple'] = true;
226
+                    }
227
+
228
+                    // heading
229
+                    $param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
230
+
231
+                    // description
232
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
233
+
234
+                    // param_name
235
+                    $param['param_name'] = $key;
236
+
237
+                    // Default
238
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
239
+
240
+                    // Group
241
+                    if ( isset( $val['group'] ) ) {
242
+                        $param['group'] = $val['group'];
243
+                    }
244
+
245
+                    // value
246
+                    if ( $val['type'] == 'checkbox' ) {
247
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
248
+                            unset( $param['default'] );
249
+                        }
250
+                        $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
251
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
252
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
253
+                    } else {
254
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
255
+                    }
256
+
257
+                    // setup the param
258
+                    $params[] = $param;
256 259
 
257
-					// setup the param
258
-					$params[] = $param;
260
+                }
261
+            }
259 262
 
260
-				}
261
-			}
262 263
 
264
+            return $params;
265
+        }
263 266
 
264
-			return $params;
265
-		}
267
+        /**
268
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
269
+         */
270
+        public static function maybe_cornerstone_builder() {
271
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
272
+                self::shortcode_insert_button_script();
273
+            }
274
+        }
266 275
 
267
-		/**
268
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
269
-		 */
270
-		public static function maybe_cornerstone_builder() {
271
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
272
-				self::shortcode_insert_button_script();
273
-			}
274
-		}
276
+        /**
277
+         * A function to ge the shortcode builder picker html.
278
+         *
279
+         * @param string $editor_id
280
+         *
281
+         * @return string
282
+         */
283
+        public static function get_picker( $editor_id = '' ) {
275 284
 
276
-		/**
277
-		 * A function to ge the shortcode builder picker html.
278
-		 *
279
-		 * @param string $editor_id
280
-		 *
281
-		 * @return string
282
-		 */
283
-		public static function get_picker( $editor_id = '' ) {
284
-
285
-			ob_start();
286
-			if ( isset( $_POST['editor_id'] ) ) {
287
-				$editor_id = esc_attr( $_POST['editor_id'] );
288
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
289
-				$editor_id = 'main_content_content_vb_tiny_mce';
290
-			}
285
+            ob_start();
286
+            if ( isset( $_POST['editor_id'] ) ) {
287
+                $editor_id = esc_attr( $_POST['editor_id'] );
288
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
289
+                $editor_id = 'main_content_content_vb_tiny_mce';
290
+            }
291 291
 
292
-			global $sd_widgets;
292
+            global $sd_widgets;
293 293
 
294 294
 //			print_r($sd_widgets);exit;
295
-			?>
295
+            ?>
296 296
 
297 297
 			<div class="sd-shortcode-left-wrap">
298 298
 				<?php
299
-				ksort( $sd_widgets );
300
-				//				print_r($sd_widgets);exit;
301
-				if ( ! empty( $sd_widgets ) ) {
302
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
303
-					echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
304
-					foreach ( $sd_widgets as $shortcode => $class ) {
305
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
306
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
307
-					}
308
-					echo "</select>";
299
+                ksort( $sd_widgets );
300
+                //				print_r($sd_widgets);exit;
301
+                if ( ! empty( $sd_widgets ) ) {
302
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
303
+                    echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
304
+                    foreach ( $sd_widgets as $shortcode => $class ) {
305
+                        if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
306
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
307
+                    }
308
+                    echo "</select>";
309 309
 
310
-				}
311
-				?>
310
+                }
311
+                ?>
312 312
 				<div class="sd-shortcode-settings"></div>
313 313
 			</div>
314 314
 			<div class="sd-shortcode-right-wrap">
@@ -321,147 +321,147 @@  discard block
 block discarded – undo
321 321
 				</div>
322 322
 			</div>
323 323
 			<?php
324
-			$html = ob_get_clean();
325
-
326
-			if ( wp_doing_ajax() ) {
327
-				echo $html;
328
-				$should_die = true;
329
-
330
-				// some builder get the editor via ajax so we should not die on those occasions
331
-				$dont_die = array(
332
-					'parent_tag',// WP Bakery
333
-					'avia_request' // enfold
334
-				);
324
+            $html = ob_get_clean();
325
+
326
+            if ( wp_doing_ajax() ) {
327
+                echo $html;
328
+                $should_die = true;
329
+
330
+                // some builder get the editor via ajax so we should not die on those occasions
331
+                $dont_die = array(
332
+                    'parent_tag',// WP Bakery
333
+                    'avia_request' // enfold
334
+                );
335
+
336
+                foreach ( $dont_die as $request ) {
337
+                    if ( isset( $_REQUEST[ $request ] ) ) {
338
+                        $should_die = false;
339
+                    }
340
+                }
335 341
 
336
-				foreach ( $dont_die as $request ) {
337
-					if ( isset( $_REQUEST[ $request ] ) ) {
338
-						$should_die = false;
339
-					}
340
-				}
342
+                if ( $should_die ) {
343
+                    wp_die();
344
+                }
345
+            } else {
346
+                return $html;
347
+            }
341 348
 
342
-				if ( $should_die ) {
343
-					wp_die();
344
-				}
345
-			} else {
346
-				return $html;
347
-			}
349
+            return '';
350
+        }
348 351
 
349
-			return '';
350
-		}
352
+        /**
353
+         * Output the version in the header.
354
+         */
355
+        public function generator() {
356
+            $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
357
+            $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
358
+
359
+            // Find source plugin/theme of SD
360
+            $source = array();
361
+            if ( strpos( $file, $plugins_dir ) !== false ) {
362
+                $source = explode( "/", plugin_basename( $file ) );
363
+            } else if ( function_exists( 'get_theme_root' ) ) {
364
+                $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
365
+
366
+                if ( strpos( $file, $themes_dir ) !== false ) {
367
+                    $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
368
+                }
369
+            }
351 370
 
352
-		/**
353
-		 * Output the version in the header.
354
-		 */
355
-		public function generator() {
356
-			$file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
357
-			$plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
358
-
359
-			// Find source plugin/theme of SD
360
-			$source = array();
361
-			if ( strpos( $file, $plugins_dir ) !== false ) {
362
-				$source = explode( "/", plugin_basename( $file ) );
363
-			} else if ( function_exists( 'get_theme_root' ) ) {
364
-				$themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
365
-
366
-				if ( strpos( $file, $themes_dir ) !== false ) {
367
-					$source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
368
-				}
369
-			}
371
+            echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
372
+        }
370 373
 
371
-			echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
372
-		}
374
+        /**
375
+         * Get widget settings.
376
+         *
377
+         * @since 1.0.0
378
+         */
379
+        public static function get_widget_settings() {
380
+            global $sd_widgets;
373 381
 
374
-		/**
375
-		 * Get widget settings.
376
-		 *
377
-		 * @since 1.0.0
378
-		 */
379
-		public static function get_widget_settings() {
380
-			global $sd_widgets;
381
-
382
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
383
-			if ( ! $shortcode ) {
384
-				wp_die();
385
-			}
386
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
387
-			if ( ! $widget_args ) {
388
-				wp_die();
389
-			}
390
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
-			if ( ! $class_name ) {
392
-				wp_die();
393
-			}
382
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
383
+            if ( ! $shortcode ) {
384
+                wp_die();
385
+            }
386
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
387
+            if ( ! $widget_args ) {
388
+                wp_die();
389
+            }
390
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
+            if ( ! $class_name ) {
392
+                wp_die();
393
+            }
394 394
 
395
-			// invoke an instance method
396
-			$widget = new $class_name;
395
+            // invoke an instance method
396
+            $widget = new $class_name;
397 397
 
398
-			ob_start();
399
-			$widget->form( array() );
400
-			$form = ob_get_clean();
401
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
402
-			echo "<style>" . $widget->widget_css() . "</style>";
403
-			echo "<script>" . $widget->widget_js() . "</script>";
404
-			?>
398
+            ob_start();
399
+            $widget->form( array() );
400
+            $form = ob_get_clean();
401
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
402
+            echo "<style>" . $widget->widget_css() . "</style>";
403
+            echo "<script>" . $widget->widget_js() . "</script>";
404
+            ?>
405 405
 			<?php
406
-			wp_die();
407
-		}
408
-
409
-		/**
410
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
411
-		 *
412
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
413
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
414
-		 *
415
-		 *@since 1.0.0
416
-		 *
417
-		 */
418
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
419
-			global $sd_widgets, $shortcode_insert_button_once;
420
-			if ( $shortcode_insert_button_once ) {
421
-				return;
422
-			}
423
-			add_thickbox();
406
+            wp_die();
407
+        }
424 408
 
425
-			/**
426
-			 * Cornerstone makes us play dirty tricks :/
427
-			 * 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.
428
-			 */
429
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
430
-				echo '<span id="insert-media-button">';
431
-			}
409
+        /**
410
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
411
+         *
412
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
413
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
414
+         *
415
+         *@since 1.0.0
416
+         *
417
+         */
418
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
419
+            global $sd_widgets, $shortcode_insert_button_once;
420
+            if ( $shortcode_insert_button_once ) {
421
+                return;
422
+            }
423
+            add_thickbox();
424
+
425
+            /**
426
+             * Cornerstone makes us play dirty tricks :/
427
+             * 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.
428
+             */
429
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
430
+                echo '<span id="insert-media-button">';
431
+            }
432 432
 
433
-			echo self::shortcode_button( 'this', 'true' );
433
+            echo self::shortcode_button( 'this', 'true' );
434 434
 
435
-			// see opening note
436
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
437
-				echo '</span>'; // end #insert-media-button
438
-			}
435
+            // see opening note
436
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
437
+                echo '</span>'; // end #insert-media-button
438
+            }
439 439
 
440
-			// Add separate script for generatepress theme sections
441
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
442
-			} else {
443
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
444
-			}
440
+            // Add separate script for generatepress theme sections
441
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
442
+            } else {
443
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
444
+            }
445 445
 
446
-			$shortcode_insert_button_once = true;
447
-		}
446
+            $shortcode_insert_button_once = true;
447
+        }
448 448
 
449
-		/**
450
-		 * Gets the shortcode insert button html.
451
-		 *
452
-		 * @param string $id
453
-		 * @param string $search_for_id
454
-		 *
455
-		 * @return mixed
456
-		 */
457
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
458
-			ob_start();
459
-			?>
449
+        /**
450
+         * Gets the shortcode insert button html.
451
+         *
452
+         * @param string $id
453
+         * @param string $search_for_id
454
+         *
455
+         * @return mixed
456
+         */
457
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
458
+            ob_start();
459
+            ?>
460 460
 			<span class="sd-lable-shortcode-inserter">
461 461
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
462
-				if ( $search_for_id ) {
463
-					echo "," . $search_for_id;
464
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
462
+                if ( $search_for_id ) {
463
+                    echo "," . $search_for_id;
464
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
465 465
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
466 466
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
467 467
 						  class="dashicons dashicons-screenoptions"></span>
@@ -472,21 +472,21 @@  discard block
 block discarded – undo
472 472
 			</span>
473 473
 
474 474
 			<?php
475
-			$html = ob_get_clean();
475
+            $html = ob_get_clean();
476 476
 
477
-			// remove line breaks so we can use it in js
478
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
479
-		}
477
+            // remove line breaks so we can use it in js
478
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
479
+        }
480 480
 
481
-		/**
482
-		 * Makes SD work with the siteOrigin page builder.
483
-		 *
484
-		 * @return mixed
485
-		 *@since 1.0.6
486
-		 */
487
-		public static function siteorigin_js() {
488
-			ob_start();
489
-			?>
481
+        /**
482
+         * Makes SD work with the siteOrigin page builder.
483
+         *
484
+         * @return mixed
485
+         *@since 1.0.6
486
+         */
487
+        public static function siteorigin_js() {
488
+            ob_start();
489
+            ?>
490 490
 			<script>
491 491
 				/**
492 492
 				 * Check a form to see what items should be shown or hidden.
@@ -560,29 +560,29 @@  discard block
 block discarded – undo
560 560
 				});
561 561
 			</script>
562 562
 			<?php
563
-			$output = ob_get_clean();
563
+            $output = ob_get_clean();
564 564
 
565
-			/*
565
+            /*
566 566
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
567 567
 			 */
568 568
 
569
-			return str_replace( array(
570
-				'<script>',
571
-				'</script>'
572
-			), '', $output );
573
-		}
569
+            return str_replace( array(
570
+                '<script>',
571
+                '</script>'
572
+            ), '', $output );
573
+        }
574 574
 
575
-		/**
576
-		 * Output the JS and CSS for the shortcode insert button.
577
-		 *
578
-		 * @param string $editor_id
579
-		 * @param string $insert_shortcode_function
580
-		 *
581
-		 *@since 1.0.6
582
-		 *
583
-		 */
584
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
585
-			?>
575
+        /**
576
+         * Output the JS and CSS for the shortcode insert button.
577
+         *
578
+         * @param string $editor_id
579
+         * @param string $insert_shortcode_function
580
+         *
581
+         *@since 1.0.6
582
+         *
583
+         */
584
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
585
+            ?>
586 586
 			<style>
587 587
 				.sd-shortcode-left-wrap {
588 588
 					float: left;
@@ -710,35 +710,35 @@  discard block
 block discarded – undo
710 710
 				<?php } ?>
711 711
 			</style>
712 712
 			<?php
713
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
714
-				echo "<script>" . self::siteorigin_js() . "</script>";
715
-			}
716
-			?>
713
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
714
+                echo "<script>" . self::siteorigin_js() . "</script>";
715
+            }
716
+            ?>
717 717
 			<script>
718 718
 				<?php
719
-				if(! empty( $insert_shortcode_function )){
720
-					echo $insert_shortcode_function;
721
-				}else{
722
-
723
-				/**
724
-				 * Function for super duper insert shortcode.
725
-				 *
726
-				 * @since 1.0.0
727
-				 */
728
-				?>
719
+                if(! empty( $insert_shortcode_function )){
720
+                    echo $insert_shortcode_function;
721
+                }else{
722
+
723
+                /**
724
+                 * Function for super duper insert shortcode.
725
+                 *
726
+                 * @since 1.0.0
727
+                 */
728
+                ?>
729 729
 				function sd_insert_shortcode($editor_id) {
730 730
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
731 731
 					if ($shortcode) {
732 732
 						if (!$editor_id) {
733 733
 							<?php
734
-							if ( isset( $_REQUEST['et_fb'] ) ) {
735
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
736
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
737
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
738
-							} else {
739
-								echo '$editor_id = "#wp-content-editor-container textarea";';
740
-							}
741
-							?>
734
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
735
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
736
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
737
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
738
+                            } else {
739
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
740
+                            }
741
+                            ?>
742 742
 						} else {
743 743
 							$editor_id = '#' + $editor_id;
744 744
 						}
@@ -1069,18 +1069,18 @@  discard block
 block discarded – undo
1069 1069
 				}
1070 1070
 			</script>
1071 1071
 			<?php
1072
-		}
1072
+        }
1073 1073
 
1074
-		/**
1075
-		 * Gets some CSS for the widgets screen.
1076
-		 *
1077
-		 * @param bool $advanced If we should include advanced CSS.
1078
-		 *
1079
-		 * @return mixed
1080
-		 */
1081
-		public function widget_css( $advanced = true ) {
1082
-			ob_start();
1083
-			?>
1074
+        /**
1075
+         * Gets some CSS for the widgets screen.
1076
+         *
1077
+         * @param bool $advanced If we should include advanced CSS.
1078
+         *
1079
+         * @return mixed
1080
+         */
1081
+        public function widget_css( $advanced = true ) {
1082
+            ob_start();
1083
+            ?>
1084 1084
 			<style>
1085 1085
 				<?php if( $advanced ){ ?>
1086 1086
 				.sd-advanced-setting {
@@ -1120,26 +1120,26 @@  discard block
 block discarded – undo
1120 1120
 				.elementor-control .sd-argument select[multiple] option{padding:3px}
1121 1121
 			</style>
1122 1122
 			<?php
1123
-			$output = ob_get_clean();
1123
+            $output = ob_get_clean();
1124 1124
 
1125
-			/*
1125
+            /*
1126 1126
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1127 1127
 			 */
1128 1128
 
1129
-			return str_replace( array(
1130
-				'<style>',
1131
-				'</style>'
1132
-			), '', $output );
1133
-		}
1129
+            return str_replace( array(
1130
+                '<style>',
1131
+                '</style>'
1132
+            ), '', $output );
1133
+        }
1134 1134
 
1135
-		/**
1136
-		 * Gets some JS for the widgets screen.
1137
-		 *
1138
-		 * @return mixed
1139
-		 */
1140
-		public function widget_js() {
1141
-			ob_start();
1142
-			?>
1135
+        /**
1136
+         * Gets some JS for the widgets screen.
1137
+         *
1138
+         * @return mixed
1139
+         */
1140
+        public function widget_js() {
1141
+            ob_start();
1142
+            ?>
1143 1143
 			<script>
1144 1144
 
1145 1145
 				/**
@@ -1290,517 +1290,517 @@  discard block
 block discarded – undo
1290 1290
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1291 1291
 			</script>
1292 1292
 			<?php
1293
-			$output = ob_get_clean();
1293
+            $output = ob_get_clean();
1294 1294
 
1295
-			/*
1295
+            /*
1296 1296
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1297 1297
 			 */
1298 1298
 
1299
-			return str_replace( array(
1300
-				'<script>',
1301
-				'</script>'
1302
-			), '', $output );
1303
-		}
1299
+            return str_replace( array(
1300
+                '<script>',
1301
+                '</script>'
1302
+            ), '', $output );
1303
+        }
1304 1304
 
1305 1305
 
1306
-		/**
1307
-		 * Set the name from the argument key.
1308
-		 *
1309
-		 * @param $options
1310
-		 *
1311
-		 * @return mixed
1312
-		 */
1313
-		private function add_name_from_key( $options, $arguments = false ) {
1314
-			if ( ! empty( $options['arguments'] ) ) {
1315
-				foreach ( $options['arguments'] as $key => $val ) {
1316
-					$options['arguments'][ $key ]['name'] = $key;
1317
-				}
1318
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1319
-				foreach ( $options as $key => $val ) {
1320
-					$options[ $key ]['name'] = $key;
1321
-				}
1322
-			}
1306
+        /**
1307
+         * Set the name from the argument key.
1308
+         *
1309
+         * @param $options
1310
+         *
1311
+         * @return mixed
1312
+         */
1313
+        private function add_name_from_key( $options, $arguments = false ) {
1314
+            if ( ! empty( $options['arguments'] ) ) {
1315
+                foreach ( $options['arguments'] as $key => $val ) {
1316
+                    $options['arguments'][ $key ]['name'] = $key;
1317
+                }
1318
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1319
+                foreach ( $options as $key => $val ) {
1320
+                    $options[ $key ]['name'] = $key;
1321
+                }
1322
+            }
1323 1323
 
1324
-			return $options;
1325
-		}
1324
+            return $options;
1325
+        }
1326 1326
 
1327
-		/**
1328
-		 * Register the parent shortcode.
1329
-		 *
1330
-		 * @since 1.0.0
1331
-		 */
1332
-		public function register_shortcode() {
1333
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1334
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1335
-		}
1327
+        /**
1328
+         * Register the parent shortcode.
1329
+         *
1330
+         * @since 1.0.0
1331
+         */
1332
+        public function register_shortcode() {
1333
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1334
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1335
+        }
1336 1336
 
1337
-		/**
1338
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1339
-		 *
1340
-		 * @since 1.0.0
1341
-		 */
1342
-		public function render_shortcode() {
1343
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1344
-			if ( ! current_user_can( 'manage_options' ) ) {
1345
-				wp_die();
1346
-			}
1337
+        /**
1338
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1339
+         *
1340
+         * @since 1.0.0
1341
+         */
1342
+        public function render_shortcode() {
1343
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1344
+            if ( ! current_user_can( 'manage_options' ) ) {
1345
+                wp_die();
1346
+            }
1347 1347
 
1348
-			// we might need the $post value here so lets set it.
1349
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1350
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1351
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1352
-					global $post;
1353
-					$post = $post_obj;
1354
-				}
1355
-			}
1348
+            // we might need the $post value here so lets set it.
1349
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1350
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1351
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1352
+                    global $post;
1353
+                    $post = $post_obj;
1354
+                }
1355
+            }
1356 1356
 
1357
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1358
-				$is_preview = $this->is_preview();
1359
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1360
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1361
-				$attributes       = '';
1362
-				if ( ! empty( $attributes_array ) ) {
1363
-					foreach ( $attributes_array as $key => $value ) {
1364
-						if ( is_array( $value ) ) {
1365
-							$value = implode( ",", $value );
1366
-						}
1357
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1358
+                $is_preview = $this->is_preview();
1359
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1360
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1361
+                $attributes       = '';
1362
+                if ( ! empty( $attributes_array ) ) {
1363
+                    foreach ( $attributes_array as $key => $value ) {
1364
+                        if ( is_array( $value ) ) {
1365
+                            $value = implode( ",", $value );
1366
+                        }
1367
+
1368
+                        if ( ! empty( $value ) ) {
1369
+                            $value = wp_unslash( $value );
1370
+
1371
+                            // Encode [ and ].
1372
+                            if ( $is_preview ) {
1373
+                                $value = $this->encode_shortcodes( $value );
1374
+                            }
1375
+                        }
1376
+                        $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1377
+                    }
1378
+                }
1367 1379
 
1368
-						if ( ! empty( $value ) ) {
1369
-							$value = wp_unslash( $value );
1380
+                $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1370 1381
 
1371
-							// Encode [ and ].
1372
-							if ( $is_preview ) {
1373
-								$value = $this->encode_shortcodes( $value );
1374
-							}
1375
-						}
1376
-						$attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1377
-					}
1378
-				}
1382
+                $content = do_shortcode( $shortcode );
1379 1383
 
1380
-				$shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1384
+                // Decode [ and ].
1385
+                if ( ! empty( $content ) && $is_preview ) {
1386
+                    $content = $this->decode_shortcodes( $content );
1387
+                }
1381 1388
 
1382
-				$content = do_shortcode( $shortcode );
1389
+                echo $content;
1390
+            }
1391
+            wp_die();
1392
+        }
1383 1393
 
1384
-				// Decode [ and ].
1385
-				if ( ! empty( $content ) && $is_preview ) {
1386
-					$content = $this->decode_shortcodes( $content );
1387
-				}
1394
+        /**
1395
+         * Output the shortcode.
1396
+         *
1397
+         * @param array $args
1398
+         * @param string $content
1399
+         *
1400
+         * @return string
1401
+         */
1402
+        public function shortcode_output( $args = array(), $content = '' ) {
1403
+            $_instance = $args;
1388 1404
 
1389
-				echo $content;
1390
-			}
1391
-			wp_die();
1392
-		}
1405
+            $args = $this->argument_values( $args );
1393 1406
 
1394
-		/**
1395
-		 * Output the shortcode.
1396
-		 *
1397
-		 * @param array $args
1398
-		 * @param string $content
1399
-		 *
1400
-		 * @return string
1401
-		 */
1402
-		public function shortcode_output( $args = array(), $content = '' ) {
1403
-			$_instance = $args;
1404
-
1405
-			$args = $this->argument_values( $args );
1406
-
1407
-			// add extra argument so we know its a output to gutenberg
1408
-			//$args
1409
-			$args = $this->string_to_bool( $args );
1410
-
1411
-			// if we have a enclosed shortcode we add it to the special `html` argument
1412
-			if ( ! empty( $content ) ) {
1413
-				$args['html'] = $content;
1414
-			}
1407
+            // add extra argument so we know its a output to gutenberg
1408
+            //$args
1409
+            $args = $this->string_to_bool( $args );
1415 1410
 
1416
-			if ( ! $this->is_preview() ) {
1417
-				/**
1418
-				 * Filters the settings for a particular widget args.
1419
-				 *
1420
-				 * @param array          $args      The current widget instance's settings.
1421
-				 * @param WP_Super_Duper $widget    The current widget settings.
1422
-				 * @param array          $_instance An array of default widget arguments.
1423
-				 *
1424
-				 *@since 1.0.28
1425
-				 *
1426
-				 */
1427
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1411
+            // if we have a enclosed shortcode we add it to the special `html` argument
1412
+            if ( ! empty( $content ) ) {
1413
+                $args['html'] = $content;
1414
+            }
1428 1415
 
1429
-				if ( ! is_array( $args ) ) {
1430
-					return $args;
1431
-				}
1432
-			}
1416
+            if ( ! $this->is_preview() ) {
1417
+                /**
1418
+                 * Filters the settings for a particular widget args.
1419
+                 *
1420
+                 * @param array          $args      The current widget instance's settings.
1421
+                 * @param WP_Super_Duper $widget    The current widget settings.
1422
+                 * @param array          $_instance An array of default widget arguments.
1423
+                 *
1424
+                 *@since 1.0.28
1425
+                 *
1426
+                 */
1427
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1428
+
1429
+                if ( ! is_array( $args ) ) {
1430
+                    return $args;
1431
+                }
1432
+            }
1433 1433
 
1434
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1435
-			$class .= " sdel-".$this->get_instance_hash();
1434
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1435
+            $class .= " sdel-".$this->get_instance_hash();
1436 1436
 
1437
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1438
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1437
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1438
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1439 1439
 
1440
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1441
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1440
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1441
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1442 1442
 
1443
-			$shortcode_args = array();
1444
-			$output         = '';
1445
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1446
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1447
-				$no_wrap = true;
1448
-			}
1449
-			$main_content = $this->output( $args, $shortcode_args, $content );
1450
-			if ( $main_content && ! $no_wrap ) {
1451
-				// wrap the shortcode in a div with the same class as the widget
1452
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1453
-				if ( ! empty( $args['title'] ) ) {
1454
-					// if its a shortcode and there is a title try to grab the title wrappers
1455
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1456
-					if ( empty( $instance ) ) {
1457
-						global $wp_registered_sidebars;
1458
-						if ( ! empty( $wp_registered_sidebars ) ) {
1459
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1460
-								if ( ! empty( $sidebar['before_title'] ) ) {
1461
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1462
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1463
-									break;
1464
-								}
1465
-							}
1466
-						}
1467
-					}
1468
-					$output .= $this->output_title( $shortcode_args, $args );
1469
-				}
1470
-				$output .= $main_content;
1471
-				$output .= '</div>';
1472
-			} elseif ( $main_content && $no_wrap ) {
1473
-				$output .= $main_content;
1474
-			}
1443
+            $shortcode_args = array();
1444
+            $output         = '';
1445
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1446
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1447
+                $no_wrap = true;
1448
+            }
1449
+            $main_content = $this->output( $args, $shortcode_args, $content );
1450
+            if ( $main_content && ! $no_wrap ) {
1451
+                // wrap the shortcode in a div with the same class as the widget
1452
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1453
+                if ( ! empty( $args['title'] ) ) {
1454
+                    // if its a shortcode and there is a title try to grab the title wrappers
1455
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1456
+                    if ( empty( $instance ) ) {
1457
+                        global $wp_registered_sidebars;
1458
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1459
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1460
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1461
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1462
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1463
+                                    break;
1464
+                                }
1465
+                            }
1466
+                        }
1467
+                    }
1468
+                    $output .= $this->output_title( $shortcode_args, $args );
1469
+                }
1470
+                $output .= $main_content;
1471
+                $output .= '</div>';
1472
+            } elseif ( $main_content && $no_wrap ) {
1473
+                $output .= $main_content;
1474
+            }
1475 1475
 
1476
-			// if preview show a placeholder if empty
1477
-			if ( $this->is_preview() && $output == '' ) {
1478
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1479
-			}
1476
+            // if preview show a placeholder if empty
1477
+            if ( $this->is_preview() && $output == '' ) {
1478
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1479
+            }
1480 1480
 
1481
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1482
-		}
1481
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1482
+        }
1483 1483
 
1484
-		/**
1485
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1486
-		 *
1487
-		 * @param string $name
1488
-		 *
1489
-		 * @return string
1490
-		 */
1491
-		public function preview_placeholder_text( $name = '' ) {
1492
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1493
-		}
1484
+        /**
1485
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1486
+         *
1487
+         * @param string $name
1488
+         *
1489
+         * @return string
1490
+         */
1491
+        public function preview_placeholder_text( $name = '' ) {
1492
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1493
+        }
1494 1494
 
1495
-		/**
1496
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1497
-		 *
1498
-		 * @param $options
1499
-		 *
1500
-		 * @return mixed
1501
-		 */
1502
-		public function string_to_bool( $options ) {
1503
-			// convert bool strings to booleans
1504
-			foreach ( $options as $key => $val ) {
1505
-				if ( $val == 'false' ) {
1506
-					$options[ $key ] = false;
1507
-				} elseif ( $val == 'true' ) {
1508
-					$options[ $key ] = true;
1509
-				}
1510
-			}
1495
+        /**
1496
+         * Sometimes booleans values can be turned to strings, so we fix that.
1497
+         *
1498
+         * @param $options
1499
+         *
1500
+         * @return mixed
1501
+         */
1502
+        public function string_to_bool( $options ) {
1503
+            // convert bool strings to booleans
1504
+            foreach ( $options as $key => $val ) {
1505
+                if ( $val == 'false' ) {
1506
+                    $options[ $key ] = false;
1507
+                } elseif ( $val == 'true' ) {
1508
+                    $options[ $key ] = true;
1509
+                }
1510
+            }
1511 1511
 
1512
-			return $options;
1513
-		}
1512
+            return $options;
1513
+        }
1514 1514
 
1515
-		/**
1516
-		 * Get the argument values that are also filterable.
1517
-		 *
1518
-		 * @param $instance
1519
-		 *
1520
-		 * @return array
1521
-		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1522
-		 *
1523
-		 */
1524
-		public function argument_values( $instance ) {
1525
-			$argument_values = array();
1526
-
1527
-			// set widget instance
1528
-			$this->instance = $instance;
1529
-
1530
-			if ( empty( $this->arguments ) ) {
1531
-				$this->arguments = $this->get_arguments();
1532
-			}
1515
+        /**
1516
+         * Get the argument values that are also filterable.
1517
+         *
1518
+         * @param $instance
1519
+         *
1520
+         * @return array
1521
+         *@since 1.0.12 Don't set checkbox default value if the value is empty.
1522
+         *
1523
+         */
1524
+        public function argument_values( $instance ) {
1525
+            $argument_values = array();
1533 1526
 
1534
-			if ( ! empty( $this->arguments ) ) {
1535
-				foreach ( $this->arguments as $key => $args ) {
1536
-					// set the input name from the key
1537
-					$args['name'] = $key;
1538
-					//
1539
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1540
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1541
-						// don't set default for an empty checkbox
1542
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1543
-						$argument_values[ $key ] = $args['default'];
1544
-					}
1545
-				}
1546
-			}
1527
+            // set widget instance
1528
+            $this->instance = $instance;
1547 1529
 
1548
-			return $argument_values;
1549
-		}
1530
+            if ( empty( $this->arguments ) ) {
1531
+                $this->arguments = $this->get_arguments();
1532
+            }
1550 1533
 
1551
-		/**
1552
-		 * Set arguments in super duper.
1553
-		 *
1554
-		 * @return array Set arguments.
1555
-		 *@since 1.0.0
1556
-		 *
1557
-		 */
1558
-		public function set_arguments() {
1559
-			return $this->arguments;
1560
-		}
1534
+            if ( ! empty( $this->arguments ) ) {
1535
+                foreach ( $this->arguments as $key => $args ) {
1536
+                    // set the input name from the key
1537
+                    $args['name'] = $key;
1538
+                    //
1539
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1540
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1541
+                        // don't set default for an empty checkbox
1542
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1543
+                        $argument_values[ $key ] = $args['default'];
1544
+                    }
1545
+                }
1546
+            }
1561 1547
 
1562
-		/**
1563
-		 * Get arguments in super duper.
1564
-		 *
1565
-		 * @return array Get arguments.
1566
-		 *@since 1.0.0
1567
-		 *
1568
-		 */
1569
-		public function get_arguments() {
1570
-			if ( empty( $this->arguments ) ) {
1571
-				$this->arguments = $this->set_arguments();
1572
-			}
1548
+            return $argument_values;
1549
+        }
1550
+
1551
+        /**
1552
+         * Set arguments in super duper.
1553
+         *
1554
+         * @return array Set arguments.
1555
+         *@since 1.0.0
1556
+         *
1557
+         */
1558
+        public function set_arguments() {
1559
+            return $this->arguments;
1560
+        }
1561
+
1562
+        /**
1563
+         * Get arguments in super duper.
1564
+         *
1565
+         * @return array Get arguments.
1566
+         *@since 1.0.0
1567
+         *
1568
+         */
1569
+        public function get_arguments() {
1570
+            if ( empty( $this->arguments ) ) {
1571
+                $this->arguments = $this->set_arguments();
1572
+            }
1573 1573
 
1574
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1575
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1574
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1575
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1576 1576
 
1577 1577
             if( !empty( $this->arguments['title']['value'] ) ){
1578 1578
                 $this->arguments['title']['value'] = wp_kses_post( $this->arguments['title']['value'] );
1579 1579
             }
1580 1580
 
1581
-			return $this->arguments;
1582
-		}
1581
+            return $this->arguments;
1582
+        }
1583 1583
 
1584
-		/**
1585
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1586
-		 *
1587
-		 * @param array $args
1588
-		 * @param array $widget_args
1589
-		 * @param string $content
1590
-		 */
1591
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1584
+        /**
1585
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1586
+         *
1587
+         * @param array $args
1588
+         * @param array $widget_args
1589
+         * @param string $content
1590
+         */
1591
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1592 1592
 
1593
-		}
1593
+        }
1594 1594
 
1595
-		/**
1596
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1597
-		 */
1598
-		public function register_block() {
1599
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1600
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1601
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1602
-			}
1603
-		}
1595
+        /**
1596
+         * Add the dynamic block code inline when the wp-block in enqueued.
1597
+         */
1598
+        public function register_block() {
1599
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1600
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1601
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1602
+            }
1603
+        }
1604 1604
 
1605
-		/**
1606
-		 * Check if we need to show advanced options.
1607
-		 *
1608
-		 * @return bool
1609
-		 */
1610
-		public function block_show_advanced() {
1611
-
1612
-			$show      = false;
1613
-			$arguments = $this->get_arguments();
1614
-
1615
-			if ( ! empty( $arguments ) ) {
1616
-				foreach ( $arguments as $argument ) {
1617
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1618
-						$show = true;
1619
-						break; // no need to continue if we know we have it
1620
-					}
1621
-				}
1622
-			}
1605
+        /**
1606
+         * Check if we need to show advanced options.
1607
+         *
1608
+         * @return bool
1609
+         */
1610
+        public function block_show_advanced() {
1623 1611
 
1624
-			return $show;
1625
-		}
1612
+            $show      = false;
1613
+            $arguments = $this->get_arguments();
1626 1614
 
1627
-		/**
1628
-		 * Get the url path to the current folder.
1629
-		 *
1630
-		 * @return string
1631
-		 */
1632
-		public function get_url() {
1633
-			$url = $this->url;
1634
-
1635
-			if ( ! $url ) {
1636
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1637
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1638
-
1639
-				// Replace http:// to https://.
1640
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1641
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1642
-				}
1615
+            if ( ! empty( $arguments ) ) {
1616
+                foreach ( $arguments as $argument ) {
1617
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1618
+                        $show = true;
1619
+                        break; // no need to continue if we know we have it
1620
+                    }
1621
+                }
1622
+            }
1643 1623
 
1644
-				// Check if we are inside a plugin
1645
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1646
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1647
-				$url = trailingslashit( $url );
1648
-				$this->url = $url;
1649
-			}
1624
+            return $show;
1625
+        }
1650 1626
 
1651
-			return $url;
1652
-		}
1627
+        /**
1628
+         * Get the url path to the current folder.
1629
+         *
1630
+         * @return string
1631
+         */
1632
+        public function get_url() {
1633
+            $url = $this->url;
1653 1634
 
1654
-		/**
1655
-		 * Get the url path to the current folder.
1656
-		 *
1657
-		 * @return string
1658
-		 */
1659
-		public function get_url_old() {
1635
+            if ( ! $url ) {
1636
+                $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1637
+                $content_url = untrailingslashit( WP_CONTENT_URL );
1660 1638
 
1661
-			$url = $this->url;
1639
+                // Replace http:// to https://.
1640
+                if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1641
+                    $content_url = str_replace( 'http://', 'https://', $content_url );
1642
+                }
1662 1643
 
1663
-			if ( ! $url ) {
1664
-				// check if we are inside a plugin
1665
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1644
+                // Check if we are inside a plugin
1645
+                $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1646
+                $url = str_replace( $content_dir, $content_url, $file_dir );
1647
+                $url = trailingslashit( $url );
1648
+                $this->url = $url;
1649
+            }
1666 1650
 
1667
-				$dir_parts = explode( "/wp-content/", $file_dir );
1668
-				$url_parts = explode( "/wp-content/", plugins_url() );
1651
+            return $url;
1652
+        }
1669 1653
 
1670
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1671
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1672
-					$this->url = $url;
1673
-				}
1674
-			}
1654
+        /**
1655
+         * Get the url path to the current folder.
1656
+         *
1657
+         * @return string
1658
+         */
1659
+        public function get_url_old() {
1675 1660
 
1661
+            $url = $this->url;
1676 1662
 
1677
-			return $url;
1678
-		}
1663
+            if ( ! $url ) {
1664
+                // check if we are inside a plugin
1665
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1679 1666
 
1680
-		/**
1681
-		 * Generate the block icon.
1682
-		 *
1683
-		 * Enables the use of Font Awesome icons.
1684
-		 *
1685
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1686
-		 *
1687
-		 * @param $icon
1688
-		 *
1689
-		 * @return string
1690
-		 *@since 1.1.0
1691
-		 */
1692
-		public function get_block_icon( $icon ) {
1693
-
1694
-			// check if we have a Font Awesome icon
1695
-			$fa_type = '';
1696
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1697
-				$fa_type = 'solid';
1698
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1699
-				$fa_type = 'regular';
1700
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1701
-				$fa_type = 'brands';
1702
-			} else {
1703
-				$icon = "'" . $icon . "'";
1704
-			}
1667
+                $dir_parts = explode( "/wp-content/", $file_dir );
1668
+                $url_parts = explode( "/wp-content/", plugins_url() );
1705 1669
 
1706
-			// set the icon if we found one
1707
-			if ( $fa_type ) {
1708
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1709
-				$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 . "'}))";
1710
-			}
1670
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1671
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1672
+                    $this->url = $url;
1673
+                }
1674
+            }
1711 1675
 
1712
-			return $icon;
1713
-		}
1714 1676
 
1715
-		public function group_arguments( $arguments ) {
1716
-			if ( ! empty( $arguments ) ) {
1717
-				$temp_arguments = array();
1718
-				$general        = __( "General", 'ayecode-connect' );
1719
-				$add_sections   = false;
1720
-				foreach ( $arguments as $key => $args ) {
1721
-					if ( isset( $args['group'] ) ) {
1722
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1723
-						$add_sections                             = true;
1724
-					} else {
1725
-						$temp_arguments[ $general ][ $key ] = $args;
1726
-					}
1727
-				}
1677
+            return $url;
1678
+        }
1728 1679
 
1729
-				// only add sections if more than one
1730
-				if ( $add_sections ) {
1731
-					$arguments = $temp_arguments;
1732
-				}
1733
-			}
1680
+        /**
1681
+         * Generate the block icon.
1682
+         *
1683
+         * Enables the use of Font Awesome icons.
1684
+         *
1685
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1686
+         *
1687
+         * @param $icon
1688
+         *
1689
+         * @return string
1690
+         *@since 1.1.0
1691
+         */
1692
+        public function get_block_icon( $icon ) {
1693
+
1694
+            // check if we have a Font Awesome icon
1695
+            $fa_type = '';
1696
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1697
+                $fa_type = 'solid';
1698
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1699
+                $fa_type = 'regular';
1700
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1701
+                $fa_type = 'brands';
1702
+            } else {
1703
+                $icon = "'" . $icon . "'";
1704
+            }
1734 1705
 
1735
-			return $arguments;
1736
-		}
1706
+            // set the icon if we found one
1707
+            if ( $fa_type ) {
1708
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1709
+                $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 . "'}))";
1710
+            }
1737 1711
 
1738
-		/**
1739
-		 * Parse used group tabs.
1740
-		 *
1741
-		 * @since 1.1.17
1742
-		 */
1743
-		public function group_block_tabs( $tabs, $arguments ) {
1744
-			if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1745
-				$has_sections = false;
1746
-
1747
-				foreach ( $this->arguments as $key => $args ) {
1748
-					if ( isset( $args['group'] ) ) {
1749
-						$has_sections = true;
1750
-						break;
1751
-					}
1752
-				}
1712
+            return $icon;
1713
+        }
1753 1714
 
1754
-				if ( ! $has_sections ) {
1755
-					return $tabs;
1756
-				}
1715
+        public function group_arguments( $arguments ) {
1716
+            if ( ! empty( $arguments ) ) {
1717
+                $temp_arguments = array();
1718
+                $general        = __( "General", 'ayecode-connect' );
1719
+                $add_sections   = false;
1720
+                foreach ( $arguments as $key => $args ) {
1721
+                    if ( isset( $args['group'] ) ) {
1722
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1723
+                        $add_sections                             = true;
1724
+                    } else {
1725
+                        $temp_arguments[ $general ][ $key ] = $args;
1726
+                    }
1727
+                }
1757 1728
 
1758
-				$new_tabs = array();
1729
+                // only add sections if more than one
1730
+                if ( $add_sections ) {
1731
+                    $arguments = $temp_arguments;
1732
+                }
1733
+            }
1759 1734
 
1760
-				foreach ( $tabs as $tab_key => $tab ) {
1761
-					$new_groups = array();
1735
+            return $arguments;
1736
+        }
1762 1737
 
1763
-					if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1764
-						foreach ( $tab['groups'] as $group ) {
1765
-							if ( isset( $arguments[ $group ] ) ) {
1766
-								$new_groups[] = $group;
1767
-							}
1768
-						}
1769
-					}
1738
+        /**
1739
+         * Parse used group tabs.
1740
+         *
1741
+         * @since 1.1.17
1742
+         */
1743
+        public function group_block_tabs( $tabs, $arguments ) {
1744
+            if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1745
+                $has_sections = false;
1746
+
1747
+                foreach ( $this->arguments as $key => $args ) {
1748
+                    if ( isset( $args['group'] ) ) {
1749
+                        $has_sections = true;
1750
+                        break;
1751
+                    }
1752
+                }
1770 1753
 
1771
-					if ( ! empty( $new_groups ) ) {
1772
-						$tab['groups'] = $new_groups;
1754
+                if ( ! $has_sections ) {
1755
+                    return $tabs;
1756
+                }
1773 1757
 
1774
-						$new_tabs[ $tab_key ] = $tab;
1775
-					}
1776
-				}
1758
+                $new_tabs = array();
1777 1759
 
1778
-				$tabs = $new_tabs;
1779
-			}
1760
+                foreach ( $tabs as $tab_key => $tab ) {
1761
+                    $new_groups = array();
1780 1762
 
1781
-			return $tabs;
1782
-		}
1763
+                    if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1764
+                        foreach ( $tab['groups'] as $group ) {
1765
+                            if ( isset( $arguments[ $group ] ) ) {
1766
+                                $new_groups[] = $group;
1767
+                            }
1768
+                        }
1769
+                    }
1770
+
1771
+                    if ( ! empty( $new_groups ) ) {
1772
+                        $tab['groups'] = $new_groups;
1773
+
1774
+                        $new_tabs[ $tab_key ] = $tab;
1775
+                    }
1776
+                }
1777
+
1778
+                $tabs = $new_tabs;
1779
+            }
1780
+
1781
+            return $tabs;
1782
+        }
1783 1783
 
1784
-		/**
1785
-		 * Output the JS for building the dynamic Guntenberg block.
1786
-		 *
1787
-		 * @return mixed
1788
-		 *@since 1.0.9 Save numbers as numbers and not strings.
1789
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1790
-		 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1791
-		 */
1792
-		public function block() {
1793
-			global $sd_is_js_functions_loaded, $aui_bs5;
1794
-
1795
-			$show_advanced = $this->block_show_advanced();
1796
-
1797
-			ob_start();
1798
-			?>
1784
+        /**
1785
+         * Output the JS for building the dynamic Guntenberg block.
1786
+         *
1787
+         * @return mixed
1788
+         *@since 1.0.9 Save numbers as numbers and not strings.
1789
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1790
+         * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1791
+         */
1792
+        public function block() {
1793
+            global $sd_is_js_functions_loaded, $aui_bs5;
1794
+
1795
+            $show_advanced = $this->block_show_advanced();
1796
+
1797
+            ob_start();
1798
+            ?>
1799 1799
 			<script>
1800 1800
 			<?php
1801
-			if ( ! $sd_is_js_functions_loaded ) {
1802
-				$sd_is_js_functions_loaded = true;
1803
-			?>
1801
+            if ( ! $sd_is_js_functions_loaded ) {
1802
+                $sd_is_js_functions_loaded = true;
1803
+            ?>
1804 1804
 function sd_show_view_options($this){
1805 1805
 	if(jQuery($this).html().length){
1806 1806
 		jQuery($this).html('');
@@ -2300,8 +2300,8 @@  discard block
 block discarded – undo
2300 2300
 				$classes = [];
2301 2301
 
2302 2302
 				<?php
2303
-				if($aui_bs5){
2304
-					?>
2303
+                if($aui_bs5){
2304
+                    ?>
2305 2305
 				$aui_bs5 = true;
2306 2306
 				$p_ml = 'ms-';
2307 2307
 				$p_mr = 'me-';
@@ -2309,8 +2309,8 @@  discard block
 block discarded – undo
2309 2309
 				$p_pl = 'ps-';
2310 2310
 				$p_pr = 'pe-';
2311 2311
 					<?php
2312
-				}else{
2313
-						?>
2312
+                }else{
2313
+                        ?>
2314 2314
 				$aui_bs5 = false;
2315 2315
 				$p_ml = 'ml-';
2316 2316
 				$p_mr = 'mr-';
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
 				$p_pl = 'pl-';
2319 2319
 				$p_pr = 'pr-';
2320 2320
 					<?php
2321
-				}
2322
-				?>
2321
+                }
2322
+                ?>
2323 2323
 
2324 2324
 				// margins
2325 2325
 				if ( $args['mt'] !== undefined && $args['mt'] !== '' ) { $classes.push( "mt-" + $args['mt'] );  $mt = $args['mt']; }else{$mt = null;}
@@ -2503,12 +2503,12 @@  discard block
 block discarded – undo
2503 2503
 			<?php
2504 2504
 
2505 2505
 
2506
-			}
2506
+            }
2507 2507
 
2508
-			if(method_exists($this,'block_global_js')){
2509
-					echo $this->block_global_js();
2510
-			}
2511
-			?>
2508
+            if(method_exists($this,'block_global_js')){
2509
+                    echo $this->block_global_js();
2510
+            }
2511
+            ?>
2512 2512
 
2513 2513
 jQuery(function() {
2514 2514
 
@@ -2561,13 +2561,13 @@  discard block
 block discarded – undo
2561 2561
 						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/.
2562 2562
 						supports: {
2563 2563
 							<?php
2564
-							if(!isset($this->options['block-supports']['renaming'])){
2565
-								$this->options['block-supports']['renaming'] = false;
2566
-							}
2567
-							if ( isset( $this->options['block-supports'] ) ) {
2568
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2569
-							}
2570
-							?>
2564
+                            if(!isset($this->options['block-supports']['renaming'])){
2565
+                                $this->options['block-supports']['renaming'] = false;
2566
+                            }
2567
+                            if ( isset( $this->options['block-supports'] ) ) {
2568
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
2569
+                            }
2570
+                            ?>
2571 2571
 						},
2572 2572
 						__experimentalLabel( attributes, { context } ) {
2573 2573
 							var visibility_html = attributes && attributes.visibility_conditions ? ' &#128065;' : '';
@@ -2577,155 +2577,155 @@  discard block
 block discarded – undo
2577 2577
 						},
2578 2578
 						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.
2579 2579
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2580
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2581
-						}
2582
-
2583
-
2584
-						// block hover preview.
2585
-						$example_args = array();
2586
-						if(!empty($this->arguments)){
2587
-							foreach($this->arguments as $key => $a_args){
2588
-								if(isset($a_args['example'])){
2589
-									$example_args[$key] = $a_args['example'];
2590
-								}
2591
-							}
2592
-						}
2593
-						$viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2594
-						$example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2595
-						if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2596
-							// no preview if set to false
2597
-						}elseif( !empty( $example_args ) ){
2598
-							echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2599
-						}elseif( !empty( $this->options['example'] ) ){
2600
-							unset($this->options['example']['viewportWidth']);
2601
-							unset($this->options['example']['innerBlocks']);
2602
-							$example_atts = $this->array_to_attributes( $this->options['example'] );
2603
-							$example_parts = array();
2604
-							if($example_atts){
2605
-								$example_parts[] = rtrim($example_atts,",");
2606
-							}
2607
-							if($viewport_width){
2608
-								$example_parts[] = $viewport_width;
2609
-							}
2610
-							if($example_inner_blocks){
2611
-								$example_parts[] = $example_inner_blocks;
2612
-							}
2613
-							if(!empty($example_parts)){
2614
-								echo "example : {".implode(',', $example_parts)."},";
2615
-							}
2616
-						}else{
2617
-							echo 'example : {viewportWidth: 500},';
2618
-						}
2619
-
2620
-
2621
-
2622
-						// limit to parent
2623
-						if( !empty( $this->options['parent'] ) ){
2624
-							echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2625
-						}
2626
-
2627
-						// limit allowed blocks
2628
-						if( !empty( $this->options['allowed-blocks'] ) ){
2629
-							echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2630
-						}
2631
-
2632
-						// maybe set no_wrap
2633
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2634
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2635
-							$no_wrap = true;
2636
-						}
2637
-						if ( $no_wrap ) {
2638
-							$this->options['block-wrap'] = '';
2639
-						}
2640
-
2641
-						// Maybe load the drag/drop functions.
2642
-						$img_drag_drop = false;
2643
-						$show_alignment = false;
2580
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
2581
+                        }
2582
+
2583
+
2584
+                        // block hover preview.
2585
+                        $example_args = array();
2586
+                        if(!empty($this->arguments)){
2587
+                            foreach($this->arguments as $key => $a_args){
2588
+                                if(isset($a_args['example'])){
2589
+                                    $example_args[$key] = $a_args['example'];
2590
+                                }
2591
+                            }
2592
+                        }
2593
+                        $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2594
+                        $example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2595
+                        if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2596
+                            // no preview if set to false
2597
+                        }elseif( !empty( $example_args ) ){
2598
+                            echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2599
+                        }elseif( !empty( $this->options['example'] ) ){
2600
+                            unset($this->options['example']['viewportWidth']);
2601
+                            unset($this->options['example']['innerBlocks']);
2602
+                            $example_atts = $this->array_to_attributes( $this->options['example'] );
2603
+                            $example_parts = array();
2604
+                            if($example_atts){
2605
+                                $example_parts[] = rtrim($example_atts,",");
2606
+                            }
2607
+                            if($viewport_width){
2608
+                                $example_parts[] = $viewport_width;
2609
+                            }
2610
+                            if($example_inner_blocks){
2611
+                                $example_parts[] = $example_inner_blocks;
2612
+                            }
2613
+                            if(!empty($example_parts)){
2614
+                                echo "example : {".implode(',', $example_parts)."},";
2615
+                            }
2616
+                        }else{
2617
+                            echo 'example : {viewportWidth: 500},';
2618
+                        }
2619
+
2620
+
2621
+
2622
+                        // limit to parent
2623
+                        if( !empty( $this->options['parent'] ) ){
2624
+                            echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2625
+                        }
2626
+
2627
+                        // limit allowed blocks
2628
+                        if( !empty( $this->options['allowed-blocks'] ) ){
2629
+                            echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2630
+                        }
2631
+
2632
+                        // maybe set no_wrap
2633
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2634
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2635
+                            $no_wrap = true;
2636
+                        }
2637
+                        if ( $no_wrap ) {
2638
+                            $this->options['block-wrap'] = '';
2639
+                        }
2640
+
2641
+                        // Maybe load the drag/drop functions.
2642
+                        $img_drag_drop = false;
2643
+                        $show_alignment = false;
2644 2644
 	
2645
-							echo "attributes : {";
2646
-
2647
-							if ( $show_advanced ) {
2648
-								echo "show_advanced: {";
2649
-								echo "  type: 'boolean',";
2650
-								echo "  default: false";
2651
-								echo "},";
2652
-							}
2653
-
2654
-							// Block wrap element
2655
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2656
-								echo "block_wrap: {";
2657
-								echo "  type: 'string',";
2658
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "'";
2659
-								echo "},";
2660
-							}
2661
-
2662
-							if ( ! empty( $this->arguments ) ) {
2663
-								foreach ( $this->arguments as $key => $args ) {
2664
-									if ( $args['type'] == 'image' ||  $args['type'] == 'images' ) {
2665
-										$img_drag_drop = true;
2666
-									}
2667
-
2668
-									// Set if we should show alignment.
2669
-									if ( $key == 'alignment' ) {
2670
-										$show_alignment = true;
2671
-									}
2672
-
2673
-									$extra = '';
2674
-									$_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : '';
2675
-
2676
-									if ( ! empty( $_default ) ) {
2677
-										$_default = wp_slash( $_default );
2678
-									}
2679
-
2680
-									if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2681
-										continue;
2682
-									} else if ( $args['type'] == 'checkbox' ) {
2683
-										$type    = 'boolean';
2684
-										$default = $_default ? 'true' : 'false';
2685
-									} else if ( $args['type'] == 'number' ) {
2686
-										$type    = 'number';
2687
-										$default = "'" . $_default . "'";
2688
-									} else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2689
-										$type = 'array';
2690
-										if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2691
-											$default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]";
2692
-										} else {
2693
-											$default = "'" . $_default . "'";
2694
-										}
2695
-									} else if ( $args['type'] == 'tagselect' ) {
2696
-										$type    = 'array';
2697
-										$default = "'" . $_default . "'";
2698
-									} else if ( $args['type'] == 'multiselect' ) {
2699
-										$type    = 'array';
2700
-										$default = "'" . $_default . "'";
2701
-									} else if ( $args['type'] == 'image_xy' ) {
2702
-										$type    = 'object';
2703
-										$default = "'" . $_default . "'";
2704
-									} else if ( $args['type'] == 'image' ) {
2705
-										$type    = 'string';
2706
-										$default = "'" . $_default . "'";
2707
-									} else {
2708
-										$type    = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string';
2709
-										$default = "'" . $_default . "'";
2710
-									}
2711
-
2712
-									echo $key . " : {";
2713
-									echo "type : '$type',";
2714
-									echo "default : $default";
2715
-									echo "},";
2716
-								}
2717
-							}
2718
-
2719
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2720
-							echo "sd_shortcode : {type : 'string',default: ''},";
2721
-
2722
-							if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) {
2723
-								echo "sd_shortcode_close : {type : 'string',default: ''},";
2724
-							}
2725
-
2726
-							echo "className: { type: 'string', default: '' }";
2727
-							echo "},";
2728
-						?>
2645
+                            echo "attributes : {";
2646
+
2647
+                            if ( $show_advanced ) {
2648
+                                echo "show_advanced: {";
2649
+                                echo "  type: 'boolean',";
2650
+                                echo "  default: false";
2651
+                                echo "},";
2652
+                            }
2653
+
2654
+                            // Block wrap element
2655
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2656
+                                echo "block_wrap: {";
2657
+                                echo "  type: 'string',";
2658
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "'";
2659
+                                echo "},";
2660
+                            }
2661
+
2662
+                            if ( ! empty( $this->arguments ) ) {
2663
+                                foreach ( $this->arguments as $key => $args ) {
2664
+                                    if ( $args['type'] == 'image' ||  $args['type'] == 'images' ) {
2665
+                                        $img_drag_drop = true;
2666
+                                    }
2667
+
2668
+                                    // Set if we should show alignment.
2669
+                                    if ( $key == 'alignment' ) {
2670
+                                        $show_alignment = true;
2671
+                                    }
2672
+
2673
+                                    $extra = '';
2674
+                                    $_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : '';
2675
+
2676
+                                    if ( ! empty( $_default ) ) {
2677
+                                        $_default = wp_slash( $_default );
2678
+                                    }
2679
+
2680
+                                    if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2681
+                                        continue;
2682
+                                    } else if ( $args['type'] == 'checkbox' ) {
2683
+                                        $type    = 'boolean';
2684
+                                        $default = $_default ? 'true' : 'false';
2685
+                                    } else if ( $args['type'] == 'number' ) {
2686
+                                        $type    = 'number';
2687
+                                        $default = "'" . $_default . "'";
2688
+                                    } else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2689
+                                        $type = 'array';
2690
+                                        if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2691
+                                            $default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]";
2692
+                                        } else {
2693
+                                            $default = "'" . $_default . "'";
2694
+                                        }
2695
+                                    } else if ( $args['type'] == 'tagselect' ) {
2696
+                                        $type    = 'array';
2697
+                                        $default = "'" . $_default . "'";
2698
+                                    } else if ( $args['type'] == 'multiselect' ) {
2699
+                                        $type    = 'array';
2700
+                                        $default = "'" . $_default . "'";
2701
+                                    } else if ( $args['type'] == 'image_xy' ) {
2702
+                                        $type    = 'object';
2703
+                                        $default = "'" . $_default . "'";
2704
+                                    } else if ( $args['type'] == 'image' ) {
2705
+                                        $type    = 'string';
2706
+                                        $default = "'" . $_default . "'";
2707
+                                    } else {
2708
+                                        $type    = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string';
2709
+                                        $default = "'" . $_default . "'";
2710
+                                    }
2711
+
2712
+                                    echo $key . " : {";
2713
+                                    echo "type : '$type',";
2714
+                                    echo "default : $default";
2715
+                                    echo "},";
2716
+                                }
2717
+                            }
2718
+
2719
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2720
+                            echo "sd_shortcode : {type : 'string',default: ''},";
2721
+
2722
+                            if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) {
2723
+                                echo "sd_shortcode_close : {type : 'string',default: ''},";
2724
+                            }
2725
+
2726
+                            echo "className: { type: 'string', default: '' }";
2727
+                            echo "},";
2728
+                        ?>
2729 2729
 						// The "edit" property must be a valid function.
2730 2730
 						edit: function (props) {
2731 2731
 							const selectedBlock = wp.data.select('core/block-editor').getSelectedBlock();
@@ -2796,10 +2796,10 @@  discard block
 block discarded – undo
2796 2796
 							}
2797 2797
 
2798 2798
 							<?php
2799
-							if(!empty($this->options['block-edit-raw'])) {
2800
-								echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2801
-							}else{
2802
-							?>
2799
+                            if(!empty($this->options['block-edit-raw'])) {
2800
+                                echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2801
+                            }else{
2802
+                            ?>
2803 2803
 
2804 2804
 function hasSelectedInnerBlock(props) {
2805 2805
 	const select = wp.data.select('core/editor');
@@ -2821,9 +2821,9 @@  discard block
 block discarded – undo
2821 2821
 
2822 2822
 	var $value = '';
2823 2823
 	<?php
2824
-	// if we have a post_type and a category then link them
2825
-	if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2826
-	?>
2824
+    // if we have a post_type and a category then link them
2825
+    if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2826
+    ?>
2827 2827
 	if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){
2828 2828
 		$pt = props.attributes.post_type;
2829 2829
 		if(post_type_rest_slugs.length){
@@ -2836,11 +2836,11 @@  discard block
 block discarded – undo
2836 2836
 			term_query_type = $pt;
2837 2837
 		}
2838 2838
 <?php
2839
-	$cat_path = '';
2840
-	if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2841
-		$cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2842
-		$cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2843
-	}
2839
+    $cat_path = '';
2840
+    if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2841
+        $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2842
+        $cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2843
+    }
2844 2844
 ?>
2845 2845
 		/* taxonomies */
2846 2846
 		if($value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run){
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
 <?php
2933 2933
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2934 2934
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2935
-	echo 'const { deviceType } = "";';
2935
+    echo 'const { deviceType } = "";';
2936 2936
 }else{
2937 2937
 ?>
2938 2938
 /** Get device type const. */
@@ -2986,8 +2986,8 @@  discard block
 block discarded – undo
2986 2986
 										'attributes': props.attributes,
2987 2987
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2988 2988
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2989
-										echo $post->ID;
2990
-									}else{echo '0';}?>,
2989
+                                        echo $post->ID;
2990
+                                    }else{echo '0';}?>,
2991 2991
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2992 2992
 									};
2993 2993
 
@@ -3000,20 +3000,20 @@  discard block
 block discarded – undo
3000 3000
 										}
3001 3001
 
3002 3002
 										 <?php
3003
-										if(!empty($this->options['nested-block'])){
3004
-											?>
3003
+                                        if(!empty($this->options['nested-block'])){
3004
+                                            ?>
3005 3005
 											// props.setAttributes({content: env});
3006 3006
 										is_fetching = false;
3007 3007
 										prev_attributes[props.clientId] = props.attributes;
3008 3008
 											 <?php
3009
-										}else{
3010
-										?>
3009
+                                        }else{
3010
+                                        ?>
3011 3011
 										props.setAttributes({content: env});
3012 3012
 										is_fetching = false;
3013 3013
 										prev_attributes[props.clientId] = props.attributes;
3014 3014
 										<?php
3015
-										}
3016
-										?>
3015
+                                        }
3016
+                                        ?>
3017 3017
 
3018 3018
 										// if AUI is active call the js init function
3019 3019
 										if (typeof aui_init === "function") {
@@ -3026,28 +3026,28 @@  discard block
 block discarded – undo
3026 3026
 							}
3027 3027
 
3028 3028
 							<?php
3029
-							if(!empty($this->options['block-edit-js'])) {
3030
-								echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3031
-							}
3029
+                            if(!empty($this->options['block-edit-js'])) {
3030
+                                echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3031
+                            }
3032 3032
 
3033
-							if(empty($this->options['block-save-return'])){
3034
-							?>
3033
+                            if(empty($this->options['block-save-return'])){
3034
+                            ?>
3035 3035
 								///////////////////////////////////////////////////////////////////////
3036 3036
 
3037 3037
 								// build the shortcode.
3038 3038
 								shortcode = "[<?php echo $this->options['base_id'];?>";
3039 3039
 								<?php
3040 3040
 
3041
-								if(! empty( $this->arguments )){
3041
+                                if(! empty( $this->arguments )){
3042 3042
 
3043
-								foreach($this->arguments as $key => $args){
3044
-								   // if($args['type']=='tabs'){continue;}
3043
+                                foreach($this->arguments as $key => $args){
3044
+                                    // if($args['type']=='tabs'){continue;}
3045 3045
 
3046
-								   // don't add metadata arguments
3047
-								   if (substr($key, 0, 9 ) === 'metadata_') {
3048
-									   continue;
3049
-								   }
3050
-								?>
3046
+                                    // don't add metadata arguments
3047
+                                    if (substr($key, 0, 9 ) === 'metadata_') {
3048
+                                        continue;
3049
+                                    }
3050
+                                ?>
3051 3051
 								if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3052 3052
 									if ('<?php echo esc_attr( $key );?>' == 'html') {
3053 3053
 									} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
@@ -3058,10 +3058,10 @@  discard block
 block discarded – undo
3058 3058
 									}
3059 3059
 								}
3060 3060
 								<?php
3061
-								}
3062
-								}
3061
+                                }
3062
+                                }
3063 3063
 
3064
-								?>
3064
+                                ?>
3065 3065
 								shortcode += "]";
3066 3066
 
3067 3067
 								if(shortcode){
@@ -3073,17 +3073,17 @@  discard block
 block discarded – undo
3073 3073
 
3074 3074
 
3075 3075
 									<?php
3076
-									if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3077
-										echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3078
-									}
3079
-									?>
3076
+                                    if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3077
+                                        echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3078
+                                    }
3079
+                                    ?>
3080 3080
 								}
3081 3081
 
3082 3082
 
3083 3083
 							///////////////////////////////////////////////////////////////////////
3084 3084
 							<?php
3085
-							} // end nested block check
3086
-							?>
3085
+                            } // end nested block check
3086
+                            ?>
3087 3087
 
3088 3088
 							return [
3089 3089
 
@@ -3107,10 +3107,10 @@  discard block
 block discarded – undo
3107 3107
 
3108 3108
 									<?php
3109 3109
 
3110
-									if(! empty( $this->arguments )){
3110
+                                    if(! empty( $this->arguments )){
3111 3111
 
3112
-									if ( $show_advanced ) {
3113
-									?>
3112
+                                    if ( $show_advanced ) {
3113
+                                    ?>
3114 3114
 									el('div', {
3115 3115
 											style: {'padding-left': '16px','padding-right': '16px'}
3116 3116
 										},
@@ -3127,119 +3127,119 @@  discard block
 block discarded – undo
3127 3127
 									)
3128 3128
 									,
3129 3129
 									<?php
3130
-									}
3131
-
3132
-									$arguments = $this->group_arguments( $this->arguments );
3133
-									$block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3134
-
3135
-									// Do we have sections?
3136
-									$has_sections = $arguments == $this->arguments ? false : true;
3137
-
3138
-									if($has_sections){
3139
-									$panel_count = 0;
3140
-									$open_tab = '';
3141
-
3142
-									$open_tab_groups = array();
3143
-									$used_tabs = array();
3144
-
3145
-									foreach ( $arguments as $key => $args ) {
3146
-										$close_tab = false;
3147
-										$close_tabs = false;
3148
-
3149
-										 if ( ! empty( $block_group_tabs ) ) {
3150
-											foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3151
-												if ( in_array( $key, $tab_args['groups'] ) ) {
3152
-													$open_tab_groups[] = $key;
3153
-
3154
-													if ( $open_tab != $tab_name ) {
3155
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3156
-														$tab_args['tab']['open'] = true;
3157
-
3158
-														$this->block_tab_start( '', $tab_args );
3159
-														$open_tab = $tab_name;
3160
-														$used_tabs[] = $tab_name;
3161
-													}
3162
-
3163
-													if ( $open_tab_groups == $tab_args['groups'] ) {
3164
-														$close_tab = true;
3165
-														$open_tab_groups = array();
3166
-
3167
-														if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3168
-															$close_tabs = true;
3169
-														}
3170
-													}
3171
-												}
3172
-											}
3173
-										}
3174
-										?>
3130
+                                    }
3131
+
3132
+                                    $arguments = $this->group_arguments( $this->arguments );
3133
+                                    $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3134
+
3135
+                                    // Do we have sections?
3136
+                                    $has_sections = $arguments == $this->arguments ? false : true;
3137
+
3138
+                                    if($has_sections){
3139
+                                    $panel_count = 0;
3140
+                                    $open_tab = '';
3141
+
3142
+                                    $open_tab_groups = array();
3143
+                                    $used_tabs = array();
3144
+
3145
+                                    foreach ( $arguments as $key => $args ) {
3146
+                                        $close_tab = false;
3147
+                                        $close_tabs = false;
3148
+
3149
+                                            if ( ! empty( $block_group_tabs ) ) {
3150
+                                            foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3151
+                                                if ( in_array( $key, $tab_args['groups'] ) ) {
3152
+                                                    $open_tab_groups[] = $key;
3153
+
3154
+                                                    if ( $open_tab != $tab_name ) {
3155
+                                                        $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3156
+                                                        $tab_args['tab']['open'] = true;
3157
+
3158
+                                                        $this->block_tab_start( '', $tab_args );
3159
+                                                        $open_tab = $tab_name;
3160
+                                                        $used_tabs[] = $tab_name;
3161
+                                                    }
3162
+
3163
+                                                    if ( $open_tab_groups == $tab_args['groups'] ) {
3164
+                                                        $close_tab = true;
3165
+                                                        $open_tab_groups = array();
3166
+
3167
+                                                        if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3168
+                                                            $close_tabs = true;
3169
+                                                        }
3170
+                                                    }
3171
+                                                }
3172
+                                            }
3173
+                                        }
3174
+                                        ?>
3175 3175
 										el(wp.components.PanelBody, {
3176 3176
 												title: '<?php esc_attr_e( $key ); ?>',
3177 3177
 												initialOpen: <?php if ( $panel_count ) {
3178
-												echo "false";
3179
-											} else {
3180
-												echo "true";
3181
-											}?>
3178
+                                                echo "false";
3179
+                                            } else {
3180
+                                                echo "true";
3181
+                                            }?>
3182 3182
 											},
3183 3183
 											<?php
3184
-											foreach ( $args as $k => $a ) {
3185
-												$this->block_tab_start( $k, $a );
3186
-												$this->block_row_start( $k, $a );
3187
-												$this->build_block_arguments( $k, $a );
3188
-												$this->block_row_end( $k, $a );
3189
-												$this->block_tab_end( $k, $a );
3190
-											}
3191
-											?>
3184
+                                            foreach ( $args as $k => $a ) {
3185
+                                                $this->block_tab_start( $k, $a );
3186
+                                                $this->block_row_start( $k, $a );
3187
+                                                $this->build_block_arguments( $k, $a );
3188
+                                                $this->block_row_end( $k, $a );
3189
+                                                $this->block_tab_end( $k, $a );
3190
+                                            }
3191
+                                            ?>
3192 3192
 										),
3193 3193
 										<?php
3194
-										$panel_count ++;
3194
+                                        $panel_count ++;
3195 3195
 
3196
-										if($close_tab || $close_tabs){
3197
-											$tab_args = array(
3198
-												'tab'	=> array(
3199
-													'tabs_close' => $close_tabs,
3200
-												'close' => true,
3201
-												)
3196
+                                        if($close_tab || $close_tabs){
3197
+                                            $tab_args = array(
3198
+                                                'tab'	=> array(
3199
+                                                    'tabs_close' => $close_tabs,
3200
+                                                'close' => true,
3201
+                                                )
3202 3202
 
3203
-											);
3204
-											$this->block_tab_end( '', $tab_args );
3203
+                                            );
3204
+                                            $this->block_tab_end( '', $tab_args );
3205 3205
 //											echo '###close'; print_r($tab_args);
3206
-											$panel_count = 0;
3207
-										}
3206
+                                            $panel_count = 0;
3207
+                                        }
3208 3208
 //
3209 3209
 
3210
-									}
3211
-									}else {
3212
-									?>
3210
+                                    }
3211
+                                    }else {
3212
+                                    ?>
3213 3213
 									el(wp.components.PanelBody, {
3214 3214
 											title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>',
3215 3215
 											initialOpen: true
3216 3216
 										},
3217 3217
 										<?php
3218
-										foreach ( $this->arguments as $key => $args ) {
3219
-											$this->block_row_start( $key, $args );
3220
-											$this->build_block_arguments( $key, $args );
3221
-											$this->block_row_end( $key, $args );
3222
-										}
3223
-										?>
3218
+                                        foreach ( $this->arguments as $key => $args ) {
3219
+                                            $this->block_row_start( $key, $args );
3220
+                                            $this->build_block_arguments( $key, $args );
3221
+                                            $this->block_row_end( $key, $args );
3222
+                                        }
3223
+                                        ?>
3224 3224
 									),
3225 3225
 									<?php
3226
-									}
3226
+                                    }
3227 3227
 
3228
-									}
3229
-									?>
3228
+                                    }
3229
+                                    ?>
3230 3230
 
3231 3231
 								),
3232 3232
 
3233 3233
 								<?php
3234
-								// If the user sets block-output array then build it
3235
-								if ( ! empty( $this->options['block-output'] ) ) {
3236
-								$this->block_element( $this->options['block-output'] );
3237
-							}elseif(!empty($this->options['block-edit-return'])){
3238
-								   echo $this->options['block-edit-return'];
3239
-							}else{
3240
-								// if no block-output is set then we try and get the shortcode html output via ajax.
3241
-								$block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3242
-								?>
3234
+                                // If the user sets block-output array then build it
3235
+                                if ( ! empty( $this->options['block-output'] ) ) {
3236
+                                $this->block_element( $this->options['block-output'] );
3237
+                            }elseif(!empty($this->options['block-edit-return'])){
3238
+                                    echo $this->options['block-edit-return'];
3239
+                            }else{
3240
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
3241
+                                $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3242
+                                ?>
3243 3243
 								el('<?php echo esc_attr($block_edit_wrap_tag); ?>', wp.blockEditor.useBlockProps({
3244 3244
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
3245 3245
 									className: props.className,
@@ -3247,13 +3247,13 @@  discard block
 block discarded – undo
3247 3247
 									style: {'minHeight': '30px'}
3248 3248
 								}))
3249 3249
 								<?php
3250
-								}
3251
-								?>
3250
+                                }
3251
+                                ?>
3252 3252
 							]; // end return
3253 3253
 
3254 3254
 							<?php
3255
-							} // end block-edit-raw else
3256
-							?>
3255
+                            } // end block-edit-raw else
3256
+                            ?>
3257 3257
 						},
3258 3258
 
3259 3259
 						// The "save" property must be specified and must be a valid function.
@@ -3267,16 +3267,16 @@  discard block
 block discarded – undo
3267 3267
 							$html = '';
3268 3268
 							<?php
3269 3269
 
3270
-							if(! empty( $this->arguments )){
3270
+                            if(! empty( $this->arguments )){
3271 3271
 
3272
-							foreach($this->arguments as $key => $args){
3273
-							   // if($args['type']=='tabs'){continue;}
3272
+                            foreach($this->arguments as $key => $args){
3273
+                                // if($args['type']=='tabs'){continue;}
3274 3274
 
3275
-							   // don't add metadata arguments
3276
-							   if (substr($key, 0, 9 ) === 'metadata_') {
3277
-								   continue;
3278
-							   }
3279
-							?>
3275
+                                // don't add metadata arguments
3276
+                                if (substr($key, 0, 9 ) === 'metadata_') {
3277
+                                    continue;
3278
+                                }
3279
+                            ?>
3280 3280
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3281 3281
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
3282 3282
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -3287,10 +3287,10 @@  discard block
 block discarded – undo
3287 3287
 								}
3288 3288
 							}
3289 3289
 							<?php
3290
-							}
3291
-							}
3290
+                            }
3291
+                            }
3292 3292
 
3293
-							?>
3293
+                            ?>
3294 3294
 							content += "]";
3295 3295
 							 content = '';
3296 3296
 
@@ -3300,7 +3300,7 @@  discard block
 block discarded – undo
3300 3300
 //                                $html = 'el( InnerBlocks.Content )';
3301 3301
 //                                <?php
3302 3302
 //                            }
3303
-							?>
3303
+                            ?>
3304 3304
 							// if has html element
3305 3305
 							if ($html) {
3306 3306
 								//content += $html + "[/<?php echo $this->options['base_id'];?>]";
@@ -3333,12 +3333,12 @@  discard block
 block discarded – undo
3333 3333
 //                                <x?php
3334 3334
 //							}else
3335 3335
 
3336
-							if(!empty($this->options['block-output'])){
3336
+                            if(!empty($this->options['block-output'])){
3337 3337
 //                               echo "return";
3338 3338
 //                               $this->block_element( $this->options['block-output'], true );
3339 3339
 //                               echo ";";
3340 3340
 
3341
-							   ?>
3341
+                                ?>
3342 3342
 							  return el(
3343 3343
 								   '',
3344 3344
 								   {},
@@ -3348,10 +3348,10 @@  discard block
 block discarded – undo
3348 3348
 							   );
3349 3349
 								<?php
3350 3350
 
3351
-							}elseif(!empty($this->options['block-save-return'])){
3352
-								   echo 'return ' . $this->options['block-save-return'];
3353
-							}elseif(!empty($this->options['nested-block'])){
3354
-								?>
3351
+                            }elseif(!empty($this->options['block-save-return'])){
3352
+                                    echo 'return ' . $this->options['block-save-return'];
3353
+                            }elseif(!empty($this->options['nested-block'])){
3354
+                                ?>
3355 3355
 							  return el(
3356 3356
 								   '',
3357 3357
 								   {},
@@ -3360,22 +3360,22 @@  discard block
 block discarded – undo
3360 3360
 								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3361 3361
 							   );
3362 3362
 								<?php
3363
-							}elseif(!empty( $this->options['block-save-return'] ) ){
3364
-								echo "return ". $this->options['block-edit-return'].";";
3365
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3366
-							?>
3363
+                            }elseif(!empty( $this->options['block-save-return'] ) ){
3364
+                                echo "return ". $this->options['block-edit-return'].";";
3365
+                            }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3366
+                            ?>
3367 3367
 							return content;
3368 3368
 							<?php
3369
-							}else{
3370
-							?>
3369
+                            }else{
3370
+                            ?>
3371 3371
 							var block_wrap = 'div';
3372 3372
 							if (attr.hasOwnProperty("block_wrap")) {
3373 3373
 								block_wrap = attr.block_wrap;
3374 3374
 							}
3375 3375
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
3376 3376
 							<?php
3377
-							}
3378
-							?>
3377
+                            }
3378
+                            ?>
3379 3379
 
3380 3380
 
3381 3381
 						}
@@ -3389,43 +3389,43 @@  discard block
 block discarded – undo
3389 3389
 				});
3390 3390
 			</script>
3391 3391
 			<?php
3392
-			$output = ob_get_clean();
3392
+            $output = ob_get_clean();
3393 3393
 
3394
-			/*
3394
+            /*
3395 3395
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
3396 3396
 			 */
3397 3397
 
3398
-			return str_replace( array(
3399
-				'<script>',
3400
-				'</script>'
3401
-			), '', $output );
3402
-		}
3398
+            return str_replace( array(
3399
+                '<script>',
3400
+                '</script>'
3401
+            ), '', $output );
3402
+        }
3403 3403
 
3404 3404
 
3405 3405
 
3406
-		public function block_row_start($key, $args){
3406
+        public function block_row_start($key, $args){
3407 3407
 
3408
-			// check for row
3409
-			if(!empty($args['row'])){
3408
+            // check for row
3409
+            if(!empty($args['row'])){
3410 3410
 
3411
-				if(!empty($args['row']['open'])){
3411
+                if(!empty($args['row']['open'])){
3412 3412
 
3413
-				// element require
3414
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3415
-				$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3416
-				$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3417
-				$device_type_icon = '';
3418
-				if($device_type=='Desktop'){
3419
-					$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3420
-				}elseif($device_type=='Tablet'){
3421
-					$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3422
-				}elseif($device_type=='Mobile'){
3423
-					$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3424
-				}
3425
-				echo $element_require;
3426
-				echo $device_type_require;
3413
+                // element require
3414
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3415
+                $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3416
+                $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3417
+                $device_type_icon = '';
3418
+                if($device_type=='Desktop'){
3419
+                    $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3420
+                }elseif($device_type=='Tablet'){
3421
+                    $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3422
+                }elseif($device_type=='Mobile'){
3423
+                    $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3424
+                }
3425
+                echo $element_require;
3426
+                echo $device_type_require;
3427 3427
 
3428
-					if(false){?><script><?php }?>
3428
+                    if(false){?><script><?php }?>
3429 3429
 						el('div', {
3430 3430
 								className: 'bsui components-base-control',
3431 3431
 							},
@@ -3438,8 +3438,8 @@  discard block
 block discarded – undo
3438 3438
 								<?php if($device_type_icon){ ?>
3439 3439
 									deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3440 3440
 								<?php
3441
-								}
3442
-								?>
3441
+                                }
3442
+                                ?>
3443 3443
 
3444 3444
 
3445 3445
 							),
@@ -3463,51 +3463,51 @@  discard block
 block discarded – undo
3463 3463
 									},
3464 3464
 
3465 3465
 					<?php
3466
-					if(false){?></script><?php }
3467
-				}elseif(!empty($args['row']['close'])){
3468
-					if(false){?><script><?php }?>
3466
+                    if(false){?></script><?php }
3467
+                }elseif(!empty($args['row']['close'])){
3468
+                    if(false){?><script><?php }?>
3469 3469
 						el(
3470 3470
 							'div',
3471 3471
 							{
3472 3472
 								className: 'col pl-0 ps-0',
3473 3473
 							},
3474 3474
 					<?php
3475
-					if(false){?></script><?php }
3476
-				}else{
3477
-					if(false){?><script><?php }?>
3475
+                    if(false){?></script><?php }
3476
+                }else{
3477
+                    if(false){?><script><?php }?>
3478 3478
 						el(
3479 3479
 							'div',
3480 3480
 							{
3481 3481
 								className: 'col pl-0 ps-0 pr-2 pe-2',
3482 3482
 							},
3483 3483
 					<?php
3484
-					if(false){?></script><?php }
3485
-				}
3484
+                    if(false){?></script><?php }
3485
+                }
3486 3486
 
3487
-			}
3487
+            }
3488 3488
 
3489
-		}
3489
+        }
3490 3490
 
3491
-		public function block_row_end($key, $args){
3491
+        public function block_row_end($key, $args){
3492 3492
 
3493
-			if(!empty($args['row'])){
3494
-				// maybe close
3495
-				if(!empty($args['row']['close'])){
3496
-					echo "))";
3497
-				}
3493
+            if(!empty($args['row'])){
3494
+                // maybe close
3495
+                if(!empty($args['row']['close'])){
3496
+                    echo "))";
3497
+                }
3498 3498
 
3499
-				echo "),";
3500
-			}
3501
-		}
3499
+                echo "),";
3500
+            }
3501
+        }
3502 3502
 
3503
-		public function block_tab_start($key, $args){
3503
+        public function block_tab_start($key, $args){
3504 3504
 
3505
-			// check for row
3506
-			if(!empty($args['tab'])){
3505
+            // check for row
3506
+            if(!empty($args['tab'])){
3507 3507
 
3508
-				if(!empty($args['tab']['tabs_open'])){
3508
+                if(!empty($args['tab']['tabs_open'])){
3509 3509
 
3510
-					if(false){?><script><?php }?>
3510
+                    if(false){?><script><?php }?>
3511 3511
 
3512 3512
 el('div',{className: 'bsui'},
3513 3513
 
@@ -3520,12 +3520,12 @@  discard block
 block discarded – undo
3520 3520
 										tabs: [
3521 3521
 
3522 3522
 					<?php
3523
-					if(false){?></script><?php }
3524
-				}
3523
+                    if(false){?></script><?php }
3524
+                }
3525 3525
 
3526
-				if(!empty($args['tab']['open'])){
3526
+                if(!empty($args['tab']['open'])){
3527 3527
 
3528
-					if(false){?><script><?php }?>
3528
+                    if(false){?><script><?php }?>
3529 3529
 							{
3530 3530
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3531 3531
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -3534,93 +3534,93 @@  discard block
 block discarded – undo
3534 3534
 									className: 'components-base-control__help mb-0',
3535 3535
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3536 3536
 								}),<?php }
3537
-					if(false){?></script><?php }
3538
-				}
3537
+                    if(false){?></script><?php }
3538
+                }
3539 3539
 
3540
-			}
3540
+            }
3541 3541
 
3542
-		}
3542
+        }
3543 3543
 
3544
-		public function block_tab_end($key, $args){
3544
+        public function block_tab_end($key, $args){
3545 3545
 
3546
-			if(!empty($args['tab'])){
3547
-				// maybe close
3548
-				if(!empty($args['tab']['close'])){
3549
-					echo ")}, /* tab close */";
3550
-				}
3546
+            if(!empty($args['tab'])){
3547
+                // maybe close
3548
+                if(!empty($args['tab']['close'])){
3549
+                    echo ")}, /* tab close */";
3550
+                }
3551 3551
 
3552
-				if(!empty($args['tab']['tabs_close'])){
3553
-					if(false){?><script><?php }?>
3552
+                if(!empty($args['tab']['tabs_close'])){
3553
+                    if(false){?><script><?php }?>
3554 3554
 						]}, ( tab ) => {
3555 3555
 								return tab.content;
3556 3556
 							}
3557 3557
 						)), /* tabs close */
3558 3558
 					<?php if(false){ ?></script><?php }
3559
-				}
3560
-			}
3561
-		}
3559
+                }
3560
+            }
3561
+        }
3562 3562
 
3563
-		public function build_block_arguments( $key, $args ) {
3564
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3565
-			$options           = '';
3566
-			$extra             = '';
3567
-			$require           = '';
3568
-			$inside_elements   = '';
3569
-			$after_elements	   = '';
3570
-
3571
-			// `content` is a protected and special argument
3572
-			if ( $key == 'content' ) {
3573
-				return;
3574
-			}
3563
+        public function build_block_arguments( $key, $args ) {
3564
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3565
+            $options           = '';
3566
+            $extra             = '';
3567
+            $require           = '';
3568
+            $inside_elements   = '';
3569
+            $after_elements	   = '';
3570
+
3571
+            // `content` is a protected and special argument
3572
+            if ( $key == 'content' ) {
3573
+                return;
3574
+            }
3575 3575
 
3576
-			$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3577
-			$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3578
-			$device_type_icon = '';
3579
-			if($device_type=='Desktop'){
3580
-				$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3581
-			}elseif($device_type=='Tablet'){
3582
-				$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3583
-			}elseif($device_type=='Mobile'){
3584
-				$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3585
-			}
3576
+            $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3577
+            $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3578
+            $device_type_icon = '';
3579
+            if($device_type=='Desktop'){
3580
+                $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3581
+            }elseif($device_type=='Tablet'){
3582
+                $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3583
+            }elseif($device_type=='Mobile'){
3584
+                $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3585
+            }
3586 3586
 
3587
-			// icon
3588
-			$icon = '';
3589
-			if( !empty( $args['icon'] ) ){
3590
-				$icon .= "el('div', {";
3591
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3592
-									$icon .= "className: 'text-center',";
3593
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3594
-								$icon .= "}),";
3595
-
3596
-				// blank title as its added to the icon.
3597
-				$args['title'] = '';
3598
-			}
3587
+            // icon
3588
+            $icon = '';
3589
+            if( !empty( $args['icon'] ) ){
3590
+                $icon .= "el('div', {";
3591
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3592
+                                    $icon .= "className: 'text-center',";
3593
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3594
+                                $icon .= "}),";
3595
+
3596
+                // blank title as its added to the icon.
3597
+                $args['title'] = '';
3598
+            }
3599 3599
 
3600
-			// require advanced
3601
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3600
+            // require advanced
3601
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3602 3602
 
3603
-			// element require
3604
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3603
+            // element require
3604
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3605 3605
 
3606 3606
 
3607
-			$onchange  = "props.setAttributes({ $key: $key } )";
3608
-			$onchangecomplete  = "";
3609
-			$value     = "props.attributes.$key";
3610
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3611
-			if ( in_array( $args['type'], $text_type ) ) {
3612
-				$type = 'TextControl';
3613
-				// Save numbers as numbers and not strings
3614
-				if ( $args['type'] == 'number' ) {
3615
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3616
-				}
3607
+            $onchange  = "props.setAttributes({ $key: $key } )";
3608
+            $onchangecomplete  = "";
3609
+            $value     = "props.attributes.$key";
3610
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3611
+            if ( in_array( $args['type'], $text_type ) ) {
3612
+                $type = 'TextControl';
3613
+                // Save numbers as numbers and not strings
3614
+                if ( $args['type'] == 'number' ) {
3615
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3616
+                }
3617 3617
 
3618
-				if (substr($key, 0, 9 ) === 'metadata_') {
3619
-					$real_key = str_replace('metadata_','', $key );
3620
-					$onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3621
-					$value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3622
-				}
3623
-			}
3618
+                if (substr($key, 0, 9 ) === 'metadata_') {
3619
+                    $real_key = str_replace('metadata_','', $key );
3620
+                    $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3621
+                    $value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3622
+                }
3623
+            }
3624 3624
 //			else if ( $args['type'] == 'popup' ) {
3625 3625
 //				$type = 'TextControl';
3626 3626
 //				$args['type'] == 'text';
@@ -3638,21 +3638,21 @@  discard block
 block discarded – undo
3638 3638
 //
3639 3639
 //				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3640 3640
 //			}
3641
-			else if ( $args['type'] == 'styleid' ) {
3642
-				$type = 'TextControl';
3643
-				$args['type'] == 'text';
3644
-				// Save numbers as numbers and not strings
3645
-				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3646
-			}else if ( $args['type'] == 'notice' ) {
3647
-
3648
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3649
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3650
-
3651
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3652
-				echo $notice_message ? $element_require . $notice : '';
3653
-				return;
3654
-			}
3655
-			/*
3641
+            else if ( $args['type'] == 'styleid' ) {
3642
+                $type = 'TextControl';
3643
+                $args['type'] == 'text';
3644
+                // Save numbers as numbers and not strings
3645
+                $value     = "props.attributes.$key ? props.attributes.$key : ''";
3646
+            }else if ( $args['type'] == 'notice' ) {
3647
+
3648
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3649
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3650
+
3651
+                $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3652
+                echo $notice_message ? $element_require . $notice : '';
3653
+                return;
3654
+            }
3655
+            /*
3656 3656
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3657 3657
 						elseif($args['type']=='tabs'){
3658 3658
 							?>
@@ -3705,22 +3705,22 @@  discard block
 block discarded – undo
3705 3705
 							return;
3706 3706
 						}
3707 3707
 */
3708
-			elseif ( $args['type'] == 'color' ) {
3709
-				$type = 'ColorPicker';
3710
-				$onchange = "";
3711
-				$extra = "color: $value,";
3712
-				if(!empty($args['disable_alpha'])){
3713
-					$extra .= "disableAlpha: true,";
3714
-				}
3715
-				$onchangecomplete = "onChangeComplete: function($key) {
3708
+            elseif ( $args['type'] == 'color' ) {
3709
+                $type = 'ColorPicker';
3710
+                $onchange = "";
3711
+                $extra = "color: $value,";
3712
+                if(!empty($args['disable_alpha'])){
3713
+                    $extra .= "disableAlpha: true,";
3714
+                }
3715
+                $onchangecomplete = "onChangeComplete: function($key) {
3716 3716
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3717 3717
 						props.setAttributes({
3718 3718
 							$key: value
3719 3719
 						});
3720 3720
 					},";
3721
-			}elseif ( $args['type'] == 'gradient' ) {
3722
-				$type = 'GradientPicker';
3723
-				$extra .= "gradients: [{
3721
+            }elseif ( $args['type'] == 'gradient' ) {
3722
+                $type = 'GradientPicker';
3723
+                $extra .= "gradients: [{
3724 3724
 			name: 'Vivid cyan blue to vivid purple',
3725 3725
 			gradient:
3726 3726
 				'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
@@ -3757,10 +3757,10 @@  discard block
 block discarded – undo
3757 3757
 			slug: 'cool-to-warm-spectrum',
3758 3758
 		}],";
3759 3759
 
3760
-			}elseif ( $args['type'] == 'image' ) {
3760
+            }elseif ( $args['type'] == 'image' ) {
3761 3761
 //                print_r($args);
3762 3762
 
3763
-				$img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
3763
+                $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
3764 3764
 							url:  props.attributes.{$key}_use_featured === true ? 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxzdmcgYmFzZVByb2ZpbGU9InRpbnkiIGhlaWdodD0iNDAwIiB2ZXJzaW9uPSIxLjIiIHdpZHRoPSI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6ZXY9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEveG1sLWV2ZW50cyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzIC8+PHJlY3QgZmlsbD0iI2QzZDNkMyIgaGVpZ2h0PSI0MDAiIHdpZHRoPSI0MDAiIHg9IjAiIHk9IjAiIC8+PGxpbmUgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxMCIgeDE9IjAiIHgyPSI0MDAiIHkxPSIwIiB5Mj0iNDAwIiAvPjxsaW5lIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMTAiIHgxPSIwIiB4Mj0iNDAwIiB5MT0iNDAwIiB5Mj0iMCIgLz48cmVjdCBmaWxsPSIjZDNkM2QzIiBoZWlnaHQ9IjUwIiB3aWR0aD0iMjE4LjAiIHg9IjkxLjAiIHk9IjE3NS4wIiAvPjx0ZXh0IGZpbGw9IndoaXRlIiBmb250LXNpemU9IjMwIiBmb250LXdlaWdodD0iYm9sZCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgeD0iMjAwLjAiIHk9IjIwNy41Ij5QTEFDRUhPTERFUjwvdGV4dD48L3N2Zz4='  : props.attributes.$key,
3765 3765
 							value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy  : {x: 0.5,y: 0.5,},
3766 3766
 //                            value: props.attributes.{$key}_xy,
@@ -3781,16 +3781,16 @@  discard block
 block discarded – undo
3781 3781
 						}), ";
3782 3782
 
3783 3783
 
3784
-				$value = '""';
3785
-				$type = 'MediaUpload';
3786
-				$extra .= "onSelect: function(media){
3784
+                $value = '""';
3785
+                $type = 'MediaUpload';
3786
+                $extra .= "onSelect: function(media){
3787 3787
 					  return props.setAttributes({
3788 3788
 						  $key: media.url,
3789 3789
 						  {$key}_id: media.id
3790 3790
 						});
3791 3791
 					  },";
3792
-				   $extra .= "type: 'image',";
3793
-				   $extra .= "render: function (obj) {
3792
+                    $extra .= "type: 'image',";
3793
+                    $extra .= "render: function (obj) {
3794 3794
 						return el( 'div',{},
3795 3795
 						( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3796 3796
 						  className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3816,11 +3816,11 @@  discard block
 block discarded – undo
3816 3816
 
3817 3817
 
3818 3818
 					  }";
3819
-				$onchange = "";
3819
+                $onchange = "";
3820 3820
 
3821
-				//$inside_elements = ",el('div',{},'file upload')";
3822
-			} else if ( $args['type'] == 'images' ) {
3823
-				$img_preview = "props.attributes.$key && (function() {
3821
+                //$inside_elements = ",el('div',{},'file upload')";
3822
+            } else if ( $args['type'] == 'images' ) {
3823
+                $img_preview = "props.attributes.$key && (function() {
3824 3824
 	let uploads = JSON.parse('['+props.attributes.$key+']');
3825 3825
 	let images = [];
3826 3826
 	uploads.map((upload, index) => (
@@ -3847,9 +3847,9 @@  discard block
 block discarded – undo
3847 3847
 })(),";
3848 3848
 
3849 3849
 
3850
-				$value = '""';
3851
-				$type = 'MediaUpload';
3852
-				$extra .= "onSelect: function(media){
3850
+                $value = '""';
3851
+                $type = 'MediaUpload';
3852
+                $extra .= "onSelect: function(media){
3853 3853
 	let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
3854 3854
 	if(media.length){
3855 3855
 		for (var i=0; i < media.length; i++) {
@@ -3862,9 +3862,9 @@  discard block
 block discarded – undo
3862 3862
 	}
3863 3863
 	return props.setAttributes({ $key: slimImagesV});
3864 3864
 },";
3865
-				$extra .= "type: 'image',";
3866
-				$extra .= "multiple: true,";
3867
-				$extra .= "render: function (obj) {
3865
+                $extra .= "type: 'image',";
3866
+                $extra .= "multiple: true,";
3867
+                $extra .= "render: function (obj) {
3868 3868
 	/* Init the sort */
3869 3869
 	enableDragSort('sd-sortable');
3870 3870
 	return el( 'div',{},
@@ -3891,40 +3891,40 @@  discard block
 block discarded – undo
3891 3891
 		)
3892 3892
 	)
3893 3893
 }";
3894
-				$onchange = "";
3894
+                $onchange = "";
3895 3895
 
3896
-				//$inside_elements = ",el('div',{},'file upload')";
3897
-			}
3898
-			elseif ( $args['type'] == 'checkbox' ) {
3899
-				$type = 'CheckboxControl';
3900
-				$extra .= "checked: props.attributes.$key,";
3901
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3902
-			} elseif ( $args['type'] == 'textarea' ) {
3903
-				$type = 'TextareaControl';
3904
-
3905
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3906
-				$type = 'SelectControl';
3907
-
3908
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3909
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3910
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3911
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3912
-				}else {
3913
-
3914
-					if ( ! empty( $args['options'] ) ) {
3915
-						$options .= "options: [";
3916
-						foreach ( $args['options'] as $option_val => $option_label ) {
3917
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3918
-						}
3919
-						$options .= "],";
3920
-					}
3921
-				}
3922
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3923
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3924
-				}
3896
+                //$inside_elements = ",el('div',{},'file upload')";
3897
+            }
3898
+            elseif ( $args['type'] == 'checkbox' ) {
3899
+                $type = 'CheckboxControl';
3900
+                $extra .= "checked: props.attributes.$key,";
3901
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3902
+            } elseif ( $args['type'] == 'textarea' ) {
3903
+                $type = 'TextareaControl';
3904
+
3905
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3906
+                $type = 'SelectControl';
3907
+
3908
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3909
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3910
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3911
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3912
+                }else {
3913
+
3914
+                    if ( ! empty( $args['options'] ) ) {
3915
+                        $options .= "options: [";
3916
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3917
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3918
+                        }
3919
+                        $options .= "],";
3920
+                    }
3921
+                }
3922
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3923
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3924
+                }
3925 3925
 
3926
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3927
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3926
+                if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3927
+                    $after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3928 3928
 									  className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3929 3929
 									  style: {margin:'-8px 0 8px 0',display: 'block'},
3930 3930
 									  onClick: function(){
@@ -3935,8 +3935,8 @@  discard block
 block discarded – undo
3935 3935
 									},
3936 3936
 									'Clear'
3937 3937
 							),";
3938
-				}
3939
-			} elseif ( $args['type'] == 'tagselect' ) {
3938
+                }
3939
+            } elseif ( $args['type'] == 'tagselect' ) {
3940 3940
 //				$type = 'FormTokenField';
3941 3941
 //
3942 3942
 //				if ( ! empty( $args['options'] ) ) {
@@ -3971,20 +3971,20 @@  discard block
 block discarded – undo
3971 3971
 //				$value     = "[]";
3972 3972
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3973 3973
 
3974
-			} else if ( $args['type'] == 'alignment' ) {
3975
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3976
-			} else if ( $args['type'] == 'margins' ) {
3977
-
3978
-			} else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3979
-				$type = 'TextControl';
3980
-				$value = "(props.attributes.$key ? props.attributes.$key : '')";
3981
-				$args['type'] = 'text';
3982
-				$options .= 'disabled:true,';
3983
-				$bsvc_title = esc_attr( addslashes( $args['title'] ) );
3984
-				$bsvc_body = $this->block_visibility_fields( $args );
3985
-				// @TODO reset button
3986
-				$bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3987
-				$after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3974
+            } else if ( $args['type'] == 'alignment' ) {
3975
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3976
+            } else if ( $args['type'] == 'margins' ) {
3977
+
3978
+            } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3979
+                $type = 'TextControl';
3980
+                $value = "(props.attributes.$key ? props.attributes.$key : '')";
3981
+                $args['type'] = 'text';
3982
+                $options .= 'disabled:true,';
3983
+                $bsvc_title = esc_attr( addslashes( $args['title'] ) );
3984
+                $bsvc_body = $this->block_visibility_fields( $args );
3985
+                // @TODO reset button
3986
+                $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3987
+                $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3988 3988
 						className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3989 3989
 						onClick: function() {
3990 3990
 							var sValue = props.attributes." . $key . ";
@@ -4010,39 +4010,39 @@  discard block
 block discarded – undo
4010 4010
 					},
4011 4011
 					'" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "'
4012 4012
 				) ),";
4013
-			} else {
4014
-				return;// if we have not implemented the control then don't break the JS.
4015
-			}
4013
+            } else {
4014
+                return;// if we have not implemented the control then don't break the JS.
4015
+            }
4016 4016
 
4017
-			// color input does not show the labels so we add them
4018
-			if($args['type']=='color'){
4019
-				// add show only if advanced
4020
-				echo $require_advanced;
4021
-				// add setting require if defined
4022
-				echo $element_require;
4023
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
4024
-			}
4017
+            // color input does not show the labels so we add them
4018
+            if($args['type']=='color'){
4019
+                // add show only if advanced
4020
+                echo $require_advanced;
4021
+                // add setting require if defined
4022
+                echo $element_require;
4023
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
4024
+            }
4025 4025
 
4026
-			// add show only if advanced
4027
-			echo $require_advanced;
4028
-			// add setting require if defined
4029
-			echo $element_require;
4030
-			echo $device_type_require;
4026
+            // add show only if advanced
4027
+            echo $require_advanced;
4028
+            // add setting require if defined
4029
+            echo $element_require;
4030
+            echo $device_type_require;
4031 4031
 
4032
-			// icon
4033
-			echo $icon;
4034
-			?>
4032
+            // icon
4033
+            echo $icon;
4034
+            ?>
4035 4035
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
4036 4036
 			label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php
4037
-			} else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4037
+            } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4038 4038
 			help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>,
4039 4039
 			value: <?php echo $value; ?>,
4040 4040
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
4041
-				echo "type: '" . addslashes( $args['type'] ) . "',";
4042
-			} ?>
4041
+                echo "type: '" . addslashes( $args['type'] ) . "',";
4042
+            } ?>
4043 4043
 			<?php if ( ! empty( $args['placeholder'] ) ) {
4044
-				echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4045
-			} ?>
4044
+                echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4045
+            } ?>
4046 4046
 			<?php echo $options; ?>
4047 4047
 			<?php echo $extra; ?>
4048 4048
 			<?php echo $custom_attributes; ?>
@@ -4054,1366 +4054,1366 @@  discard block
 block discarded – undo
4054 4054
 			<?php } ?>
4055 4055
 		} <?php echo $inside_elements; ?> ),
4056 4056
 			<?php
4057
-			echo $after_elements;
4058
-		}
4057
+            echo $after_elements;
4058
+        }
4059 4059
 
4060
-		/**
4061
-		 * Convert an array of attributes to block string.
4062
-		 *
4063
-		 * @param $custom_attributes
4064
-		 *
4065
-		 * @return string
4066
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
4067
-		 *
4068
-		 */
4069
-		public function array_to_attributes( $custom_attributes, $html = false ) {
4070
-			$attributes = '';
4071
-			if ( ! empty( $custom_attributes ) ) {
4072
-
4073
-				foreach ( $custom_attributes as $key => $val ) {
4074
-					if(is_array($val)){
4075
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4076
-					}else{
4077
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4078
-					}
4079
-				}
4060
+        /**
4061
+         * Convert an array of attributes to block string.
4062
+         *
4063
+         * @param $custom_attributes
4064
+         *
4065
+         * @return string
4066
+         *@todo there is prob a faster way to do this, also we could add some validation here.
4067
+         *
4068
+         */
4069
+        public function array_to_attributes( $custom_attributes, $html = false ) {
4070
+            $attributes = '';
4071
+            if ( ! empty( $custom_attributes ) ) {
4072
+
4073
+                foreach ( $custom_attributes as $key => $val ) {
4074
+                    if(is_array($val)){
4075
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4076
+                    }else{
4077
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4078
+                    }
4079
+                }
4080 4080
 
4081
-			}
4081
+            }
4082 4082
 
4083
-			return $attributes;
4084
-		}
4083
+            return $attributes;
4084
+        }
4085 4085
 
4086 4086
 
4087 4087
 
4088
-		/**
4089
-		 * A self looping function to create the output for JS block elements.
4090
-		 *
4091
-		 * This is what is output in the WP Editor visual view.
4092
-		 *
4093
-		 * @param $args
4094
-		 */
4095
-		public function block_element( $args, $save = false ) {
4088
+        /**
4089
+         * A self looping function to create the output for JS block elements.
4090
+         *
4091
+         * This is what is output in the WP Editor visual view.
4092
+         *
4093
+         * @param $args
4094
+         */
4095
+        public function block_element( $args, $save = false ) {
4096 4096
 
4097 4097
 //            print_r($args);echo '###';exit;
4098 4098
 
4099
-			if ( ! empty( $args ) ) {
4100
-				foreach ( $args as $element => $new_args ) {
4099
+            if ( ! empty( $args ) ) {
4100
+                foreach ( $args as $element => $new_args ) {
4101 4101
 
4102
-					if ( is_array( $new_args ) ) { // its an element
4102
+                    if ( is_array( $new_args ) ) { // its an element
4103 4103
 
4104 4104
 
4105
-						if ( isset( $new_args['element'] ) ) {
4105
+                        if ( isset( $new_args['element'] ) ) {
4106 4106
 
4107
-							if ( isset( $new_args['element_require'] ) ) {
4108
-								echo str_replace( array(
4109
-										"'+",
4110
-										"+'"
4111
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4112
-								unset( $new_args['element_require'] );
4113
-							}
4107
+                            if ( isset( $new_args['element_require'] ) ) {
4108
+                                echo str_replace( array(
4109
+                                        "'+",
4110
+                                        "+'"
4111
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4112
+                                unset( $new_args['element_require'] );
4113
+                            }
4114 4114
 
4115
-							if($new_args['element']=='InnerBlocks'){
4116
-								echo "\n el( InnerBlocks, {";
4117
-							}elseif($new_args['element']=='innerBlocksProps'){
4118
-								$element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4119
-							  //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4115
+                            if($new_args['element']=='InnerBlocks'){
4116
+                                echo "\n el( InnerBlocks, {";
4117
+                            }elseif($new_args['element']=='innerBlocksProps'){
4118
+                                $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4119
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4120 4120
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4121
-								echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4122
-								echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4123
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4124
-
4125
-								echo "} ), {";
4126
-								echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4127
-							//    echo '###';
4121
+                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4122
+                                echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4123
+                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4124
+
4125
+                                echo "} ), {";
4126
+                                echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4127
+                            //    echo '###';
4128
+
4129
+                                //  echo '###';
4130
+                            }elseif($new_args['element']=='BlocksProps'){
4131
+
4132
+                                if ( isset($new_args['if_inner_element']) ) {
4133
+                                    $element = $new_args['if_inner_element'];
4134
+                                }else {
4135
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4136
+                                }
4137
+
4138
+                                unset($new_args['inner_element']);
4139
+                                echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4140
+                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4141
+
4142
+
4143
+                                // echo "} ),";
4144
+
4145
+                            }else{
4146
+                                echo "\n el( '" . $new_args['element'] . "', {";
4147
+                            }
4148
+
4149
+
4150
+                            // get the attributes
4151
+                            foreach ( $new_args as $new_key => $new_value ) {
4152
+
4153
+
4154
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4155
+                                    // do nothing
4156
+                                } else {
4157
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
4158
+                                }
4159
+                            }
4160
+
4161
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4162
+
4163
+                            // get the content
4164
+                            $first_item = 0;
4165
+                            foreach ( $new_args as $new_key => $new_value ) {
4166
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4167
+
4168
+                                    if ( $new_key === 'content' ) {
4169
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4170
+                                    }else if ( $new_key === 'if_content' ) {
4171
+                                        echo  $this->block_props_replace(  $new_value  );
4172
+                                    }
4173
+
4174
+                                    if ( is_array( $new_value ) ) {
4175
+
4176
+                                        if ( isset( $new_value['element_require'] ) ) {
4177
+                                            echo str_replace( array(
4178
+                                                    "'+",
4179
+                                                    "+'"
4180
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4181
+                                            unset( $new_value['element_require'] );
4182
+                                        }
4183
+
4184
+                                        if ( isset( $new_value['element_repeat'] ) ) {
4185
+                                            $x = 1;
4186
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
4187
+                                                $this->block_element( array( '' => $new_value ),$save );
4188
+                                                $x ++;
4189
+                                            }
4190
+                                        } else {
4191
+                                            $this->block_element( array( '' => $new_value ),$save );
4192
+                                        }
4193
+                                    }
4194
+                                    $first_item ++;
4195
+                                }
4196
+                            }
4197
+
4198
+                            if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4199
+                                echo "))";// end content
4200
+                            }else{
4201
+                                echo ")";// end content
4202
+                            }
4203
+
4204
+
4205
+                            echo ", \n";
4206
+
4207
+                        }
4208
+                    } else {
4209
+
4210
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
4211
+                            $extra = '';
4212
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
4213
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4214
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4215
+                            }
4216
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4217
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4218
+                            $new_args = str_replace('[%WrapStyle%]','',$new_args);
4219
+                            echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4220
+//                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4221
+                        } elseif ( $element == 'style' ) {
4222
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4223
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4224
+                            $new_args = str_replace('[%WrapClass%]','',$new_args);
4225
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4226
+                        } elseif ( $element == 'template' && $new_args ) {
4227
+                            echo $element . ": $new_args,";
4228
+                        } else {
4229
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4230
+                        }
4231
+
4232
+                    }
4233
+                }
4234
+            }
4235
+        }
4128 4236
 
4129
-							  //  echo '###';
4130
-							}elseif($new_args['element']=='BlocksProps'){
4131
-
4132
-								if ( isset($new_args['if_inner_element']) ) {
4133
-									$element = $new_args['if_inner_element'];
4134
-								}else {
4135
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4136
-								}
4137
-
4138
-								unset($new_args['inner_element']);
4139
-								echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4140
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4141
-
4142
-
4143
-							   // echo "} ),";
4144
-
4145
-							}else{
4146
-								echo "\n el( '" . $new_args['element'] . "', {";
4147
-							}
4148
-
4149
-
4150
-							// get the attributes
4151
-							foreach ( $new_args as $new_key => $new_value ) {
4152
-
4153
-
4154
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4155
-									// do nothing
4156
-								} else {
4157
-									echo $this->block_element( array( $new_key => $new_value ),$save );
4158
-								}
4159
-							}
4160
-
4161
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4162
-
4163
-							// get the content
4164
-							$first_item = 0;
4165
-							foreach ( $new_args as $new_key => $new_value ) {
4166
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4167
-
4168
-									if ( $new_key === 'content' ) {
4169
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4170
-									}else if ( $new_key === 'if_content' ) {
4171
-										echo  $this->block_props_replace(  $new_value  );
4172
-									}
4173
-
4174
-									if ( is_array( $new_value ) ) {
4175
-
4176
-										if ( isset( $new_value['element_require'] ) ) {
4177
-											echo str_replace( array(
4178
-													"'+",
4179
-													"+'"
4180
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4181
-											unset( $new_value['element_require'] );
4182
-										}
4183
-
4184
-										if ( isset( $new_value['element_repeat'] ) ) {
4185
-											$x = 1;
4186
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
4187
-												$this->block_element( array( '' => $new_value ),$save );
4188
-												$x ++;
4189
-											}
4190
-										} else {
4191
-											$this->block_element( array( '' => $new_value ),$save );
4192
-										}
4193
-									}
4194
-									$first_item ++;
4195
-								}
4196
-							}
4197
-
4198
-							if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4199
-								echo "))";// end content
4200
-							}else{
4201
-								echo ")";// end content
4202
-							}
4203
-
4204
-
4205
-							echo ", \n";
4206
-
4207
-						}
4208
-					} else {
4209
-
4210
-						if ( substr( $element, 0, 3 ) === "if_" ) {
4211
-							$extra = '';
4212
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
4213
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4214
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4215
-							}
4216
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4217
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4218
-							$new_args = str_replace('[%WrapStyle%]','',$new_args);
4219
-							echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4220
-//                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4221
-						} elseif ( $element == 'style' ) {
4222
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4223
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4224
-							$new_args = str_replace('[%WrapClass%]','',$new_args);
4225
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4226
-						} elseif ( $element == 'template' && $new_args ) {
4227
-							echo $element . ": $new_args,";
4228
-						} else {
4229
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4230
-						}
4231
-
4232
-					}
4233
-				}
4234
-			}
4235
-		}
4236
-
4237
-		/**
4238
-		 * Replace block attributes placeholders with the proper naming.
4239
-		 *
4240
-		 * @param $string
4241
-		 *
4242
-		 * @return mixed
4243
-		 */
4244
-		public function block_props_replace( $string, $no_wrap = false ) {
4245
-			if ( $no_wrap ) {
4246
-				$string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4247
-			} else {
4248
-				$string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4249
-			}
4237
+        /**
4238
+         * Replace block attributes placeholders with the proper naming.
4239
+         *
4240
+         * @param $string
4241
+         *
4242
+         * @return mixed
4243
+         */
4244
+        public function block_props_replace( $string, $no_wrap = false ) {
4245
+            if ( $no_wrap ) {
4246
+                $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4247
+            } else {
4248
+                $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4249
+            }
4250 4250
 
4251
-			return $string;
4252
-		}
4251
+            return $string;
4252
+        }
4253 4253
 
4254
-		/**
4255
-		 * Outputs the content of the widget
4256
-		 *
4257
-		 * @param array $args
4258
-		 * @param array $instance
4259
-		 */
4260
-		public function widget( $args, $instance ) {
4261
-			if ( ! is_array( $args ) ) {
4262
-				$args = array();
4263
-			}
4254
+        /**
4255
+         * Outputs the content of the widget
4256
+         *
4257
+         * @param array $args
4258
+         * @param array $instance
4259
+         */
4260
+        public function widget( $args, $instance ) {
4261
+            if ( ! is_array( $args ) ) {
4262
+                $args = array();
4263
+            }
4264 4264
 
4265
-			// Get the filtered values
4266
-			$argument_values = $this->argument_values( $instance );
4267
-			$argument_values = $this->string_to_bool( $argument_values );
4268
-			$output          = $this->output( $argument_values, $args );
4265
+            // Get the filtered values
4266
+            $argument_values = $this->argument_values( $instance );
4267
+            $argument_values = $this->string_to_bool( $argument_values );
4268
+            $output          = $this->output( $argument_values, $args );
4269 4269
 
4270
-			$no_wrap = false;
4271
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4272
-				$no_wrap = true;
4273
-			}
4270
+            $no_wrap = false;
4271
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4272
+                $no_wrap = true;
4273
+            }
4274 4274
 
4275
-			ob_start();
4276
-			if ( $output && ! $no_wrap ) {
4275
+            ob_start();
4276
+            if ( $output && ! $no_wrap ) {
4277 4277
 
4278
-				$class_original = $this->options['widget_ops']['classname'];
4279
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4278
+                $class_original = $this->options['widget_ops']['classname'];
4279
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4280 4280
 
4281
-				// Before widget
4282
-				$before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4283
-				$before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4284
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4285
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4281
+                // Before widget
4282
+                $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4283
+                $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4284
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4285
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4286 4286
 
4287
-				// After widget
4288
-				$after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4289
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4290
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4287
+                // After widget
4288
+                $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4289
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4290
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4291 4291
 
4292
-				echo $before_widget;
4293
-				// elementor strips the widget wrapping div so we check for and add it back if needed
4294
-				if ( $this->is_elementor_widget_output() ) {
4295
-					// Filter class & attrs for elementor widget output.
4296
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4297
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4292
+                echo $before_widget;
4293
+                // elementor strips the widget wrapping div so we check for and add it back if needed
4294
+                if ( $this->is_elementor_widget_output() ) {
4295
+                    // Filter class & attrs for elementor widget output.
4296
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4297
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4298 4298
 
4299
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4300
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4299
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4300
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4301 4301
 
4302
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4303
-				}
4304
-				echo $this->output_title( $args, $instance );
4305
-				echo $output;
4306
-				if ( $this->is_elementor_widget_output() ) {
4307
-					echo "</span>";
4308
-				}
4309
-				echo $after_widget;
4310
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4311
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4312
-				echo $output;
4313
-			} elseif ( $output && $no_wrap ) {
4314
-				echo $output;
4315
-			}
4316
-			$output = ob_get_clean();
4302
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4303
+                }
4304
+                echo $this->output_title( $args, $instance );
4305
+                echo $output;
4306
+                if ( $this->is_elementor_widget_output() ) {
4307
+                    echo "</span>";
4308
+                }
4309
+                echo $after_widget;
4310
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4311
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4312
+                echo $output;
4313
+            } elseif ( $output && $no_wrap ) {
4314
+                echo $output;
4315
+            }
4316
+            $output = ob_get_clean();
4317 4317
 
4318
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4318
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4319 4319
 
4320
-			echo $output;
4321
-		}
4320
+            echo $output;
4321
+        }
4322 4322
 
4323
-		/**
4324
-		 * Tests if the current output is inside a elementor container.
4325
-		 *
4326
-		 * @return bool
4327
-		 *@since 1.0.4
4328
-		 */
4329
-		public function is_elementor_widget_output() {
4330
-			$result = false;
4331
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4332
-				$result = true;
4333
-			}
4323
+        /**
4324
+         * Tests if the current output is inside a elementor container.
4325
+         *
4326
+         * @return bool
4327
+         *@since 1.0.4
4328
+         */
4329
+        public function is_elementor_widget_output() {
4330
+            $result = false;
4331
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4332
+                $result = true;
4333
+            }
4334 4334
 
4335
-			return $result;
4336
-		}
4335
+            return $result;
4336
+        }
4337 4337
 
4338
-		/**
4339
-		 * Tests if the current output is inside a elementor preview.
4340
-		 *
4341
-		 * @return bool
4342
-		 *@since 1.0.4
4343
-		 */
4344
-		public function is_elementor_preview() {
4345
-			$result = false;
4346
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4347
-				$result = true;
4348
-			}
4338
+        /**
4339
+         * Tests if the current output is inside a elementor preview.
4340
+         *
4341
+         * @return bool
4342
+         *@since 1.0.4
4343
+         */
4344
+        public function is_elementor_preview() {
4345
+            $result = false;
4346
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4347
+                $result = true;
4348
+            }
4349 4349
 
4350
-			return $result;
4351
-		}
4350
+            return $result;
4351
+        }
4352 4352
 
4353
-		/**
4354
-		 * Tests if the current output is inside a Divi preview.
4355
-		 *
4356
-		 * @return bool
4357
-		 *@since 1.0.6
4358
-		 */
4359
-		public function is_divi_preview() {
4360
-			$result = false;
4361
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4362
-				$result = true;
4363
-			}
4353
+        /**
4354
+         * Tests if the current output is inside a Divi preview.
4355
+         *
4356
+         * @return bool
4357
+         *@since 1.0.6
4358
+         */
4359
+        public function is_divi_preview() {
4360
+            $result = false;
4361
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4362
+                $result = true;
4363
+            }
4364 4364
 
4365
-			return $result;
4366
-		}
4365
+            return $result;
4366
+        }
4367 4367
 
4368
-		/**
4369
-		 * Tests if the current output is inside a Beaver builder preview.
4370
-		 *
4371
-		 * @return bool
4372
-		 *@since 1.0.6
4373
-		 */
4374
-		public function is_beaver_preview() {
4375
-			$result = false;
4376
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
4377
-				$result = true;
4378
-			}
4368
+        /**
4369
+         * Tests if the current output is inside a Beaver builder preview.
4370
+         *
4371
+         * @return bool
4372
+         *@since 1.0.6
4373
+         */
4374
+        public function is_beaver_preview() {
4375
+            $result = false;
4376
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
4377
+                $result = true;
4378
+            }
4379 4379
 
4380
-			return $result;
4381
-		}
4380
+            return $result;
4381
+        }
4382 4382
 
4383
-		/**
4384
-		 * Tests if the current output is inside a siteorigin builder preview.
4385
-		 *
4386
-		 * @return bool
4387
-		 *@since 1.0.6
4388
-		 */
4389
-		public function is_siteorigin_preview() {
4390
-			$result = false;
4391
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4392
-				$result = true;
4393
-			}
4383
+        /**
4384
+         * Tests if the current output is inside a siteorigin builder preview.
4385
+         *
4386
+         * @return bool
4387
+         *@since 1.0.6
4388
+         */
4389
+        public function is_siteorigin_preview() {
4390
+            $result = false;
4391
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4392
+                $result = true;
4393
+            }
4394 4394
 
4395
-			return $result;
4396
-		}
4395
+            return $result;
4396
+        }
4397 4397
 
4398
-		/**
4399
-		 * Tests if the current output is inside a cornerstone builder preview.
4400
-		 *
4401
-		 * @return bool
4402
-		 *@since 1.0.8
4403
-		 */
4404
-		public function is_cornerstone_preview() {
4405
-			$result = false;
4406
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4407
-				$result = true;
4408
-			}
4398
+        /**
4399
+         * Tests if the current output is inside a cornerstone builder preview.
4400
+         *
4401
+         * @return bool
4402
+         *@since 1.0.8
4403
+         */
4404
+        public function is_cornerstone_preview() {
4405
+            $result = false;
4406
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4407
+                $result = true;
4408
+            }
4409 4409
 
4410
-			return $result;
4411
-		}
4410
+            return $result;
4411
+        }
4412 4412
 
4413
-		/**
4414
-		 * Tests if the current output is inside a fusion builder preview.
4415
-		 *
4416
-		 * @return bool
4417
-		 *@since 1.1.0
4418
-		 */
4419
-		public function is_fusion_preview() {
4420
-			$result = false;
4421
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4422
-				$result = true;
4423
-			}
4413
+        /**
4414
+         * Tests if the current output is inside a fusion builder preview.
4415
+         *
4416
+         * @return bool
4417
+         *@since 1.1.0
4418
+         */
4419
+        public function is_fusion_preview() {
4420
+            $result = false;
4421
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4422
+                $result = true;
4423
+            }
4424 4424
 
4425
-			return $result;
4426
-		}
4425
+            return $result;
4426
+        }
4427 4427
 
4428
-		/**
4429
-		 * Tests if the current output is inside a Oxygen builder preview.
4430
-		 *
4431
-		 * @return bool
4432
-		 *@since 1.0.18
4433
-		 */
4434
-		public function is_oxygen_preview() {
4435
-			$result = false;
4436
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4437
-				$result = true;
4438
-			}
4428
+        /**
4429
+         * Tests if the current output is inside a Oxygen builder preview.
4430
+         *
4431
+         * @return bool
4432
+         *@since 1.0.18
4433
+         */
4434
+        public function is_oxygen_preview() {
4435
+            $result = false;
4436
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4437
+                $result = true;
4438
+            }
4439 4439
 
4440
-			return $result;
4441
-		}
4440
+            return $result;
4441
+        }
4442 4442
 
4443
-		/**
4444
-		 * Check for Kallyas theme Zion builder preview.
4445
-		 *
4446
-		 * @since 1.1.22
4447
-		 *
4448
-		 * @return bool True when preview page otherwise false.
4449
-		 */
4450
-		public function is_kallyas_zion_preview() {
4451
-			$result = false;
4452
-
4453
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4454
-				$result = true;
4455
-			}
4443
+        /**
4444
+         * Check for Kallyas theme Zion builder preview.
4445
+         *
4446
+         * @since 1.1.22
4447
+         *
4448
+         * @return bool True when preview page otherwise false.
4449
+         */
4450
+        public function is_kallyas_zion_preview() {
4451
+            $result = false;
4456 4452
 
4457
-			return $result;
4458
-		}
4453
+            if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4454
+                $result = true;
4455
+            }
4459 4456
 
4460
-		/**
4461
-		 * Check for Bricks theme builder preview.
4462
-		 *
4463
-		 * @since 1.1.31
4464
-		 *
4465
-		 * @return bool True when preview page otherwise false.
4466
-		 */
4467
-		public function is_bricks_preview() {
4468
-			$result = false;
4469
-
4470
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4471
-				$result = true;
4472
-			}
4457
+            return $result;
4458
+        }
4473 4459
 
4474
-			return $result;
4475
-		}
4460
+        /**
4461
+         * Check for Bricks theme builder preview.
4462
+         *
4463
+         * @since 1.1.31
4464
+         *
4465
+         * @return bool True when preview page otherwise false.
4466
+         */
4467
+        public function is_bricks_preview() {
4468
+            $result = false;
4476 4469
 
4477
-		/**
4478
-		 * General function to check if we are in a preview situation.
4479
-		 *
4480
-		 * @return bool
4481
-		 *@since 1.0.6
4482
-		 */
4483
-		public function is_preview() {
4484
-			$preview = false;
4485
-			if ( $this->is_divi_preview() ) {
4486
-				$preview = true;
4487
-			} elseif ( $this->is_elementor_preview() ) {
4488
-				$preview = true;
4489
-			} elseif ( $this->is_beaver_preview() ) {
4490
-				$preview = true;
4491
-			} elseif ( $this->is_siteorigin_preview() ) {
4492
-				$preview = true;
4493
-			} elseif ( $this->is_cornerstone_preview() ) {
4494
-				$preview = true;
4495
-			} elseif ( $this->is_fusion_preview() ) {
4496
-				$preview = true;
4497
-			} elseif ( $this->is_oxygen_preview() ) {
4498
-				$preview = true;
4499
-			} elseif( $this->is_kallyas_zion_preview() ) {
4500
-				$preview = true;
4501
-			} elseif( $this->is_block_content_call() ) {
4502
-				$preview = true;
4503
-			} elseif( $this->is_bricks_preview() ) {
4504
-				$preview = true;
4505
-			}
4470
+            if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4471
+                $result = true;
4472
+            }
4506 4473
 
4507
-			return $preview;
4508
-		}
4474
+            return $result;
4475
+        }
4509 4476
 
4510
-		/**
4511
-		 * Output the super title.
4512
-		 *
4513
-		 * @param $args
4514
-		 * @param array $instance
4515
-		 *
4516
-		 * @return string
4517
-		 */
4518
-		public function output_title( $args, $instance = array() ) {
4519
-			$output = '';
4520
-			if ( ! empty( $instance['title'] ) ) {
4521
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4522
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4523
-
4524
-				if ( empty( $instance['widget_title_tag'] ) ) {
4525
-					if ( ! isset( $args['before_title'] ) ) {
4526
-						$args['before_title'] = '';
4527
-					}
4477
+        /**
4478
+         * General function to check if we are in a preview situation.
4479
+         *
4480
+         * @return bool
4481
+         *@since 1.0.6
4482
+         */
4483
+        public function is_preview() {
4484
+            $preview = false;
4485
+            if ( $this->is_divi_preview() ) {
4486
+                $preview = true;
4487
+            } elseif ( $this->is_elementor_preview() ) {
4488
+                $preview = true;
4489
+            } elseif ( $this->is_beaver_preview() ) {
4490
+                $preview = true;
4491
+            } elseif ( $this->is_siteorigin_preview() ) {
4492
+                $preview = true;
4493
+            } elseif ( $this->is_cornerstone_preview() ) {
4494
+                $preview = true;
4495
+            } elseif ( $this->is_fusion_preview() ) {
4496
+                $preview = true;
4497
+            } elseif ( $this->is_oxygen_preview() ) {
4498
+                $preview = true;
4499
+            } elseif( $this->is_kallyas_zion_preview() ) {
4500
+                $preview = true;
4501
+            } elseif( $this->is_block_content_call() ) {
4502
+                $preview = true;
4503
+            } elseif( $this->is_bricks_preview() ) {
4504
+                $preview = true;
4505
+            }
4528 4506
 
4529
-					if ( ! isset( $args['after_title'] ) ) {
4530
-						$args['after_title'] = '';
4531
-					}
4507
+            return $preview;
4508
+        }
4532 4509
 
4533
-					$output = $args['before_title'] . $title . $args['after_title'];
4534
-				} else {
4535
-					$tag 			= esc_attr( $instance['widget_title_tag'] );
4536
-					$allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4537
-					$title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4538
-
4539
-					// classes
4540
-					$title_classes = array();
4541
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4542
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4543
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4544
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4545
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4546
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4547
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4548
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4549
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4550
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4551
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4552
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4553
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4554
-
4555
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4556
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
4557
-				}
4510
+        /**
4511
+         * Output the super title.
4512
+         *
4513
+         * @param $args
4514
+         * @param array $instance
4515
+         *
4516
+         * @return string
4517
+         */
4518
+        public function output_title( $args, $instance = array() ) {
4519
+            $output = '';
4520
+            if ( ! empty( $instance['title'] ) ) {
4521
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4522
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4523
+
4524
+                if ( empty( $instance['widget_title_tag'] ) ) {
4525
+                    if ( ! isset( $args['before_title'] ) ) {
4526
+                        $args['before_title'] = '';
4527
+                    }
4528
+
4529
+                    if ( ! isset( $args['after_title'] ) ) {
4530
+                        $args['after_title'] = '';
4531
+                    }
4532
+
4533
+                    $output = $args['before_title'] . $title . $args['after_title'];
4534
+                } else {
4535
+                    $tag 			= esc_attr( $instance['widget_title_tag'] );
4536
+                    $allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4537
+                    $title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4538
+
4539
+                    // classes
4540
+                    $title_classes = array();
4541
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4542
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4543
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4544
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4545
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4546
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4547
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4548
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4549
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4550
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4551
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4552
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4553
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4554
+
4555
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4556
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
4557
+                }
4558 4558
 
4559
-			}
4559
+            }
4560 4560
 
4561
-			return $output;
4562
-		}
4561
+            return $output;
4562
+        }
4563 4563
 
4564
-		/**
4565
-		 * Outputs the options form inputs for the widget.
4566
-		 *
4567
-		 * @param array $instance The widget options.
4568
-		 */
4569
-		public function form( $instance ) {
4564
+        /**
4565
+         * Outputs the options form inputs for the widget.
4566
+         *
4567
+         * @param array $instance The widget options.
4568
+         */
4569
+        public function form( $instance ) {
4570 4570
 
4571
-			// set widget instance
4572
-			$this->instance = $instance;
4571
+            // set widget instance
4572
+            $this->instance = $instance;
4573 4573
 
4574
-			// set it as a SD widget
4575
-			echo $this->widget_advanced_toggle();
4574
+            // set it as a SD widget
4575
+            echo $this->widget_advanced_toggle();
4576 4576
 
4577
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4578
-			$arguments_raw = $this->get_arguments();
4577
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4578
+            $arguments_raw = $this->get_arguments();
4579 4579
 
4580
-			if ( is_array( $arguments_raw ) ) {
4580
+            if ( is_array( $arguments_raw ) ) {
4581 4581
 
4582
-				$arguments = $this->group_arguments( $arguments_raw );
4582
+                $arguments = $this->group_arguments( $arguments_raw );
4583 4583
 
4584
-				// Do we have sections?
4585
-				$has_sections = $arguments == $arguments_raw ? false : true;
4584
+                // Do we have sections?
4585
+                $has_sections = $arguments == $arguments_raw ? false : true;
4586 4586
 
4587 4587
 
4588
-				if ( $has_sections ) {
4589
-					$panel_count = 0;
4590
-					foreach ( $arguments as $key => $args ) {
4588
+                if ( $has_sections ) {
4589
+                    $panel_count = 0;
4590
+                    foreach ( $arguments as $key => $args ) {
4591 4591
 
4592
-						?>
4592
+                        ?>
4593 4593
 						<script>
4594 4594
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
4595 4595
 						</script>
4596 4596
 						<?php
4597 4597
 
4598
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
4599
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4600
-						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>";
4601
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4598
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
4599
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4600
+                        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>";
4601
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4602 4602
 
4603
-						foreach ( $args as $k => $a ) {
4603
+                        foreach ( $args as $k => $a ) {
4604 4604
 
4605
-							$this->widget_inputs_row_start($k, $a);
4606
-							$this->widget_inputs( $a, $instance );
4607
-							$this->widget_inputs_row_end($k, $a);
4605
+                            $this->widget_inputs_row_start($k, $a);
4606
+                            $this->widget_inputs( $a, $instance );
4607
+                            $this->widget_inputs_row_end($k, $a);
4608 4608
 
4609
-						}
4609
+                        }
4610 4610
 
4611
-						echo "</div>";
4611
+                        echo "</div>";
4612 4612
 
4613
-						$panel_count ++;
4613
+                        $panel_count ++;
4614 4614
 
4615
-					}
4616
-				} else {
4617
-					foreach ( $arguments as $key => $args ) {
4618
-						$this->widget_inputs_row_start($key, $args);
4619
-						$this->widget_inputs( $args, $instance );
4620
-						$this->widget_inputs_row_end($key, $args);
4621
-					}
4622
-				}
4615
+                    }
4616
+                } else {
4617
+                    foreach ( $arguments as $key => $args ) {
4618
+                        $this->widget_inputs_row_start($key, $args);
4619
+                        $this->widget_inputs( $args, $instance );
4620
+                        $this->widget_inputs_row_end($key, $args);
4621
+                    }
4622
+                }
4623 4623
 
4624
-			}
4625
-		}
4624
+            }
4625
+        }
4626 4626
 
4627
-		public function widget_inputs_row_start( $key, $args ) {
4628
-			if ( ! empty( $args['row'] ) ) {
4629
-				// Maybe open
4630
-				if ( ! empty( $args['row']['open'] ) ) {
4631
-					?>
4627
+        public function widget_inputs_row_start( $key, $args ) {
4628
+            if ( ! empty( $args['row'] ) ) {
4629
+                // Maybe open
4630
+                if ( ! empty( $args['row']['open'] ) ) {
4631
+                    ?>
4632 4632
 					<div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'>
4633 4633
 					<?php if ( ! empty( $args['row']['title'] ) ) { ?>
4634 4634
 					<?php
4635
-						if ( isset( $args['row']['icon'] ) ) {
4636
-							$args['row']['icon'] = '';
4637
-						}
4638
-
4639
-						if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4640
-							$args['row']['device_type'] = $args['device_type'];
4641
-						}
4642
-					?>
4635
+                        if ( isset( $args['row']['icon'] ) ) {
4636
+                            $args['row']['icon'] = '';
4637
+                        }
4638
+
4639
+                        if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4640
+                            $args['row']['device_type'] = $args['device_type'];
4641
+                        }
4642
+                    ?>
4643 4643
 					<label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4644 4644
 					<?php } ?>
4645 4645
 					<div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'>
4646 4646
 					<div class='col pr-2'>
4647 4647
 					<?php
4648
-				} else if ( ! empty( $args['row']['close'] ) ) {
4649
-					echo "<div class='col pl-0 ps-0'>";
4650
-				} else {
4651
-					echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4652
-				}
4653
-			}
4654
-		}
4648
+                } else if ( ! empty( $args['row']['close'] ) ) {
4649
+                    echo "<div class='col pl-0 ps-0'>";
4650
+                } else {
4651
+                    echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4652
+                }
4653
+            }
4654
+        }
4655 4655
 
4656
-		public function widget_inputs_row_end( $key, $args ) {
4657
-			if ( ! empty( $args['row'] ) ) {
4658
-				// Maybe close
4659
-				if ( ! empty( $args['row']['close'] ) ) {
4660
-					echo "</div></div>";
4661
-				}
4662
-				echo "</div>";
4663
-			}
4664
-		}
4656
+        public function widget_inputs_row_end( $key, $args ) {
4657
+            if ( ! empty( $args['row'] ) ) {
4658
+                // Maybe close
4659
+                if ( ! empty( $args['row']['close'] ) ) {
4660
+                    echo "</div></div>";
4661
+                }
4662
+                echo "</div>";
4663
+            }
4664
+        }
4665 4665
 
4666
-		/**
4667
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
4668
-		 *
4669
-		 * @return string
4670
-		 */
4671
-		public function widget_advanced_toggle() {
4666
+        /**
4667
+         * Get the hidden input that when added makes the advanced button show on widget settings.
4668
+         *
4669
+         * @return string
4670
+         */
4671
+        public function widget_advanced_toggle() {
4672 4672
 
4673
-			$output = '';
4674
-			if ( $this->block_show_advanced() ) {
4675
-				$val = 1;
4676
-			} else {
4677
-				$val = 0;
4678
-			}
4673
+            $output = '';
4674
+            if ( $this->block_show_advanced() ) {
4675
+                $val = 1;
4676
+            } else {
4677
+                $val = 0;
4678
+            }
4679 4679
 
4680
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4680
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4681 4681
 
4682
-			return $output;
4683
-		}
4682
+            return $output;
4683
+        }
4684 4684
 
4685
-		/**
4686
-		 * Convert require element.
4687
-		 *
4688
-		 * @param string $input Input element.
4689
-		 *
4690
-		 * @return string $output
4691
-		 *@since 1.0.0
4692
-		 *
4693
-		 */
4694
-		public function convert_element_require( $input ) {
4695
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4696
-
4697
-			$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4698
-				"jQuery(form).find('[data-argument=\"",
4699
-				"\"]').find('input,select,textarea').val()",
4700
-				"\"]').find('input:checked').val()"
4701
-			), $input ) );
4702
-
4703
-			return $output;
4704
-		}
4685
+        /**
4686
+         * Convert require element.
4687
+         *
4688
+         * @param string $input Input element.
4689
+         *
4690
+         * @return string $output
4691
+         *@since 1.0.0
4692
+         *
4693
+         */
4694
+        public function convert_element_require( $input ) {
4695
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4705 4696
 
4706
-		/**
4707
-		 * Builds the inputs for the widget options.
4708
-		 *
4709
-		 * @param $args
4710
-		 * @param $instance
4711
-		 */
4712
-		public function widget_inputs( $args, $instance ) {
4713
-
4714
-			$class             = "";
4715
-			$element_require   = "";
4716
-			$custom_attributes = "";
4717
-
4718
-			// get value
4719
-			if ( isset( $instance[ $args['name'] ] ) ) {
4720
-				$value = $instance[ $args['name'] ];
4721
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4722
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4723
-			} else {
4724
-				$value = '';
4725
-			}
4697
+            $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4698
+                "jQuery(form).find('[data-argument=\"",
4699
+                "\"]').find('input,select,textarea').val()",
4700
+                "\"]').find('input:checked').val()"
4701
+            ), $input ) );
4726 4702
 
4727
-			// get placeholder
4728
-			if ( ! empty( $args['placeholder'] ) ) {
4729
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4730
-			} else {
4731
-				$placeholder = '';
4732
-			}
4703
+            return $output;
4704
+        }
4733 4705
 
4734
-			// get if advanced
4735
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4736
-				$class .= " sd-advanced-setting ";
4737
-			}
4706
+        /**
4707
+         * Builds the inputs for the widget options.
4708
+         *
4709
+         * @param $args
4710
+         * @param $instance
4711
+         */
4712
+        public function widget_inputs( $args, $instance ) {
4713
+
4714
+            $class             = "";
4715
+            $element_require   = "";
4716
+            $custom_attributes = "";
4717
+
4718
+            // get value
4719
+            if ( isset( $instance[ $args['name'] ] ) ) {
4720
+                $value = $instance[ $args['name'] ];
4721
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4722
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4723
+            } else {
4724
+                $value = '';
4725
+            }
4738 4726
 
4739
-			// element_require
4740
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4741
-				$element_require = $args['element_require'];
4742
-			}
4727
+            // get placeholder
4728
+            if ( ! empty( $args['placeholder'] ) ) {
4729
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4730
+            } else {
4731
+                $placeholder = '';
4732
+            }
4743 4733
 
4744
-			// custom_attributes
4745
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4746
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4747
-			}
4734
+            // get if advanced
4735
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4736
+                $class .= " sd-advanced-setting ";
4737
+            }
4738
+
4739
+            // element_require
4740
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4741
+                $element_require = $args['element_require'];
4742
+            }
4743
+
4744
+            // custom_attributes
4745
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4746
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4747
+            }
4748 4748
 
4749
-			// before wrapper
4750
-			?>
4749
+            // before wrapper
4750
+            ?>
4751 4751
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'>
4752 4752
 			<?php
4753
-			switch ( $args['type'] ) {
4754
-				//array('text','password','number','email','tel','url','color')
4755
-				case "text":
4756
-				case "password":
4757
-				case "number":
4758
-				case "email":
4759
-				case "tel":
4760
-				case "url":
4761
-				case "color":
4762
-					?>
4753
+            switch ( $args['type'] ) {
4754
+                //array('text','password','number','email','tel','url','color')
4755
+                case "text":
4756
+                case "password":
4757
+                case "number":
4758
+                case "email":
4759
+                case "tel":
4760
+                case "url":
4761
+                case "color":
4762
+                    ?>
4763 4763
 					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4764 4764
 					<input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="<?php echo esc_attr( $args['type'] ); ?>" value="<?php echo esc_attr( $value ); ?>">
4765 4765
 					<?php
4766 4766
 
4767
-					break;
4768
-				case "select":
4769
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4770
-					if ( $multiple ) {
4771
-						if ( empty( $value ) ) {
4772
-							$value = array();
4773
-						}
4774
-					}
4775
-					?>
4767
+                    break;
4768
+                case "select":
4769
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4770
+                    if ( $multiple ) {
4771
+                        if ( empty( $value ) ) {
4772
+                            $value = array();
4773
+                        }
4774
+                    }
4775
+                    ?>
4776 4776
 					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4777 4777
 					<select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); if ( $multiple ) { echo "[]"; } ?>"
4778 4778
 						<?php if ( $multiple ) {
4779
-							echo "multiple";
4780
-						} //@todo not implemented yet due to gutenberg not supporting it
4781
-						?>>
4779
+                            echo "multiple";
4780
+                        } //@todo not implemented yet due to gutenberg not supporting it
4781
+                        ?>>
4782 4782
 						<?php
4783 4783
 
4784
-						if ( ! empty( $args['options'] ) ) {
4785
-							foreach ( $args['options'] as $val => $label ) {
4786
-								if ( $multiple ) {
4787
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4788
-								} else {
4789
-									$selected = selected( $value, $val, false );
4790
-								}
4791
-								echo "<option value='$val' " . $selected . ">$label</option>";
4792
-							}
4793
-						}
4794
-						?>
4784
+                        if ( ! empty( $args['options'] ) ) {
4785
+                            foreach ( $args['options'] as $val => $label ) {
4786
+                                if ( $multiple ) {
4787
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4788
+                                } else {
4789
+                                    $selected = selected( $value, $val, false );
4790
+                                }
4791
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4792
+                            }
4793
+                        }
4794
+                        ?>
4795 4795
 					</select>
4796 4796
 					<?php
4797
-					break;
4798
-				case "checkbox":
4799
-					?>
4797
+                    break;
4798
+                case "checkbox":
4799
+                    ?>
4800 4800
 					<input <?php echo $placeholder; ?> <?php checked( 1, $value, true ) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1">
4801 4801
 					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4802 4802
 					<?php
4803
-					break;
4804
-				case "textarea":
4805
-					?>
4803
+                    break;
4804
+                case "textarea":
4805
+                    ?>
4806 4806
 					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4807 4807
 					<textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"><?php echo esc_attr( $value ); ?></textarea>
4808 4808
 					<?php
4809 4809
 
4810
-					break;
4811
-				case "hidden":
4812
-					?>
4810
+                    break;
4811
+                case "hidden":
4812
+                    ?>
4813 4813
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>">
4814 4814
 					<?php
4815
-					break;
4816
-				default:
4817
-					echo "No input type found!"; // @todo we need to add more input types.
4818
-			}
4819
-			// after wrapper
4820
-			?></p><?php
4821
-		}
4815
+                    break;
4816
+                default:
4817
+                    echo "No input type found!"; // @todo we need to add more input types.
4818
+            }
4819
+            // after wrapper
4820
+            ?></p><?php
4821
+        }
4822 4822
 
4823
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4824
-			if($icon=='box-top'){
4825
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4826
-			}elseif($icon=='box-right'){
4827
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4828
-			}elseif($icon=='box-bottom'){
4829
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4830
-			}elseif($icon=='box-left'){
4831
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4832
-			}
4833
-		}
4823
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4824
+            if($icon=='box-top'){
4825
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4826
+            }elseif($icon=='box-right'){
4827
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4828
+            }elseif($icon=='box-bottom'){
4829
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4830
+            }elseif($icon=='box-left'){
4831
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4832
+            }
4833
+        }
4834 4834
 
4835
-		/**
4836
-		 * Get the widget input description html.
4837
-		 *
4838
-		 * @param $args
4839
-		 *
4840
-		 * @return string
4841
-		 * @todo, need to make its own tooltip script
4842
-		 */
4843
-		public function widget_field_desc( $args ) {
4844
-
4845
-			$description = '';
4846
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4847
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4848
-					$description = $this->desc_tip( $args['desc'] );
4849
-				} else {
4850
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4851
-				}
4852
-			}
4835
+        /**
4836
+         * Get the widget input description html.
4837
+         *
4838
+         * @param $args
4839
+         *
4840
+         * @return string
4841
+         * @todo, need to make its own tooltip script
4842
+         */
4843
+        public function widget_field_desc( $args ) {
4844
+
4845
+            $description = '';
4846
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4847
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4848
+                    $description = $this->desc_tip( $args['desc'] );
4849
+                } else {
4850
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4851
+                }
4852
+            }
4853 4853
 
4854
-			return $description;
4855
-		}
4854
+            return $description;
4855
+        }
4856 4856
 
4857
-		/**
4858
-		 * Get the widget input title html.
4859
-		 *
4860
-		 * @param $args
4861
-		 *
4862
-		 * @return string
4863
-		 */
4864
-		public function widget_field_title( $args ) {
4865
-			$title = '';
4866
-
4867
-			if ( isset( $args['title'] ) && $args['title'] ) {
4868
-				if ( ! empty( $args['device_type'] ) ) {
4869
-					$args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title.
4870
-				}
4857
+        /**
4858
+         * Get the widget input title html.
4859
+         *
4860
+         * @param $args
4861
+         *
4862
+         * @return string
4863
+         */
4864
+        public function widget_field_title( $args ) {
4865
+            $title = '';
4871 4866
 
4872
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4873
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4874
-				} else {
4875
-					$title = esc_attr( $args['title'] );
4876
-				}
4877
-			}
4867
+            if ( isset( $args['title'] ) && $args['title'] ) {
4868
+                if ( ! empty( $args['device_type'] ) ) {
4869
+                    $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title.
4870
+                }
4878 4871
 
4879
-			return $title;
4880
-		}
4872
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4873
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4874
+                } else {
4875
+                    $title = esc_attr( $args['title'] );
4876
+                }
4877
+            }
4881 4878
 
4882
-		/**
4883
-		 * Get the tool tip html.
4884
-		 *
4885
-		 * @param $tip
4886
-		 * @param bool $allow_html
4887
-		 *
4888
-		 * @return string
4889
-		 */
4890
-		function desc_tip( $tip, $allow_html = false ) {
4891
-			if ( $allow_html ) {
4892
-				$tip = $this->sanitize_tooltip( $tip );
4893
-			} else {
4894
-				$tip = esc_attr( $tip );
4895
-			}
4879
+            return $title;
4880
+        }
4896 4881
 
4897
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4898
-		}
4882
+        /**
4883
+         * Get the tool tip html.
4884
+         *
4885
+         * @param $tip
4886
+         * @param bool $allow_html
4887
+         *
4888
+         * @return string
4889
+         */
4890
+        function desc_tip( $tip, $allow_html = false ) {
4891
+            if ( $allow_html ) {
4892
+                $tip = $this->sanitize_tooltip( $tip );
4893
+            } else {
4894
+                $tip = esc_attr( $tip );
4895
+            }
4899 4896
 
4900
-		/**
4901
-		 * Sanitize a string destined to be a tooltip.
4902
-		 *
4903
-		 * @param string $var
4904
-		 *
4905
-		 * @return string
4906
-		 */
4907
-		public function sanitize_tooltip( $var ) {
4908
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4909
-				'br'     => array(),
4910
-				'em'     => array(),
4911
-				'strong' => array(),
4912
-				'small'  => array(),
4913
-				'span'   => array(),
4914
-				'ul'     => array(),
4915
-				'li'     => array(),
4916
-				'ol'     => array(),
4917
-				'p'      => array(),
4918
-			) ) );
4919
-		}
4897
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4898
+        }
4920 4899
 
4921
-		/**
4922
-		 * Processing widget options on save
4923
-		 *
4924
-		 * @param array $new_instance The new options
4925
-		 * @param array $old_instance The previous options
4926
-		 *
4927
-		 * @return array
4928
-		 * @todo we should add some sanitation here.
4929
-		 */
4930
-		public function update( $new_instance, $old_instance ) {
4931
-
4932
-			//save the widget
4933
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4934
-
4935
-			// set widget instance
4936
-			$this->instance = $instance;
4937
-
4938
-			if ( empty( $this->arguments ) ) {
4939
-				$this->get_arguments();
4940
-			}
4900
+        /**
4901
+         * Sanitize a string destined to be a tooltip.
4902
+         *
4903
+         * @param string $var
4904
+         *
4905
+         * @return string
4906
+         */
4907
+        public function sanitize_tooltip( $var ) {
4908
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4909
+                'br'     => array(),
4910
+                'em'     => array(),
4911
+                'strong' => array(),
4912
+                'small'  => array(),
4913
+                'span'   => array(),
4914
+                'ul'     => array(),
4915
+                'li'     => array(),
4916
+                'ol'     => array(),
4917
+                'p'      => array(),
4918
+            ) ) );
4919
+        }
4941 4920
 
4942
-			// check for checkboxes
4943
-			if ( ! empty( $this->arguments ) ) {
4944
-				foreach ( $this->arguments as $argument ) {
4945
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4946
-						$instance[ $argument['name'] ] = '0';
4947
-					}
4948
-				}
4949
-			}
4921
+        /**
4922
+         * Processing widget options on save
4923
+         *
4924
+         * @param array $new_instance The new options
4925
+         * @param array $old_instance The previous options
4926
+         *
4927
+         * @return array
4928
+         * @todo we should add some sanitation here.
4929
+         */
4930
+        public function update( $new_instance, $old_instance ) {
4931
+
4932
+            //save the widget
4933
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4934
+
4935
+            // set widget instance
4936
+            $this->instance = $instance;
4937
+
4938
+            if ( empty( $this->arguments ) ) {
4939
+                $this->get_arguments();
4940
+            }
4941
+
4942
+            // check for checkboxes
4943
+            if ( ! empty( $this->arguments ) ) {
4944
+                foreach ( $this->arguments as $argument ) {
4945
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4946
+                        $instance[ $argument['name'] ] = '0';
4947
+                    }
4948
+                }
4949
+            }
4950 4950
 
4951 4951
             // maybe sanitize widget title
4952 4952
             if(!empty($instance['title'])) {
4953 4953
                 $instance['title'] = wp_kses_post( $instance['title'] );
4954 4954
             }
4955 4955
 
4956
-			return $instance;
4957
-		}
4956
+            return $instance;
4957
+        }
4958 4958
 
4959
-		/**
4960
-		 * Checks if the current call is a ajax call to get the block content.
4961
-		 *
4962
-		 * This can be used in your widget to return different content as the block content.
4963
-		 *
4964
-		 * @return bool
4965
-		 *@since 1.0.3
4966
-		 */
4967
-		public function is_block_content_call() {
4968
-			$result = false;
4969
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4970
-				$result = true;
4971
-			}
4959
+        /**
4960
+         * Checks if the current call is a ajax call to get the block content.
4961
+         *
4962
+         * This can be used in your widget to return different content as the block content.
4963
+         *
4964
+         * @return bool
4965
+         *@since 1.0.3
4966
+         */
4967
+        public function is_block_content_call() {
4968
+            $result = false;
4969
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4970
+                $result = true;
4971
+            }
4972 4972
 
4973
-			return $result;
4974
-		}
4973
+            return $result;
4974
+        }
4975 4975
 
4976
-		/**
4977
-		 * Get an instance hash that will be unique to the type and settings.
4978
-		 *
4979
-		 * @return string
4980
-		 *@since 1.0.20
4981
-		 */
4982
-		public function get_instance_hash(){
4983
-			$instance_string = $this->base_id.serialize($this->instance);
4984
-			return hash('crc32b',$instance_string);
4985
-		}
4976
+        /**
4977
+         * Get an instance hash that will be unique to the type and settings.
4978
+         *
4979
+         * @return string
4980
+         *@since 1.0.20
4981
+         */
4982
+        public function get_instance_hash(){
4983
+            $instance_string = $this->base_id.serialize($this->instance);
4984
+            return hash('crc32b',$instance_string);
4985
+        }
4986 4986
 
4987
-		/**
4988
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4989
-		 *
4990
-		 * @param array $rules
4991
-		 *
4992
-		 * @return string
4993
-		 *@since 1.0.20
4994
-		 */
4995
-		public function get_instance_style($rules = array()){
4996
-			$css = '';
4997
-
4998
-			if(!empty($rules)){
4999
-				$rules = array_unique($rules);
5000
-				$instance_hash = $this->get_instance_hash();
5001
-				$css .= "<style>";
5002
-				foreach($rules as $rule){
5003
-					$css .= ".sdel-$instance_hash $rule";
5004
-				}
5005
-				$css .= "</style>";
5006
-			}
4987
+        /**
4988
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4989
+         *
4990
+         * @param array $rules
4991
+         *
4992
+         * @return string
4993
+         *@since 1.0.20
4994
+         */
4995
+        public function get_instance_style($rules = array()){
4996
+            $css = '';
4997
+
4998
+            if(!empty($rules)){
4999
+                $rules = array_unique($rules);
5000
+                $instance_hash = $this->get_instance_hash();
5001
+                $css .= "<style>";
5002
+                foreach($rules as $rule){
5003
+                    $css .= ".sdel-$instance_hash $rule";
5004
+                }
5005
+                $css .= "</style>";
5006
+            }
5007 5007
 
5008
-			return $css;
5009
-		}
5008
+            return $css;
5009
+        }
5010 5010
 
5011
-		/**
5012
-		 * Encode shortcodes tags.
5013
-		 *
5014
-		 * @param string $content Content to search for shortcode tags.
5015
-		 *
5011
+        /**
5012
+         * Encode shortcodes tags.
5013
+         *
5014
+         * @param string $content Content to search for shortcode tags.
5015
+         *
5016 5016
 *@return string Content with shortcode tags removed.
5017
-		 *@since 1.0.28
5018
-		 *
5019
-		 */
5020
-		public function encode_shortcodes( $content ) {
5021
-			// Avoids existing encoded tags.
5022
-			$trans   = array(
5023
-				'&#91;' => '&#091;',
5024
-				'&#93;' => '&#093;',
5025
-				'&amp;#91;' => '&#091;',
5026
-				'&amp;#93;' => '&#093;',
5027
-				'&lt;' => '&0lt;',
5028
-				'&gt;' => '&0gt;',
5029
-				'&amp;lt;' => '&0lt;',
5030
-				'&amp;gt;' => '&0gt;',
5031
-			);
5032
-
5033
-			$content = strtr( $content, $trans );
5034
-
5035
-			$trans   = array(
5036
-				'[' => '&#91;',
5037
-				']' => '&#93;',
5038
-				'<' => '&lt;',
5039
-				'>' => '&gt;',
5040
-				'"' => '&quot;',
5041
-				"'" => '&#39;',
5042
-			);
5043
-
5044
-			$content = strtr( $content, $trans );
5045
-
5046
-			return $content;
5047
-		}
5017
+         *@since 1.0.28
5018
+         *
5019
+         */
5020
+        public function encode_shortcodes( $content ) {
5021
+            // Avoids existing encoded tags.
5022
+            $trans   = array(
5023
+                '&#91;' => '&#091;',
5024
+                '&#93;' => '&#093;',
5025
+                '&amp;#91;' => '&#091;',
5026
+                '&amp;#93;' => '&#093;',
5027
+                '&lt;' => '&0lt;',
5028
+                '&gt;' => '&0gt;',
5029
+                '&amp;lt;' => '&0lt;',
5030
+                '&amp;gt;' => '&0gt;',
5031
+            );
5032
+
5033
+            $content = strtr( $content, $trans );
5034
+
5035
+            $trans   = array(
5036
+                '[' => '&#91;',
5037
+                ']' => '&#93;',
5038
+                '<' => '&lt;',
5039
+                '>' => '&gt;',
5040
+                '"' => '&quot;',
5041
+                "'" => '&#39;',
5042
+            );
5043
+
5044
+            $content = strtr( $content, $trans );
5045
+
5046
+            return $content;
5047
+        }
5048 5048
 
5049
-		/**
5050
-		 * Remove encoded shortcod tags.
5051
-		 *
5052
-		 * @param string $content Content to search for shortcode tags.
5053
-		 *
5049
+        /**
5050
+         * Remove encoded shortcod tags.
5051
+         *
5052
+         * @param string $content Content to search for shortcode tags.
5053
+         *
5054 5054
 *@return string Content with decoded shortcode tags.
5055
-		 *@since 1.0.28
5056
-		 *
5057
-		 */
5058
-		public function decode_shortcodes( $content ) {
5059
-			$trans   = array(
5060
-				'&#91;' => '[',
5061
-				'&#93;' => ']',
5062
-				'&amp;#91;' => '[',
5063
-				'&amp;#93;' => ']',
5064
-				'&lt;' => '<',
5065
-				'&gt;' => '>',
5066
-				'&amp;lt;' => '<',
5067
-				'&amp;gt;' => '>',
5068
-				'&quot;' => '"',
5069
-				'&apos;' => "'",
5070
-			);
5071
-
5072
-			$content = strtr( $content, $trans );
5073
-
5074
-			$trans   = array(
5075
-				'&#091;' => '&#91;',
5076
-				'&#093;' => '&#93;',
5077
-				'&amp;#091;' => '&#91;',
5078
-				'&amp;#093;' => '&#93;',
5079
-				'&0lt;' => '&lt;',
5080
-				'&0gt;' => '&gt;',
5081
-				'&amp;0lt;' => '&lt;',
5082
-				'&amp;0gt;' => '&gt;',
5083
-			);
5084
-
5085
-			$content = strtr( $content, $trans );
5086
-
5087
-			return $content;
5088
-		}
5089
-
5090
-		public function block_visibility_fields( $args ) {
5091
-			$value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : '';
5092
-			$content = '<div class="bs-vc-rule-template d-none">';
5093
-				$content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >';
5094
-					$content .= '<div class="row">';
5095
-						$content .= '<div class="col-sm-12">';
5096
-							$content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5097
-							$content .= aui()->select(
5098
-								array(
5099
-									'id'          => 'bsvc_rule_BSVCINDEX',
5100
-									'name'        => 'bsvc_rule_BSVCINDEX',
5101
-									'label'       => __( 'Rule', 'ayecode-connect' ),
5102
-									'placeholder' => __( 'Select Rule...', 'ayecode-connect' ),
5103
-									'class'       => 'bsvc_rule form-select-sm no-select2 mw-100',
5104
-									'options'     => sd_visibility_rules_options(),
5105
-									'default'     => '',
5106
-									'value'       => '',
5107
-									'label_type'  => '',
5108
-									'select2'     => false,
5109
-									'input_group_left' => __( 'Rule:', 'ayecode-connect' ),
5110
-									'extra_attributes' => array(
5111
-										'data-minimum-results-for-search' => '-1'
5112
-									)
5113
-								)
5114
-							);
5115
-
5116
-						$content .= '</div>';
5117
-
5118
-						if ( class_exists( 'GeoDirectory' ) ) {
5119
-							$content .= '<div class="col-md-7 col-sm-12">';
5120
-
5121
-								$content .= aui()->select(
5122
-									array(
5123
-										'id'          => 'bsvc_gd_field_BSVCINDEX',
5124
-										'name'        => 'bsvc_gd_field_BSVCINDEX',
5125
-										'label'       => __( 'FIELD', 'ayecode-connect' ),
5126
-										'placeholder' => __( 'FIELD', 'ayecode-connect' ),
5127
-										'class'       => 'bsvc_gd_field form-select-sm no-select2 mw-100',
5128
-										'options'     => sd_visibility_gd_field_options(),
5129
-										'default'     => '',
5130
-										'value'       => '',
5131
-										'label_type'  => '',
5132
-										'select2'     => false,
5133
-										'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5134
-										'extra_attributes' => array(
5135
-											'data-minimum-results-for-search' => '-1'
5136
-										)
5137
-									)
5138
-								);
5139
-
5140
-							$content .= '</div>';
5141
-							$content .= '<div class="col-md-5 col-sm-12">';
5142
-
5143
-								$content .= aui()->select(
5144
-									array(
5145
-										'id'          => 'bsvc_gd_field_condition_BSVCINDEX',
5146
-										'name'        => 'bsvc_gd_field_condition_BSVCINDEX',
5147
-										'label'       => __( 'CONDITION', 'ayecode-connect' ),
5148
-										'placeholder' => __( 'CONDITION', 'ayecode-connect' ),
5149
-										'class'       => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100',
5150
-										'options'     => sd_visibility_field_condition_options(),
5151
-										'default'     => '',
5152
-										'value'       => '',
5153
-										'label_type'  => '',
5154
-										'select2'     => false,
5155
-										'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5156
-										'extra_attributes' => array(
5157
-											'data-minimum-results-for-search' => '-1'
5158
-										)
5159
-									)
5160
-								);
5161
-
5162
-							$content .= '</div>';
5163
-							$content .= '<div class="col-sm-12">';
5164
-
5165
-								$content .= aui()->input(
5166
-									array(
5167
-										'type'            => 'text',
5168
-										'id'              => 'bsvc_gd_field_search_BSVCINDEX',
5169
-										'name'            => 'bsvc_gd_field_search_BSVCINDEX',
5170
-										'label'           => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5171
-										'class'           => 'bsvc_gd_field_search form-control-sm',
5172
-										'placeholder'     => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5173
-										'label_type'      => '',
5174
-										'value'           => '',
5175
-										'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")'
5176
-									)
5177
-								);
5055
+         *@since 1.0.28
5056
+         *
5057
+         */
5058
+        public function decode_shortcodes( $content ) {
5059
+            $trans   = array(
5060
+                '&#91;' => '[',
5061
+                '&#93;' => ']',
5062
+                '&amp;#91;' => '[',
5063
+                '&amp;#93;' => ']',
5064
+                '&lt;' => '<',
5065
+                '&gt;' => '>',
5066
+                '&amp;lt;' => '<',
5067
+                '&amp;gt;' => '>',
5068
+                '&quot;' => '"',
5069
+                '&apos;' => "'",
5070
+            );
5071
+
5072
+            $content = strtr( $content, $trans );
5073
+
5074
+            $trans   = array(
5075
+                '&#091;' => '&#91;',
5076
+                '&#093;' => '&#93;',
5077
+                '&amp;#091;' => '&#91;',
5078
+                '&amp;#093;' => '&#93;',
5079
+                '&0lt;' => '&lt;',
5080
+                '&0gt;' => '&gt;',
5081
+                '&amp;0lt;' => '&lt;',
5082
+                '&amp;0gt;' => '&gt;',
5083
+            );
5084
+
5085
+            $content = strtr( $content, $trans );
5086
+
5087
+            return $content;
5088
+        }
5178 5089
 
5179
-							$content .= '</div>';
5180
-						}
5090
+        public function block_visibility_fields( $args ) {
5091
+            $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : '';
5092
+            $content = '<div class="bs-vc-rule-template d-none">';
5093
+                $content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >';
5094
+                    $content .= '<div class="row">';
5095
+                        $content .= '<div class="col-sm-12">';
5096
+                            $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5097
+                            $content .= aui()->select(
5098
+                                array(
5099
+                                    'id'          => 'bsvc_rule_BSVCINDEX',
5100
+                                    'name'        => 'bsvc_rule_BSVCINDEX',
5101
+                                    'label'       => __( 'Rule', 'ayecode-connect' ),
5102
+                                    'placeholder' => __( 'Select Rule...', 'ayecode-connect' ),
5103
+                                    'class'       => 'bsvc_rule form-select-sm no-select2 mw-100',
5104
+                                    'options'     => sd_visibility_rules_options(),
5105
+                                    'default'     => '',
5106
+                                    'value'       => '',
5107
+                                    'label_type'  => '',
5108
+                                    'select2'     => false,
5109
+                                    'input_group_left' => __( 'Rule:', 'ayecode-connect' ),
5110
+                                    'extra_attributes' => array(
5111
+                                        'data-minimum-results-for-search' => '-1'
5112
+                                    )
5113
+                                )
5114
+                            );
5115
+
5116
+                        $content .= '</div>';
5117
+
5118
+                        if ( class_exists( 'GeoDirectory' ) ) {
5119
+                            $content .= '<div class="col-md-7 col-sm-12">';
5120
+
5121
+                                $content .= aui()->select(
5122
+                                    array(
5123
+                                        'id'          => 'bsvc_gd_field_BSVCINDEX',
5124
+                                        'name'        => 'bsvc_gd_field_BSVCINDEX',
5125
+                                        'label'       => __( 'FIELD', 'ayecode-connect' ),
5126
+                                        'placeholder' => __( 'FIELD', 'ayecode-connect' ),
5127
+                                        'class'       => 'bsvc_gd_field form-select-sm no-select2 mw-100',
5128
+                                        'options'     => sd_visibility_gd_field_options(),
5129
+                                        'default'     => '',
5130
+                                        'value'       => '',
5131
+                                        'label_type'  => '',
5132
+                                        'select2'     => false,
5133
+                                        'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5134
+                                        'extra_attributes' => array(
5135
+                                            'data-minimum-results-for-search' => '-1'
5136
+                                        )
5137
+                                    )
5138
+                                );
5139
+
5140
+                            $content .= '</div>';
5141
+                            $content .= '<div class="col-md-5 col-sm-12">';
5142
+
5143
+                                $content .= aui()->select(
5144
+                                    array(
5145
+                                        'id'          => 'bsvc_gd_field_condition_BSVCINDEX',
5146
+                                        'name'        => 'bsvc_gd_field_condition_BSVCINDEX',
5147
+                                        'label'       => __( 'CONDITION', 'ayecode-connect' ),
5148
+                                        'placeholder' => __( 'CONDITION', 'ayecode-connect' ),
5149
+                                        'class'       => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100',
5150
+                                        'options'     => sd_visibility_field_condition_options(),
5151
+                                        'default'     => '',
5152
+                                        'value'       => '',
5153
+                                        'label_type'  => '',
5154
+                                        'select2'     => false,
5155
+                                        'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5156
+                                        'extra_attributes' => array(
5157
+                                            'data-minimum-results-for-search' => '-1'
5158
+                                        )
5159
+                                    )
5160
+                                );
5161
+
5162
+                            $content .= '</div>';
5163
+                            $content .= '<div class="col-sm-12">';
5164
+
5165
+                                $content .= aui()->input(
5166
+                                    array(
5167
+                                        'type'            => 'text',
5168
+                                        'id'              => 'bsvc_gd_field_search_BSVCINDEX',
5169
+                                        'name'            => 'bsvc_gd_field_search_BSVCINDEX',
5170
+                                        'label'           => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5171
+                                        'class'           => 'bsvc_gd_field_search form-control-sm',
5172
+                                        'placeholder'     => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5173
+                                        'label_type'      => '',
5174
+                                        'value'           => '',
5175
+                                        'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")'
5176
+                                    )
5177
+                                );
5178
+
5179
+                            $content .= '</div>';
5180
+                        }
5181 5181
 
5182 5182
                         $content .= apply_filters( 'sd_block_visibility_fields', '', $args );
5183 5183
 
5184
-					$content .= '</div>';
5185
-
5186
-					$content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>';
5187
-						$role_options = sd_user_roles_options();
5188
-
5189
-						$role_option_i = 0;
5190
-						foreach ( $role_options as $role_option_key => $role_option_name ) {
5191
-							$role_option_i++;
5192
-
5193
-							$content .= '<div class="col-sm-6">';
5194
-							$content .= aui()->input(
5195
-								array(
5196
-									'id'               => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i,
5197
-									'name'             => 'bsvc_user_roles_BSVCINDEX[]',
5198
-									'type'             => 'checkbox',
5199
-									'label'            => $role_option_name,
5200
-									'label_type'       => 'hidden',
5201
-									'class'            => 'bsvc_user_roles',
5202
-									'value'            => $role_option_key,
5203
-									'switch'           => 'md',
5204
-									'no_wrap'          => true
5205
-								)
5206
-							);
5207
-							$content .= '</div>';
5208
-						}
5209
-					$content .= '</div>';
5210
-					$content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__( 'AND', 'ayecode-connect' ) . '</div></div>';
5211
-				$content .= '</div>';
5212
-			$content .= '</div>';
5213
-			$content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">';
5214
-			$content .= '<div class="bs-vc-rule-sets"></div>';
5215
-			$content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>';
5216
-			$content .= '<div class="row"><div class="col-md-6 col-sm-12">';
5217
-			$content .= aui()->select(
5218
-				array(
5219
-					'id'          => 'bsvc_output',
5220
-					'name'        => 'bsvc_output',
5221
-					'label'       => __( 'What should happen if rules met.', 'ayecode-connect' ),
5222
-					'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5223
-					'class'       => 'bsvc_output form-select-sm no-select2 mw-100',
5224
-					'options'     => sd_visibility_output_options(),
5225
-					'default'     => '',
5226
-					'value'       => '',
5227
-					'label_type'  => 'top',
5228
-					'select2'     => false,
5229
-					'extra_attributes' => array(
5230
-						'data-minimum-results-for-search' => '-1'
5231
-					)
5232
-				)
5233
-			);
5234
-
5235
-			$content .= '</div><div class="col-md-6 col-sm-12">';
5236
-
5237
-			$content .= aui()->select(
5238
-				array(
5239
-					'id'              => 'bsvc_page',
5240
-					'name'            => 'bsvc_page',
5241
-					'label'           => __( 'Page Content', 'ayecode-connect' ),
5242
-					'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5243
-					'class'           => 'bsvc_page form-select-sm no-select2 mw-100',
5244
-					'options'         => sd_template_page_options(),
5245
-					'default'         => '',
5246
-					'value'           => '',
5247
-					'label_type'      => 'top',
5248
-					'select2'         => false,
5249
-					'element_require' => '[%bsvc_output%]=="page"'
5250
-				)
5251
-			);
5252
-
5253
-			$content .= aui()->select(
5254
-				array(
5255
-					'id'          => 'bsvc_tmpl_part',
5256
-					'name'        => 'bsvc_tmpl_part',
5257
-					'label'       => __( 'Template Part', 'ayecode-connect' ),
5258
-					'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5259
-					'class'       => 'bsvc_tmpl_part form-select-sm no-select2 mw-100',
5260
-					'options'     => sd_template_part_options(),
5261
-					'default'     => '',
5262
-					'value'       => '',
5263
-					'label_type'  => 'top',
5264
-					'select2'     => false,
5265
-					'element_require'  => '[%bsvc_output%]=="template_part"',
5266
-					'extra_attributes' => array(
5267
-						'data-minimum-results-for-search' => '-1'
5268
-					)
5269
-				)
5270
-			);
5271
-
5272
-			$content .= aui()->select(
5273
-				array(
5274
-					'id'               => 'bsvc_message_type',
5275
-					'name'             => 'bsvc_message_type',
5276
-					'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5277
-					'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5278
-					'class'            => 'bsvc_message_type form-select-sm no-select2 mw-100',
5279
-					'options'          => sd_aui_colors(),
5280
-					'default'          => '',
5281
-					'value'            => '',
5282
-					'label_type'       => 'top',
5283
-					'select2'          => false,
5284
-					'element_require'  => '[%bsvc_output%]=="message"',
5285
-					'extra_attributes' => array(
5286
-						'data-minimum-results-for-search' => '-1'
5287
-					)
5288
-				)
5289
-			);
5290
-
5291
-			$content .= '</div><div class="col-sm-12">';
5292
-
5293
-			$content .= aui()->input(
5294
-				array(
5295
-					'type'            => 'text',
5296
-					'id'              => 'bsvc_message',
5297
-					'name'            => 'bsvc_message',
5298
-					'label'           => '',
5299
-					'class'           => 'bsvc_message form-control-sm mb-3',
5300
-					'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5301
-					'label_type'      => '',
5302
-					'value'           => '',
5303
-					'form_group_class' => ' ',
5304
-					'element_require' => '[%bsvc_output%]=="message"',
5305
-				)
5306
-			);
5307
-
5308
-			$content .= '</div></div><div class="row"><div class="col col-12"><div class="pt-3 mt-1 border-top"></div></div><div class="col-md-6 col-sm-12">';
5309
-			$content .= aui()->select(
5310
-				array(
5311
-					'id'          => 'bsvc_output_n',
5312
-					'name'        => 'bsvc_output_n',
5313
-					'label'       => __( 'What should happen if rules NOT met.', 'ayecode-connect' ),
5314
-					'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5315
-					'class'       => 'bsvc_output_n form-select-sm no-select2 mw-100',
5316
-					'options'     => sd_visibility_output_options(),
5317
-					'default'     => '',
5318
-					'value'       => '',
5319
-					'label_type'  => 'top',
5320
-					'select2'     => false,
5321
-					'extra_attributes' => array(
5322
-						'data-minimum-results-for-search' => '-1'
5323
-					)
5324
-				)
5325
-			);
5326
-
5327
-			$content .= '</div><div class="col-md-6 col-sm-12">';
5328
-
5329
-			$content .= aui()->select(
5330
-				array(
5331
-					'id'              => 'bsvc_page_n',
5332
-					'name'            => 'bsvc_page_n',
5333
-					'label'           => __( 'Page Content', 'ayecode-connect' ),
5334
-					'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5335
-					'class'           => 'bsvc_page_n form-select-sm no-select2 mw-100',
5336
-					'options'         => sd_template_page_options(),
5337
-					'default'         => '',
5338
-					'value'           => '',
5339
-					'label_type'      => 'top',
5340
-					'select2'         => false,
5341
-					'element_require' => '[%bsvc_output_n%]=="page"'
5342
-				)
5343
-			);
5344
-
5345
-			$content .= aui()->select(
5346
-				array(
5347
-					'id'          => 'bsvc_tmpl_part_n',
5348
-					'name'        => 'bsvc_tmpl_part_n',
5349
-					'label'       => __( 'Template Part', 'ayecode-connect' ),
5350
-					'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5351
-					'class'       => 'bsvc_tmpl_part_n form-select-sm no-select2 mw-100',
5352
-					'options'     => sd_template_part_options(),
5353
-					'default'     => '',
5354
-					'value'       => '',
5355
-					'label_type'  => 'top',
5356
-					'select2'     => false,
5357
-					'element_require'  => '[%bsvc_output_n%]=="template_part"',
5358
-					'extra_attributes' => array(
5359
-						'data-minimum-results-for-search' => '-1'
5360
-					)
5361
-				)
5362
-			);
5363
-
5364
-			$content .= aui()->select(
5365
-				array(
5366
-					'id'               => 'bsvc_message_type_n',
5367
-					'name'             => 'bsvc_message_type_n',
5368
-					'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5369
-					'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5370
-					'class'            => 'bsvc_message_type_n form-select-sm no-select2 mw-100',
5371
-					'options'          => sd_aui_colors(),
5372
-					'default'          => '',
5373
-					'value'            => '',
5374
-					'label_type'       => 'top',
5375
-					'select2'          => false,
5376
-					'element_require'  => '[%bsvc_output_n%]=="message"',
5377
-					'extra_attributes' => array(
5378
-						'data-minimum-results-for-search' => '-1'
5379
-					)
5380
-				)
5381
-			);
5382
-
5383
-			$content .= '</div><div class="col-sm-12">';
5384
-
5385
-			$content .= aui()->input(
5386
-				array(
5387
-					'type'            => 'text',
5388
-					'id'              => 'bsvc_message_n',
5389
-					'name'            => 'bsvc_message_n',
5390
-					'label'           => '',
5391
-					'class'           => 'bsvc_message_n form-control-sm',
5392
-					'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5393
-					'label_type'      => '',
5394
-					'value'           => '',
5395
-					'form_group_class' => ' ',
5396
-					'element_require' => '[%bsvc_output_n%]=="message"',
5397
-				)
5398
-			);
5399
-
5400
-			$content .= '</div></div></form><input type="hidden" id="bsvc_raw_value" name="bsvc_raw_value" value="' . $value . '">';
5401
-
5402
-			return $content;
5403
-		}
5184
+                    $content .= '</div>';
5185
+
5186
+                    $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>';
5187
+                        $role_options = sd_user_roles_options();
5188
+
5189
+                        $role_option_i = 0;
5190
+                        foreach ( $role_options as $role_option_key => $role_option_name ) {
5191
+                            $role_option_i++;
5192
+
5193
+                            $content .= '<div class="col-sm-6">';
5194
+                            $content .= aui()->input(
5195
+                                array(
5196
+                                    'id'               => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i,
5197
+                                    'name'             => 'bsvc_user_roles_BSVCINDEX[]',
5198
+                                    'type'             => 'checkbox',
5199
+                                    'label'            => $role_option_name,
5200
+                                    'label_type'       => 'hidden',
5201
+                                    'class'            => 'bsvc_user_roles',
5202
+                                    'value'            => $role_option_key,
5203
+                                    'switch'           => 'md',
5204
+                                    'no_wrap'          => true
5205
+                                )
5206
+                            );
5207
+                            $content .= '</div>';
5208
+                        }
5209
+                    $content .= '</div>';
5210
+                    $content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__( 'AND', 'ayecode-connect' ) . '</div></div>';
5211
+                $content .= '</div>';
5212
+            $content .= '</div>';
5213
+            $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">';
5214
+            $content .= '<div class="bs-vc-rule-sets"></div>';
5215
+            $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>';
5216
+            $content .= '<div class="row"><div class="col-md-6 col-sm-12">';
5217
+            $content .= aui()->select(
5218
+                array(
5219
+                    'id'          => 'bsvc_output',
5220
+                    'name'        => 'bsvc_output',
5221
+                    'label'       => __( 'What should happen if rules met.', 'ayecode-connect' ),
5222
+                    'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5223
+                    'class'       => 'bsvc_output form-select-sm no-select2 mw-100',
5224
+                    'options'     => sd_visibility_output_options(),
5225
+                    'default'     => '',
5226
+                    'value'       => '',
5227
+                    'label_type'  => 'top',
5228
+                    'select2'     => false,
5229
+                    'extra_attributes' => array(
5230
+                        'data-minimum-results-for-search' => '-1'
5231
+                    )
5232
+                )
5233
+            );
5234
+
5235
+            $content .= '</div><div class="col-md-6 col-sm-12">';
5236
+
5237
+            $content .= aui()->select(
5238
+                array(
5239
+                    'id'              => 'bsvc_page',
5240
+                    'name'            => 'bsvc_page',
5241
+                    'label'           => __( 'Page Content', 'ayecode-connect' ),
5242
+                    'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5243
+                    'class'           => 'bsvc_page form-select-sm no-select2 mw-100',
5244
+                    'options'         => sd_template_page_options(),
5245
+                    'default'         => '',
5246
+                    'value'           => '',
5247
+                    'label_type'      => 'top',
5248
+                    'select2'         => false,
5249
+                    'element_require' => '[%bsvc_output%]=="page"'
5250
+                )
5251
+            );
5252
+
5253
+            $content .= aui()->select(
5254
+                array(
5255
+                    'id'          => 'bsvc_tmpl_part',
5256
+                    'name'        => 'bsvc_tmpl_part',
5257
+                    'label'       => __( 'Template Part', 'ayecode-connect' ),
5258
+                    'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5259
+                    'class'       => 'bsvc_tmpl_part form-select-sm no-select2 mw-100',
5260
+                    'options'     => sd_template_part_options(),
5261
+                    'default'     => '',
5262
+                    'value'       => '',
5263
+                    'label_type'  => 'top',
5264
+                    'select2'     => false,
5265
+                    'element_require'  => '[%bsvc_output%]=="template_part"',
5266
+                    'extra_attributes' => array(
5267
+                        'data-minimum-results-for-search' => '-1'
5268
+                    )
5269
+                )
5270
+            );
5271
+
5272
+            $content .= aui()->select(
5273
+                array(
5274
+                    'id'               => 'bsvc_message_type',
5275
+                    'name'             => 'bsvc_message_type',
5276
+                    'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5277
+                    'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5278
+                    'class'            => 'bsvc_message_type form-select-sm no-select2 mw-100',
5279
+                    'options'          => sd_aui_colors(),
5280
+                    'default'          => '',
5281
+                    'value'            => '',
5282
+                    'label_type'       => 'top',
5283
+                    'select2'          => false,
5284
+                    'element_require'  => '[%bsvc_output%]=="message"',
5285
+                    'extra_attributes' => array(
5286
+                        'data-minimum-results-for-search' => '-1'
5287
+                    )
5288
+                )
5289
+            );
5290
+
5291
+            $content .= '</div><div class="col-sm-12">';
5292
+
5293
+            $content .= aui()->input(
5294
+                array(
5295
+                    'type'            => 'text',
5296
+                    'id'              => 'bsvc_message',
5297
+                    'name'            => 'bsvc_message',
5298
+                    'label'           => '',
5299
+                    'class'           => 'bsvc_message form-control-sm mb-3',
5300
+                    'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5301
+                    'label_type'      => '',
5302
+                    'value'           => '',
5303
+                    'form_group_class' => ' ',
5304
+                    'element_require' => '[%bsvc_output%]=="message"',
5305
+                )
5306
+            );
5307
+
5308
+            $content .= '</div></div><div class="row"><div class="col col-12"><div class="pt-3 mt-1 border-top"></div></div><div class="col-md-6 col-sm-12">';
5309
+            $content .= aui()->select(
5310
+                array(
5311
+                    'id'          => 'bsvc_output_n',
5312
+                    'name'        => 'bsvc_output_n',
5313
+                    'label'       => __( 'What should happen if rules NOT met.', 'ayecode-connect' ),
5314
+                    'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5315
+                    'class'       => 'bsvc_output_n form-select-sm no-select2 mw-100',
5316
+                    'options'     => sd_visibility_output_options(),
5317
+                    'default'     => '',
5318
+                    'value'       => '',
5319
+                    'label_type'  => 'top',
5320
+                    'select2'     => false,
5321
+                    'extra_attributes' => array(
5322
+                        'data-minimum-results-for-search' => '-1'
5323
+                    )
5324
+                )
5325
+            );
5326
+
5327
+            $content .= '</div><div class="col-md-6 col-sm-12">';
5328
+
5329
+            $content .= aui()->select(
5330
+                array(
5331
+                    'id'              => 'bsvc_page_n',
5332
+                    'name'            => 'bsvc_page_n',
5333
+                    'label'           => __( 'Page Content', 'ayecode-connect' ),
5334
+                    'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5335
+                    'class'           => 'bsvc_page_n form-select-sm no-select2 mw-100',
5336
+                    'options'         => sd_template_page_options(),
5337
+                    'default'         => '',
5338
+                    'value'           => '',
5339
+                    'label_type'      => 'top',
5340
+                    'select2'         => false,
5341
+                    'element_require' => '[%bsvc_output_n%]=="page"'
5342
+                )
5343
+            );
5344
+
5345
+            $content .= aui()->select(
5346
+                array(
5347
+                    'id'          => 'bsvc_tmpl_part_n',
5348
+                    'name'        => 'bsvc_tmpl_part_n',
5349
+                    'label'       => __( 'Template Part', 'ayecode-connect' ),
5350
+                    'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5351
+                    'class'       => 'bsvc_tmpl_part_n form-select-sm no-select2 mw-100',
5352
+                    'options'     => sd_template_part_options(),
5353
+                    'default'     => '',
5354
+                    'value'       => '',
5355
+                    'label_type'  => 'top',
5356
+                    'select2'     => false,
5357
+                    'element_require'  => '[%bsvc_output_n%]=="template_part"',
5358
+                    'extra_attributes' => array(
5359
+                        'data-minimum-results-for-search' => '-1'
5360
+                    )
5361
+                )
5362
+            );
5363
+
5364
+            $content .= aui()->select(
5365
+                array(
5366
+                    'id'               => 'bsvc_message_type_n',
5367
+                    'name'             => 'bsvc_message_type_n',
5368
+                    'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5369
+                    'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5370
+                    'class'            => 'bsvc_message_type_n form-select-sm no-select2 mw-100',
5371
+                    'options'          => sd_aui_colors(),
5372
+                    'default'          => '',
5373
+                    'value'            => '',
5374
+                    'label_type'       => 'top',
5375
+                    'select2'          => false,
5376
+                    'element_require'  => '[%bsvc_output_n%]=="message"',
5377
+                    'extra_attributes' => array(
5378
+                        'data-minimum-results-for-search' => '-1'
5379
+                    )
5380
+                )
5381
+            );
5382
+
5383
+            $content .= '</div><div class="col-sm-12">';
5384
+
5385
+            $content .= aui()->input(
5386
+                array(
5387
+                    'type'            => 'text',
5388
+                    'id'              => 'bsvc_message_n',
5389
+                    'name'            => 'bsvc_message_n',
5390
+                    'label'           => '',
5391
+                    'class'           => 'bsvc_message_n form-control-sm',
5392
+                    'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5393
+                    'label_type'      => '',
5394
+                    'value'           => '',
5395
+                    'form_group_class' => ' ',
5396
+                    'element_require' => '[%bsvc_output_n%]=="message"',
5397
+                )
5398
+            );
5399
+
5400
+            $content .= '</div></div></form><input type="hidden" id="bsvc_raw_value" name="bsvc_raw_value" value="' . $value . '">';
5401
+
5402
+            return $content;
5403
+        }
5404 5404
 
5405
-		/**
5406
-		 * Handle media_buttons hook.
5407
-		 *
5408
-		 * @since 1.2.7
5409
-		 */
5410
-		public function wp_media_buttons() {
5411
-			global $shortcode_insert_button_once;
5412
-
5413
-			// Fix conflicts with UpSolution Core in header template edit element.
5414
-			if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) {
5415
-				$shortcode_insert_button_once = true;
5416
-			}
5417
-		}
5418
-	}
5405
+        /**
5406
+         * Handle media_buttons hook.
5407
+         *
5408
+         * @since 1.2.7
5409
+         */
5410
+        public function wp_media_buttons() {
5411
+            global $shortcode_insert_button_once;
5412
+
5413
+            // Fix conflicts with UpSolution Core in header template edit element.
5414
+            if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) {
5415
+                $shortcode_insert_button_once = true;
5416
+            }
5417
+        }
5418
+    }
5419 5419
 }
Please login to merge, or discard this patch.
Spacing   +831 added lines, -831 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
6
+if (!class_exists('WP_Super_Duper')) {
7 7
 
8
-	define( 'SUPER_DUPER_VER', '1.2.25' );
8
+	define('SUPER_DUPER_VER', '1.2.25');
9 9
 
10 10
 	/**
11 11
 	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
@@ -38,40 +38,40 @@  discard block
 block discarded – undo
38 38
 		/**
39 39
 		 * Take the array options and use them to build.
40 40
 		 */
41
-		public function __construct( $options ) {
41
+		public function __construct($options) {
42 42
 			global $sd_widgets;
43 43
 
44
-			$sd_widgets[ $options['base_id'] ] = array(
44
+			$sd_widgets[$options['base_id']] = array(
45 45
 				'name'       => $options['name'],
46 46
 				'class_name' => $options['class_name'],
47 47
 				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48 48
 			);
49
-			$this->base_id                     = $options['base_id'];
49
+			$this->base_id = $options['base_id'];
50 50
 			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
51
+			$options       = apply_filters("wp_super_duper_options", $options);
52
+			$options       = apply_filters("wp_super_duper_options_{$this->base_id}", $options);
53
+			$options       = $this->add_name_from_key($options);
54 54
 			$this->options = $options;
55 55
 
56 56
 			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
57
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
58 58
 
59 59
 			// nested blocks can't work as a widget
60
-			if(!empty($this->options['nested-block'])){
61
-				if(empty($this->options['output_types'])){
62
-					$this->options['output_types'] = array('shortcode','block');
60
+			if (!empty($this->options['nested-block'])) {
61
+				if (empty($this->options['output_types'])) {
62
+					$this->options['output_types'] = array('shortcode', 'block');
63 63
 				}elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64 64
 					unset($this->options['output_types'][$key]);
65 65
 				}
66 66
 			}
67 67
 
68 68
 			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
-				parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
69
+			if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) {
70
+				parent::__construct($options['base_id'], $options['name'], $options['widget_ops']);
71 71
 			}
72 72
 
73 73
 
74
-			if ( isset( $options['class_name'] ) ) {
74
+			if (isset($options['class_name'])) {
75 75
 				// register widget
76 76
 				$this->class_name = $options['class_name'];
77 77
 
@@ -80,68 +80,68 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
 				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
83
+				if (function_exists('fusion_builder_map')) {
84
+					add_action('init', array($this, 'register_fusion_element'));
85 85
 				}
86 86
 
87 87
                 // maybe load the Bricks transformer class
88
-                if( class_exists('\Bricks\Elements', false) ){
89
-					add_action( 'init', array( $this, 'load_bricks_element_class' ) );
88
+                if (class_exists('\Bricks\Elements', false)) {
89
+					add_action('init', array($this, 'load_bricks_element_class'));
90 90
                 }
91 91
 
92 92
 				// register block
93
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
94
-					add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
93
+				if (empty($this->options['output_types']) || in_array('block', $this->options['output_types'])) {
94
+					add_action('admin_enqueue_scripts', array($this, 'register_block'));
95 95
 				}
96 96
 			}
97 97
 
98 98
 			// add the CSS and JS we need ONCE
99 99
 			global $sd_widget_scripts;
100 100
 
101
-			if ( ! $sd_widget_scripts ) {
102
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
103
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
104
-				wp_add_inline_style( 'widgets', $this->widget_css() );
101
+			if (!$sd_widget_scripts) {
102
+				wp_add_inline_script('admin-widgets', $this->widget_js());
103
+				wp_add_inline_script('customize-controls', $this->widget_js());
104
+				wp_add_inline_style('widgets', $this->widget_css());
105 105
 
106 106
 				// maybe add elementor editor styles
107
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
107
+				add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles'));
108 108
 
109 109
 				$sd_widget_scripts = true;
110 110
 
111 111
 				// add shortcode insert button once
112
-				add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
113
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
112
+				add_action('media_buttons', array($this, 'wp_media_buttons'), 1);
113
+				add_action('media_buttons', array($this, 'shortcode_insert_button'));
114 114
 				// generatepress theme sections compatibility
115
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
116
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
115
+				if (function_exists('generate_sections_sections_metabox')) {
116
+					add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script'));
117 117
 				}
118 118
 
119 119
 				/* Load script on Divi theme builder page */
120
-				if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) {
120
+				if ((function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) || (function_exists('et_builder_d5_enabled') && et_builder_d5_enabled() && isset($_GET['et_fb']) && '1' === $_GET['et_fb'] && et_pb_is_allowed('use_visual_builder'))) {
121 121
 					add_thickbox();
122
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
122
+					add_action('admin_footer', array($this, 'shortcode_insert_button_script'));
123 123
 				}
124 124
 
125
-				if ( $this->is_preview() ) {
126
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
125
+				if ($this->is_preview()) {
126
+					add_action('wp_footer', array($this, 'shortcode_insert_button_script'));
127 127
 					// this makes the insert button work for elementor
128
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
128
+					add_action('elementor/editor/after_enqueue_scripts', array(
129 129
 						$this,
130 130
 						'shortcode_insert_button_script'
131
-					) ); // for elementor
131
+					)); // for elementor
132 132
 				}
133 133
 				// this makes the insert button work for cornerstone
134
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
134
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder'));
135 135
 
136
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
137
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
136
+				add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings'));
137
+				add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker'));
138 138
 
139 139
 				// add generator text to head
140
-				add_action( 'admin_head', array( $this, 'generator' ), 99 );
141
-				add_action( 'wp_head', array( $this, 'generator' ), 99 );
140
+				add_action('admin_head', array($this, 'generator'), 99);
141
+				add_action('wp_head', array($this, 'generator'), 99);
142 142
 			}
143 143
 
144
-			do_action( 'wp_super_duper_widget_init', $options, $this );
144
+			do_action('wp_super_duper_widget_init', $options, $this);
145 145
 		}
146 146
 
147 147
         /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		 * @return void
158 158
 		 */
159 159
 		public function _register() {
160
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
160
+			if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) {
161 161
 				parent::_register();
162 162
 			}
163 163
 		}
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 		 * Add our widget CSS to elementor editor.
167 167
 		 */
168 168
 		public function elementor_editor_styles() {
169
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
169
+			wp_add_inline_style('elementor-editor', $this->widget_css(false));
170 170
 		}
171 171
 
172 172
 		public function register_fusion_element() {
173 173
 
174 174
 			$options = $this->options;
175 175
 
176
-			if ( $this->base_id ) {
176
+			if ($this->base_id) {
177 177
 
178 178
 				$params = $this->get_fusion_params();
179 179
 
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 					'allow_generator' => true,
185 185
 				);
186 186
 
187
-				if ( ! empty( $params ) ) {
187
+				if (!empty($params)) {
188 188
 					$args['params'] = $params;
189 189
 				}
190 190
 
191
-				fusion_builder_map( $args );
191
+				fusion_builder_map($args);
192 192
 			}
193 193
 
194 194
 		}
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 			$params    = array();
198 198
 			$arguments = $this->get_arguments();
199 199
 
200
-			if ( ! empty( $arguments ) ) {
201
-				foreach ( $arguments as $key => $val ) {
200
+			if (!empty($arguments)) {
201
+				foreach ($arguments as $key => $val) {
202 202
 					$param = array();
203 203
 					// type
204 204
 					$param['type'] = str_replace(
@@ -220,38 +220,38 @@  discard block
 block discarded – undo
220 220
 						$val['type'] );
221 221
 
222 222
 					// multiselect
223
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
223
+					if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) {
224 224
 						$param['type']     = 'multiple_select';
225 225
 						$param['multiple'] = true;
226 226
 					}
227 227
 
228 228
 					// heading
229
-					$param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
229
+					$param['heading'] = isset($val['title']) ? $val['title'] : '';
230 230
 
231 231
 					// description
232
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
232
+					$param['description'] = isset($val['desc']) ? $val['desc'] : '';
233 233
 
234 234
 					// param_name
235 235
 					$param['param_name'] = $key;
236 236
 
237 237
 					// Default
238
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
238
+					$param['default'] = isset($val['default']) ? $val['default'] : '';
239 239
 
240 240
 					// Group
241
-					if ( isset( $val['group'] ) ) {
241
+					if (isset($val['group'])) {
242 242
 						$param['group'] = $val['group'];
243 243
 					}
244 244
 
245 245
 					// value
246
-					if ( $val['type'] == 'checkbox' ) {
247
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
248
-							unset( $param['default'] );
246
+					if ($val['type'] == 'checkbox') {
247
+						if (isset($val['default']) && $val['default'] == '0') {
248
+							unset($param['default']);
249 249
 						}
250
-						$param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
251
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
252
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
250
+						$param['value'] = array('0' => __("No", 'ayecode-connect'), '1' => __("Yes", 'ayecode-connect'));
251
+					} elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') {
252
+						$param['value'] = isset($val['options']) ? $val['options'] : array();
253 253
 					} else {
254
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
254
+						$param['value'] = isset($val['default']) ? $val['default'] : '';
255 255
 					}
256 256
 
257 257
 					// setup the param
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
269 269
 		 */
270 270
 		public static function maybe_cornerstone_builder() {
271
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
271
+			if (did_action('cornerstone_before_boot_app')) {
272 272
 				self::shortcode_insert_button_script();
273 273
 			}
274 274
 		}
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 		 *
281 281
 		 * @return string
282 282
 		 */
283
-		public static function get_picker( $editor_id = '' ) {
283
+		public static function get_picker($editor_id = '') {
284 284
 
285 285
 			ob_start();
286
-			if ( isset( $_POST['editor_id'] ) ) {
287
-				$editor_id = esc_attr( $_POST['editor_id'] );
288
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
286
+			if (isset($_POST['editor_id'])) {
287
+				$editor_id = esc_attr($_POST['editor_id']);
288
+			} elseif (isset($_REQUEST['et_fb'])) {
289 289
 				$editor_id = 'main_content_content_vb_tiny_mce';
290 290
 			}
291 291
 
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 
297 297
 			<div class="sd-shortcode-left-wrap">
298 298
 				<?php
299
-				ksort( $sd_widgets );
299
+				ksort($sd_widgets);
300 300
 				//				print_r($sd_widgets);exit;
301
-				if ( ! empty( $sd_widgets ) ) {
301
+				if (!empty($sd_widgets)) {
302 302
 					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
303
-					echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
304
-					foreach ( $sd_widgets as $shortcode => $class ) {
305
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
306
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
303
+					echo "<option>" . __('Select shortcode', 'ayecode-connect') . "</option>";
304
+					foreach ($sd_widgets as $shortcode => $class) {
305
+						if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; }
306
+						echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
307 307
 					}
308 308
 					echo "</select>";
309 309
 
@@ -314,32 +314,32 @@  discard block
 block discarded – undo
314 314
 			<div class="sd-shortcode-right-wrap">
315 315
 				<textarea id='sd-shortcode-output' disabled></textarea>
316 316
 				<div id='sd-shortcode-output-actions'>
317
-					<?php if ( $editor_id != '' ) { ?>
318
-						<button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e( 'Insert shortcode', 'ayecode-connect' ); ?></button>
317
+					<?php if ($editor_id != '') { ?>
318
+						<button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e('Insert shortcode', 'ayecode-connect'); ?></button>
319 319
 					<?php } ?>
320
-					<button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy shortcode' ); ?></button>
320
+					<button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e('Copy shortcode'); ?></button>
321 321
 				</div>
322 322
 			</div>
323 323
 			<?php
324 324
 			$html = ob_get_clean();
325 325
 
326
-			if ( wp_doing_ajax() ) {
326
+			if (wp_doing_ajax()) {
327 327
 				echo $html;
328 328
 				$should_die = true;
329 329
 
330 330
 				// some builder get the editor via ajax so we should not die on those occasions
331 331
 				$dont_die = array(
332
-					'parent_tag',// WP Bakery
332
+					'parent_tag', // WP Bakery
333 333
 					'avia_request' // enfold
334 334
 				);
335 335
 
336
-				foreach ( $dont_die as $request ) {
337
-					if ( isset( $_REQUEST[ $request ] ) ) {
336
+				foreach ($dont_die as $request) {
337
+					if (isset($_REQUEST[$request])) {
338 338
 						$should_die = false;
339 339
 					}
340 340
 				}
341 341
 
342
-				if ( $should_die ) {
342
+				if ($should_die) {
343 343
 					wp_die();
344 344
 				}
345 345
 			} else {
@@ -353,22 +353,22 @@  discard block
 block discarded – undo
353 353
 		 * Output the version in the header.
354 354
 		 */
355 355
 		public function generator() {
356
-			$file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
357
-			$plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
356
+			$file = str_replace(array("/", "\\"), "/", realpath(__FILE__));
357
+			$plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR));
358 358
 
359 359
 			// Find source plugin/theme of SD
360 360
 			$source = array();
361
-			if ( strpos( $file, $plugins_dir ) !== false ) {
362
-				$source = explode( "/", plugin_basename( $file ) );
363
-			} else if ( function_exists( 'get_theme_root' ) ) {
364
-				$themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
361
+			if (strpos($file, $plugins_dir) !== false) {
362
+				$source = explode("/", plugin_basename($file));
363
+			} else if (function_exists('get_theme_root')) {
364
+				$themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root()));
365 365
 
366
-				if ( strpos( $file, $themes_dir ) !== false ) {
367
-					$source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
366
+				if (strpos($file, $themes_dir) !== false) {
367
+					$source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/"));
368 368
 				}
369 369
 			}
370 370
 
371
-			echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
371
+			echo '<meta name="generator" content="WP Super Duper v' . esc_attr($this->version) . '"' . (!empty($source[0]) ? ' data-sd-source="' . esc_attr($source[0]) . '"' : '') . ' />';
372 372
 		}
373 373
 
374 374
 		/**
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 		public static function get_widget_settings() {
380 380
 			global $sd_widgets;
381 381
 
382
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
383
-			if ( ! $shortcode ) {
382
+			$shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : '';
383
+			if (!$shortcode) {
384 384
 				wp_die();
385 385
 			}
386
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
387
-			if ( ! $widget_args ) {
386
+			$widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : '';
387
+			if (!$widget_args) {
388 388
 				wp_die();
389 389
 			}
390
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
-			if ( ! $class_name ) {
390
+			$class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
+			if (!$class_name) {
392 392
 				wp_die();
393 393
 			}
394 394
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			$widget = new $class_name;
397 397
 
398 398
 			ob_start();
399
-			$widget->form( array() );
399
+			$widget->form(array());
400 400
 			$form = ob_get_clean();
401 401
 			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
402 402
 			echo "<style>" . $widget->widget_css() . "</style>";
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 		 *@since 1.0.0
416 416
 		 *
417 417
 		 */
418
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
418
+		public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
419 419
 			global $sd_widgets, $shortcode_insert_button_once;
420
-			if ( $shortcode_insert_button_once ) {
420
+			if ($shortcode_insert_button_once) {
421 421
 				return;
422 422
 			}
423 423
 			add_thickbox();
@@ -426,21 +426,21 @@  discard block
 block discarded – undo
426 426
 			 * Cornerstone makes us play dirty tricks :/
427 427
 			 * 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.
428 428
 			 */
429
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
429
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
430 430
 				echo '<span id="insert-media-button">';
431 431
 			}
432 432
 
433
-			echo self::shortcode_button( 'this', 'true' );
433
+			echo self::shortcode_button('this', 'true');
434 434
 
435 435
 			// see opening note
436
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
436
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
437 437
 				echo '</span>'; // end #insert-media-button
438 438
 			}
439 439
 
440 440
 			// Add separate script for generatepress theme sections
441
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
441
+			if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) {
442 442
 			} else {
443
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
443
+				self::shortcode_insert_button_script($editor_id, $insert_shortcode_function);
444 444
 			}
445 445
 
446 446
 			$shortcode_insert_button_once = true;
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
 		 *
455 455
 		 * @return mixed
456 456
 		 */
457
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
457
+		public static function shortcode_button($id = '', $search_for_id = '') {
458 458
 			ob_start();
459 459
 			?>
460 460
 			<span class="sd-lable-shortcode-inserter">
461 461
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
462
-				if ( $search_for_id ) {
462
+				if ($search_for_id) {
463 463
 					echo "," . $search_for_id;
464 464
 				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
465 465
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			$html = ob_get_clean();
476 476
 
477 477
 			// remove line breaks so we can use it in js
478
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
478
+			return preg_replace("/\r|\n/", "", trim($html));
479 479
 		}
480 480
 
481 481
 		/**
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 						jQuery($this).data('sd-widget-enabled', true);
532 532
 					}
533 533
 
534
-					var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" 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>';
534
+					var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" 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>';
535 535
 					var form = jQuery($this).parents('' + $selector + '');
536 536
 
537 537
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
567 567
 			 */
568 568
 
569
-			return str_replace( array(
569
+			return str_replace(array(
570 570
 				'<script>',
571 571
 				'</script>'
572
-			), '', $output );
572
+			), '', $output);
573 573
 		}
574 574
 
575 575
 		/**
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		 *@since 1.0.6
582 582
 		 *
583 583
 		 */
584
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
584
+		public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') {
585 585
 			?>
586 586
 			<style>
587 587
 				.sd-shortcode-left-wrap {
@@ -700,25 +700,25 @@  discard block
 block discarded – undo
700 700
 					width: 100%;
701 701
 				}
702 702
 
703
-				<?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?>
703
+				<?php if (function_exists('generate_sections_sections_metabox')) { ?>
704 704
 				.generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter {
705 705
 					display: inline;
706 706
 				}
707 707
 				<?php } ?>
708
-				<?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?>
708
+				<?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?>
709 709
 				body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999}
710 710
 				<?php } ?>
711 711
 			</style>
712 712
 			<?php
713
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
713
+			if (class_exists('SiteOrigin_Panels')) {
714 714
 				echo "<script>" . self::siteorigin_js() . "</script>";
715 715
 			}
716 716
 			?>
717 717
 			<script>
718 718
 				<?php
719
-				if(! empty( $insert_shortcode_function )){
719
+				if (!empty($insert_shortcode_function)) {
720 720
 					echo $insert_shortcode_function;
721
-				}else{
721
+				} else {
722 722
 
723 723
 				/**
724 724
 				 * Function for super duper insert shortcode.
@@ -731,9 +731,9 @@  discard block
 block discarded – undo
731 731
 					if ($shortcode) {
732 732
 						if (!$editor_id) {
733 733
 							<?php
734
-							if ( isset( $_REQUEST['et_fb'] ) ) {
734
+							if (isset($_REQUEST['et_fb'])) {
735 735
 								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
736
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
736
+							} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') {
737 737
 								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
738 738
 							} else {
739 739
 								echo '$editor_id = "#wp-content-editor-container textarea";';
@@ -815,11 +815,11 @@  discard block
 block discarded – undo
815 815
 							'shortcode': $short_code,
816 816
 							'attributes': 123,
817 817
 							'post_id': 321,
818
-							'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
818
+							'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
819 819
 						};
820 820
 
821 821
 						if (typeof ajaxurl === 'undefined') {
822
-							var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>";
822
+							var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
823 823
 						}
824 824
 
825 825
 						jQuery.post(ajaxurl, data, function (response) {
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 					});
945 945
 
946 946
 					// The below tries to add the shortcode builder button to the builders own raw/shortcode sections.
947
-					<?php if ( function_exists( 'et_setup_theme' ) ) { ?>
947
+					<?php if (function_exists('et_setup_theme')) { ?>
948 948
 					// DIVI
949 949
 					jQuery(document).on('focusin', '.et-fb-codemirror', function () {
950 950
 						// insert the shortcode button to the textarea lable if not there already
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 					var data = {
1037 1037
 						'action': 'super_duper_get_picker',
1038 1038
 						'editor_id': $id,
1039
-						'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>'
1039
+						'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>'
1040 1040
 					};
1041 1041
 
1042 1042
 					if (!ajaxurl) {
1043
-						var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
1043
+						var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
1044 1044
 					}
1045 1045
 
1046 1046
 					jQuery.post(ajaxurl, data, function (response) {
@@ -1062,9 +1062,9 @@  discard block
 block discarded – undo
1062 1062
 				 */
1063 1063
 				function sd_shortcode_button($id) {
1064 1064
 					if ($id) {
1065
-						return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>';
1065
+						return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>';
1066 1066
 					} else {
1067
-						return '<?php echo self::shortcode_button();?>';
1067
+						return '<?php echo self::shortcode_button(); ?>';
1068 1068
 					}
1069 1069
 				}
1070 1070
 			</script>
@@ -1078,11 +1078,11 @@  discard block
 block discarded – undo
1078 1078
 		 *
1079 1079
 		 * @return mixed
1080 1080
 		 */
1081
-		public function widget_css( $advanced = true ) {
1081
+		public function widget_css($advanced = true) {
1082 1082
 			ob_start();
1083 1083
 			?>
1084 1084
 			<style>
1085
-				<?php if( $advanced ){ ?>
1085
+				<?php if ($advanced) { ?>
1086 1086
 				.sd-advanced-setting {
1087 1087
 					display: none;
1088 1088
 				}
@@ -1126,10 +1126,10 @@  discard block
 block discarded – undo
1126 1126
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1127 1127
 			 */
1128 1128
 
1129
-			return str_replace( array(
1129
+			return str_replace(array(
1130 1130
 				'<style>',
1131 1131
 				'</style>'
1132
-			), '', $output );
1132
+			), '', $output);
1133 1133
 		}
1134 1134
 
1135 1135
 		/**
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 						jQuery($this).data('sd-widget-enabled', true);
1197 1197
 					}
1198 1198
 
1199
-					var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" 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>';
1199
+					var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" 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>';
1200 1200
 					var form = $form ? $form : jQuery($this).parents('' + $selector + '');
1201 1201
 
1202 1202
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 					});
1288 1288
 
1289 1289
 				}
1290
-				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1290
+				<?php do_action('wp_super_duper_widget_js', $this); ?>
1291 1291
 			</script>
1292 1292
 			<?php
1293 1293
 			$output = ob_get_clean();
@@ -1296,10 +1296,10 @@  discard block
 block discarded – undo
1296 1296
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1297 1297
 			 */
1298 1298
 
1299
-			return str_replace( array(
1299
+			return str_replace(array(
1300 1300
 				'<script>',
1301 1301
 				'</script>'
1302
-			), '', $output );
1302
+			), '', $output);
1303 1303
 		}
1304 1304
 
1305 1305
 
@@ -1310,14 +1310,14 @@  discard block
 block discarded – undo
1310 1310
 		 *
1311 1311
 		 * @return mixed
1312 1312
 		 */
1313
-		private function add_name_from_key( $options, $arguments = false ) {
1314
-			if ( ! empty( $options['arguments'] ) ) {
1315
-				foreach ( $options['arguments'] as $key => $val ) {
1316
-					$options['arguments'][ $key ]['name'] = $key;
1313
+		private function add_name_from_key($options, $arguments = false) {
1314
+			if (!empty($options['arguments'])) {
1315
+				foreach ($options['arguments'] as $key => $val) {
1316
+					$options['arguments'][$key]['name'] = $key;
1317 1317
 				}
1318
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1319
-				foreach ( $options as $key => $val ) {
1320
-					$options[ $key ]['name'] = $key;
1318
+			} elseif ($arguments && is_array($options) && !empty($options)) {
1319
+				foreach ($options as $key => $val) {
1320
+					$options[$key]['name'] = $key;
1321 1321
 				}
1322 1322
 			}
1323 1323
 
@@ -1330,8 +1330,8 @@  discard block
 block discarded – undo
1330 1330
 		 * @since 1.0.0
1331 1331
 		 */
1332 1332
 		public function register_shortcode() {
1333
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1334
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1333
+			add_shortcode($this->base_id, array($this, 'shortcode_output'));
1334
+			add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode'));
1335 1335
 		}
1336 1336
 
1337 1337
 		/**
@@ -1340,50 +1340,50 @@  discard block
 block discarded – undo
1340 1340
 		 * @since 1.0.0
1341 1341
 		 */
1342 1342
 		public function render_shortcode() {
1343
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1344
-			if ( ! current_user_can( 'manage_options' ) ) {
1343
+			check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
1344
+			if (!current_user_can('manage_options')) {
1345 1345
 				wp_die();
1346 1346
 			}
1347 1347
 
1348 1348
 			// we might need the $post value here so lets set it.
1349
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1350
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1351
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1349
+			if (isset($_POST['post_id']) && $_POST['post_id']) {
1350
+				$post_obj = get_post(absint($_POST['post_id']));
1351
+				if (!empty($post_obj) && empty($post)) {
1352 1352
 					global $post;
1353 1353
 					$post = $post_obj;
1354 1354
 				}
1355 1355
 			}
1356 1356
 
1357
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1357
+			if (isset($_POST['shortcode']) && $_POST['shortcode']) {
1358 1358
 				$is_preview = $this->is_preview();
1359
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1360
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1359
+				$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
1360
+				$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
1361 1361
 				$attributes       = '';
1362
-				if ( ! empty( $attributes_array ) ) {
1363
-					foreach ( $attributes_array as $key => $value ) {
1364
-						if ( is_array( $value ) ) {
1365
-							$value = implode( ",", $value );
1362
+				if (!empty($attributes_array)) {
1363
+					foreach ($attributes_array as $key => $value) {
1364
+						if (is_array($value)) {
1365
+							$value = implode(",", $value);
1366 1366
 						}
1367 1367
 
1368
-						if ( ! empty( $value ) ) {
1369
-							$value = wp_unslash( $value );
1368
+						if (!empty($value)) {
1369
+							$value = wp_unslash($value);
1370 1370
 
1371 1371
 							// Encode [ and ].
1372
-							if ( $is_preview ) {
1373
-								$value = $this->encode_shortcodes( $value );
1372
+							if ($is_preview) {
1373
+								$value = $this->encode_shortcodes($value);
1374 1374
 							}
1375 1375
 						}
1376
-						$attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1376
+						$attributes .= " " . esc_attr(sanitize_title_with_dashes($key)) . "='" . esc_attr($value) . "' ";
1377 1377
 					}
1378 1378
 				}
1379 1379
 
1380
-				$shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1380
+				$shortcode = "[" . esc_attr($shortcode_name) . " " . $attributes . "]";
1381 1381
 
1382
-				$content = do_shortcode( $shortcode );
1382
+				$content = do_shortcode($shortcode);
1383 1383
 
1384 1384
 				// Decode [ and ].
1385
-				if ( ! empty( $content ) && $is_preview ) {
1386
-					$content = $this->decode_shortcodes( $content );
1385
+				if (!empty($content) && $is_preview) {
1386
+					$content = $this->decode_shortcodes($content);
1387 1387
 				}
1388 1388
 
1389 1389
 				echo $content;
@@ -1399,21 +1399,21 @@  discard block
 block discarded – undo
1399 1399
 		 *
1400 1400
 		 * @return string
1401 1401
 		 */
1402
-		public function shortcode_output( $args = array(), $content = '' ) {
1402
+		public function shortcode_output($args = array(), $content = '') {
1403 1403
 			$_instance = $args;
1404 1404
 
1405
-			$args = $this->argument_values( $args );
1405
+			$args = $this->argument_values($args);
1406 1406
 
1407 1407
 			// add extra argument so we know its a output to gutenberg
1408 1408
 			//$args
1409
-			$args = $this->string_to_bool( $args );
1409
+			$args = $this->string_to_bool($args);
1410 1410
 
1411 1411
 			// if we have a enclosed shortcode we add it to the special `html` argument
1412
-			if ( ! empty( $content ) ) {
1412
+			if (!empty($content)) {
1413 1413
 				$args['html'] = $content;
1414 1414
 			}
1415 1415
 
1416
-			if ( ! $this->is_preview() ) {
1416
+			if (!$this->is_preview()) {
1417 1417
 				/**
1418 1418
 				 * Filters the settings for a particular widget args.
1419 1419
 				 *
@@ -1424,40 +1424,40 @@  discard block
 block discarded – undo
1424 1424
 				 *@since 1.0.28
1425 1425
 				 *
1426 1426
 				 */
1427
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1427
+				$args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance);
1428 1428
 
1429
-				if ( ! is_array( $args ) ) {
1429
+				if (!is_array($args)) {
1430 1430
 					return $args;
1431 1431
 				}
1432 1432
 			}
1433 1433
 
1434
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1435
-			$class .= " sdel-".$this->get_instance_hash();
1434
+			$class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : '';
1435
+			$class .= " sdel-" . $this->get_instance_hash();
1436 1436
 
1437
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1438
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1437
+			$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
1438
+			$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
1439 1439
 
1440
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1441
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1440
+			$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
1441
+			$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
1442 1442
 
1443 1443
 			$shortcode_args = array();
1444 1444
 			$output         = '';
1445
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1446
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1445
+			$no_wrap        = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1446
+			if (isset($args['no_wrap']) && $args['no_wrap']) {
1447 1447
 				$no_wrap = true;
1448 1448
 			}
1449
-			$main_content = $this->output( $args, $shortcode_args, $content );
1450
-			if ( $main_content && ! $no_wrap ) {
1449
+			$main_content = $this->output($args, $shortcode_args, $content);
1450
+			if ($main_content && !$no_wrap) {
1451 1451
 				// wrap the shortcode in a div with the same class as the widget
1452 1452
 				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1453
-				if ( ! empty( $args['title'] ) ) {
1453
+				if (!empty($args['title'])) {
1454 1454
 					// if its a shortcode and there is a title try to grab the title wrappers
1455
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1456
-					if ( empty( $instance ) ) {
1455
+					$shortcode_args = array('before_title' => '', 'after_title' => '');
1456
+					if (empty($instance)) {
1457 1457
 						global $wp_registered_sidebars;
1458
-						if ( ! empty( $wp_registered_sidebars ) ) {
1459
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1460
-								if ( ! empty( $sidebar['before_title'] ) ) {
1458
+						if (!empty($wp_registered_sidebars)) {
1459
+							foreach ($wp_registered_sidebars as $sidebar) {
1460
+								if (!empty($sidebar['before_title'])) {
1461 1461
 									$shortcode_args['before_title'] = $sidebar['before_title'];
1462 1462
 									$shortcode_args['after_title']  = $sidebar['after_title'];
1463 1463
 									break;
@@ -1465,20 +1465,20 @@  discard block
 block discarded – undo
1465 1465
 							}
1466 1466
 						}
1467 1467
 					}
1468
-					$output .= $this->output_title( $shortcode_args, $args );
1468
+					$output .= $this->output_title($shortcode_args, $args);
1469 1469
 				}
1470 1470
 				$output .= $main_content;
1471 1471
 				$output .= '</div>';
1472
-			} elseif ( $main_content && $no_wrap ) {
1472
+			} elseif ($main_content && $no_wrap) {
1473 1473
 				$output .= $main_content;
1474 1474
 			}
1475 1475
 
1476 1476
 			// if preview show a placeholder if empty
1477
-			if ( $this->is_preview() && $output == '' ) {
1478
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1477
+			if ($this->is_preview() && $output == '') {
1478
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
1479 1479
 			}
1480 1480
 
1481
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1481
+			return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this);
1482 1482
 		}
1483 1483
 
1484 1484
 		/**
@@ -1488,8 +1488,8 @@  discard block
 block discarded – undo
1488 1488
 		 *
1489 1489
 		 * @return string
1490 1490
 		 */
1491
-		public function preview_placeholder_text( $name = '' ) {
1492
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1491
+		public function preview_placeholder_text($name = '') {
1492
+			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf(__('Placeholder for: %s', 'ayecode-connect'), $name) . "</div>";
1493 1493
 		}
1494 1494
 
1495 1495
 		/**
@@ -1499,13 +1499,13 @@  discard block
 block discarded – undo
1499 1499
 		 *
1500 1500
 		 * @return mixed
1501 1501
 		 */
1502
-		public function string_to_bool( $options ) {
1502
+		public function string_to_bool($options) {
1503 1503
 			// convert bool strings to booleans
1504
-			foreach ( $options as $key => $val ) {
1505
-				if ( $val == 'false' ) {
1506
-					$options[ $key ] = false;
1507
-				} elseif ( $val == 'true' ) {
1508
-					$options[ $key ] = true;
1504
+			foreach ($options as $key => $val) {
1505
+				if ($val == 'false') {
1506
+					$options[$key] = false;
1507
+				} elseif ($val == 'true') {
1508
+					$options[$key] = true;
1509 1509
 				}
1510 1510
 			}
1511 1511
 
@@ -1521,26 +1521,26 @@  discard block
 block discarded – undo
1521 1521
 		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1522 1522
 		 *
1523 1523
 		 */
1524
-		public function argument_values( $instance ) {
1524
+		public function argument_values($instance) {
1525 1525
 			$argument_values = array();
1526 1526
 
1527 1527
 			// set widget instance
1528 1528
 			$this->instance = $instance;
1529 1529
 
1530
-			if ( empty( $this->arguments ) ) {
1530
+			if (empty($this->arguments)) {
1531 1531
 				$this->arguments = $this->get_arguments();
1532 1532
 			}
1533 1533
 
1534
-			if ( ! empty( $this->arguments ) ) {
1535
-				foreach ( $this->arguments as $key => $args ) {
1534
+			if (!empty($this->arguments)) {
1535
+				foreach ($this->arguments as $key => $args) {
1536 1536
 					// set the input name from the key
1537 1537
 					$args['name'] = $key;
1538 1538
 					//
1539
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1540
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1539
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
1540
+					if ($args['type'] == 'checkbox' && $argument_values[$key] == '') {
1541 1541
 						// don't set default for an empty checkbox
1542
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1543
-						$argument_values[ $key ] = $args['default'];
1542
+					} elseif ($argument_values[$key] == '' && isset($args['default'])) {
1543
+						$argument_values[$key] = $args['default'];
1544 1544
 					}
1545 1545
 				}
1546 1546
 			}
@@ -1567,15 +1567,15 @@  discard block
 block discarded – undo
1567 1567
 		 *
1568 1568
 		 */
1569 1569
 		public function get_arguments() {
1570
-			if ( empty( $this->arguments ) ) {
1570
+			if (empty($this->arguments)) {
1571 1571
 				$this->arguments = $this->set_arguments();
1572 1572
 			}
1573 1573
 
1574
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1575
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1574
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
1575
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
1576 1576
 
1577
-            if( !empty( $this->arguments['title']['value'] ) ){
1578
-                $this->arguments['title']['value'] = wp_kses_post( $this->arguments['title']['value'] );
1577
+            if (!empty($this->arguments['title']['value'])) {
1578
+                $this->arguments['title']['value'] = wp_kses_post($this->arguments['title']['value']);
1579 1579
             }
1580 1580
 
1581 1581
 			return $this->arguments;
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 		 * @param array $widget_args
1589 1589
 		 * @param string $content
1590 1590
 		 */
1591
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1591
+		public function output($args = array(), $widget_args = array(), $content = '') {
1592 1592
 
1593 1593
 		}
1594 1594
 
@@ -1596,9 +1596,9 @@  discard block
 block discarded – undo
1596 1596
 		 * Add the dynamic block code inline when the wp-block in enqueued.
1597 1597
 		 */
1598 1598
 		public function register_block() {
1599
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1600
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1601
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1599
+			wp_add_inline_script('wp-blocks', $this->block());
1600
+			if (class_exists('SiteOrigin_Panels')) {
1601
+				wp_add_inline_script('wp-blocks', $this->siteorigin_js());
1602 1602
 			}
1603 1603
 		}
1604 1604
 
@@ -1612,9 +1612,9 @@  discard block
 block discarded – undo
1612 1612
 			$show      = false;
1613 1613
 			$arguments = $this->get_arguments();
1614 1614
 
1615
-			if ( ! empty( $arguments ) ) {
1616
-				foreach ( $arguments as $argument ) {
1617
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1615
+			if (!empty($arguments)) {
1616
+				foreach ($arguments as $argument) {
1617
+					if (isset($argument['advanced']) && $argument['advanced']) {
1618 1618
 						$show = true;
1619 1619
 						break; // no need to continue if we know we have it
1620 1620
 					}
@@ -1632,19 +1632,19 @@  discard block
 block discarded – undo
1632 1632
 		public function get_url() {
1633 1633
 			$url = $this->url;
1634 1634
 
1635
-			if ( ! $url ) {
1636
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1637
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1635
+			if (!$url) {
1636
+				$content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR));
1637
+				$content_url = untrailingslashit(WP_CONTENT_URL);
1638 1638
 
1639 1639
 				// Replace http:// to https://.
1640
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1641
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1640
+				if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) {
1641
+					$content_url = str_replace('http://', 'https://', $content_url);
1642 1642
 				}
1643 1643
 
1644 1644
 				// Check if we are inside a plugin
1645
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1646
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1647
-				$url = trailingslashit( $url );
1645
+				$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
1646
+				$url = str_replace($content_dir, $content_url, $file_dir);
1647
+				$url = trailingslashit($url);
1648 1648
 				$this->url = $url;
1649 1649
 			}
1650 1650
 
@@ -1660,15 +1660,15 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 			$url = $this->url;
1662 1662
 
1663
-			if ( ! $url ) {
1663
+			if (!$url) {
1664 1664
 				// check if we are inside a plugin
1665
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1665
+				$file_dir = str_replace("/includes", "", dirname(__FILE__));
1666 1666
 
1667
-				$dir_parts = explode( "/wp-content/", $file_dir );
1668
-				$url_parts = explode( "/wp-content/", plugins_url() );
1667
+				$dir_parts = explode("/wp-content/", $file_dir);
1668
+				$url_parts = explode("/wp-content/", plugins_url());
1669 1669
 
1670
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1671
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1670
+				if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1671
+					$url       = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]);
1672 1672
 					$this->url = $url;
1673 1673
 				}
1674 1674
 			}
@@ -1689,45 +1689,45 @@  discard block
 block discarded – undo
1689 1689
 		 * @return string
1690 1690
 		 *@since 1.1.0
1691 1691
 		 */
1692
-		public function get_block_icon( $icon ) {
1692
+		public function get_block_icon($icon) {
1693 1693
 
1694 1694
 			// check if we have a Font Awesome icon
1695 1695
 			$fa_type = '';
1696
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1696
+			if (substr($icon, 0, 7) === "fas fa-") {
1697 1697
 				$fa_type = 'solid';
1698
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1698
+			} elseif (substr($icon, 0, 7) === "far fa-") {
1699 1699
 				$fa_type = 'regular';
1700
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1700
+			} elseif (substr($icon, 0, 7) === "fab fa-") {
1701 1701
 				$fa_type = 'brands';
1702 1702
 			} else {
1703 1703
 				$icon = "'" . $icon . "'";
1704 1704
 			}
1705 1705
 
1706 1706
 			// set the icon if we found one
1707
-			if ( $fa_type ) {
1708
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1707
+			if ($fa_type) {
1708
+				$fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon);
1709 1709
 				$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 . "'}))";
1710 1710
 			}
1711 1711
 
1712 1712
 			return $icon;
1713 1713
 		}
1714 1714
 
1715
-		public function group_arguments( $arguments ) {
1716
-			if ( ! empty( $arguments ) ) {
1715
+		public function group_arguments($arguments) {
1716
+			if (!empty($arguments)) {
1717 1717
 				$temp_arguments = array();
1718
-				$general        = __( "General", 'ayecode-connect' );
1718
+				$general        = __("General", 'ayecode-connect');
1719 1719
 				$add_sections   = false;
1720
-				foreach ( $arguments as $key => $args ) {
1721
-					if ( isset( $args['group'] ) ) {
1722
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1720
+				foreach ($arguments as $key => $args) {
1721
+					if (isset($args['group'])) {
1722
+						$temp_arguments[$args['group']][$key] = $args;
1723 1723
 						$add_sections                             = true;
1724 1724
 					} else {
1725
-						$temp_arguments[ $general ][ $key ] = $args;
1725
+						$temp_arguments[$general][$key] = $args;
1726 1726
 					}
1727 1727
 				}
1728 1728
 
1729 1729
 				// only add sections if more than one
1730
-				if ( $add_sections ) {
1730
+				if ($add_sections) {
1731 1731
 					$arguments = $temp_arguments;
1732 1732
 				}
1733 1733
 			}
@@ -1740,38 +1740,38 @@  discard block
 block discarded – undo
1740 1740
 		 *
1741 1741
 		 * @since 1.1.17
1742 1742
 		 */
1743
-		public function group_block_tabs( $tabs, $arguments ) {
1744
-			if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1743
+		public function group_block_tabs($tabs, $arguments) {
1744
+			if (!empty($tabs) && !empty($arguments)) {
1745 1745
 				$has_sections = false;
1746 1746
 
1747
-				foreach ( $this->arguments as $key => $args ) {
1748
-					if ( isset( $args['group'] ) ) {
1747
+				foreach ($this->arguments as $key => $args) {
1748
+					if (isset($args['group'])) {
1749 1749
 						$has_sections = true;
1750 1750
 						break;
1751 1751
 					}
1752 1752
 				}
1753 1753
 
1754
-				if ( ! $has_sections ) {
1754
+				if (!$has_sections) {
1755 1755
 					return $tabs;
1756 1756
 				}
1757 1757
 
1758 1758
 				$new_tabs = array();
1759 1759
 
1760
-				foreach ( $tabs as $tab_key => $tab ) {
1760
+				foreach ($tabs as $tab_key => $tab) {
1761 1761
 					$new_groups = array();
1762 1762
 
1763
-					if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1764
-						foreach ( $tab['groups'] as $group ) {
1765
-							if ( isset( $arguments[ $group ] ) ) {
1763
+					if (!empty($tab['groups']) && is_array($tab['groups'])) {
1764
+						foreach ($tab['groups'] as $group) {
1765
+							if (isset($arguments[$group])) {
1766 1766
 								$new_groups[] = $group;
1767 1767
 							}
1768 1768
 						}
1769 1769
 					}
1770 1770
 
1771
-					if ( ! empty( $new_groups ) ) {
1771
+					if (!empty($new_groups)) {
1772 1772
 						$tab['groups'] = $new_groups;
1773 1773
 
1774
-						$new_tabs[ $tab_key ] = $tab;
1774
+						$new_tabs[$tab_key] = $tab;
1775 1775
 					}
1776 1776
 				}
1777 1777
 
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 			?>
1799 1799
 			<script>
1800 1800
 			<?php
1801
-			if ( ! $sd_is_js_functions_loaded ) {
1801
+			if (!$sd_is_js_functions_loaded) {
1802 1802
 				$sd_is_js_functions_loaded = true;
1803 1803
 			?>
1804 1804
 function sd_show_view_options($this){
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
 	}
2122 2122
 }
2123 2123
 
2124
-<?php if( !isset( $_REQUEST['sd-block-recover-debug'] ) ){ ?>
2124
+<?php if (!isset($_REQUEST['sd-block-recover-debug'])) { ?>
2125 2125
 // Wait will window is loaded before calling.
2126 2126
 window.onload = function() {
2127 2127
 	sd_auto_recover_blocks();
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
 				$classes = [];
2301 2301
 
2302 2302
 				<?php
2303
-				if($aui_bs5){
2303
+				if ($aui_bs5) {
2304 2304
 					?>
2305 2305
 				$aui_bs5 = true;
2306 2306
 				$p_ml = 'ms-';
@@ -2309,7 +2309,7 @@  discard block
 block discarded – undo
2309 2309
 				$p_pl = 'ps-';
2310 2310
 				$p_pr = 'pe-';
2311 2311
 					<?php
2312
-				}else{
2312
+				} else {
2313 2313
 						?>
2314 2314
 				$aui_bs5 = false;
2315 2315
 				$p_ml = 'ml-';
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
 			}
2498 2498
 
2499 2499
 			function sd_get_class_build_keys(){
2500
-				return <?php echo json_encode(sd_get_class_build_keys());?>;
2500
+				return <?php echo json_encode(sd_get_class_build_keys()); ?>;
2501 2501
 			}
2502 2502
 
2503 2503
 			<?php
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
 
2506 2506
 			}
2507 2507
 
2508
-			if(method_exists($this,'block_global_js')){
2508
+			if (method_exists($this, 'block_global_js')) {
2509 2509
 					echo $this->block_global_js();
2510 2510
 			}
2511 2511
 			?>
@@ -2537,9 +2537,9 @@  discard block
 block discarded – undo
2537 2537
 					var InnerBlocks = blockEditor.InnerBlocks;
2538 2538
 
2539 2539
 					var term_query_type = '';
2540
-					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 "[]";} ?>;
2541
-					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2542
-					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2540
+					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 "[]"; } ?>;
2541
+					const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
2542
+					const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
2543 2543
 					const MediaUpload = wp.blockEditor.MediaUpload;
2544 2544
 
2545 2545
 					/**
@@ -2554,87 +2554,87 @@  discard block
 block discarded – undo
2554 2554
 					 * @return {?WPBlock}          The block, if it has been successfully
2555 2555
 					 *                             registered; otherwise `undefined`.
2556 2556
 					 */
2557
-					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.
2558
-						apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>,
2559
-						title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title.
2560
-						description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title.
2561
-						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/.
2557
+					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.
2558
+						apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>,
2559
+						title: '<?php echo addslashes($this->options['name']); ?>', // Block title.
2560
+						description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title.
2561
+						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/.
2562 2562
 						supports: {
2563 2563
 							<?php
2564
-							if(!isset($this->options['block-supports']['renaming'])){
2564
+							if (!isset($this->options['block-supports']['renaming'])) {
2565 2565
 								$this->options['block-supports']['renaming'] = false;
2566 2566
 							}
2567
-							if ( isset( $this->options['block-supports'] ) ) {
2568
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2567
+							if (isset($this->options['block-supports'])) {
2568
+								echo $this->array_to_attributes($this->options['block-supports']);
2569 2569
 							}
2570 2570
 							?>
2571 2571
 						},
2572 2572
 						__experimentalLabel( attributes, { context } ) {
2573 2573
 							var visibility_html = attributes && attributes.visibility_conditions ? ' &#128065;' : '';
2574 2574
 							var metadata_name = attributes && attributes.metadata && attributes.metadata.name ? attributes.metadata.name : '';
2575
-							var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr( addslashes( $this->options['name'] ) ) . "'"; ?>;
2575
+							var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr(addslashes($this->options['name'])) . "'"; ?>;
2576 2576
 							return metadata_name ? metadata_name + visibility_html  : label_name + visibility_html;
2577 2577
 						},
2578
-						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.
2579
-						<?php if ( isset( $this->options['block-keywords'] ) ) {
2578
+						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.
2579
+						<?php if (isset($this->options['block-keywords'])) {
2580 2580
 						echo "keywords : " . $this->options['block-keywords'] . ",";
2581 2581
 						}
2582 2582
 
2583 2583
 
2584 2584
 						// block hover preview.
2585 2585
 						$example_args = array();
2586
-						if(!empty($this->arguments)){
2587
-							foreach($this->arguments as $key => $a_args){
2588
-								if(isset($a_args['example'])){
2586
+						if (!empty($this->arguments)) {
2587
+							foreach ($this->arguments as $key => $a_args) {
2588
+								if (isset($a_args['example'])) {
2589 2589
 									$example_args[$key] = $a_args['example'];
2590 2590
 								}
2591 2591
 							}
2592 2592
 						}
2593
-						$viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2593
+						$viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: ' . absint($this->options['example']['viewportWidth']) : '';
2594 2594
 						$example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2595
-						if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2595
+						if (isset($this->options['example']) && $this->options['example'] === false) {
2596 2596
 							// no preview if set to false
2597
-						}elseif( !empty( $example_args ) ){
2598
-							echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2599
-						}elseif( !empty( $this->options['example'] ) ){
2597
+						}elseif (!empty($example_args)) {
2598
+							echo "example : {attributes:{" . $this->array_to_attributes($example_args) . "},$viewport_width},";
2599
+						}elseif (!empty($this->options['example'])) {
2600 2600
 							unset($this->options['example']['viewportWidth']);
2601 2601
 							unset($this->options['example']['innerBlocks']);
2602
-							$example_atts = $this->array_to_attributes( $this->options['example'] );
2602
+							$example_atts = $this->array_to_attributes($this->options['example']);
2603 2603
 							$example_parts = array();
2604
-							if($example_atts){
2605
-								$example_parts[] = rtrim($example_atts,",");
2604
+							if ($example_atts) {
2605
+								$example_parts[] = rtrim($example_atts, ",");
2606 2606
 							}
2607
-							if($viewport_width){
2607
+							if ($viewport_width) {
2608 2608
 								$example_parts[] = $viewport_width;
2609 2609
 							}
2610
-							if($example_inner_blocks){
2610
+							if ($example_inner_blocks) {
2611 2611
 								$example_parts[] = $example_inner_blocks;
2612 2612
 							}
2613
-							if(!empty($example_parts)){
2614
-								echo "example : {".implode(',', $example_parts)."},";
2613
+							if (!empty($example_parts)) {
2614
+								echo "example : {" . implode(',', $example_parts) . "},";
2615 2615
 							}
2616
-						}else{
2616
+						} else {
2617 2617
 							echo 'example : {viewportWidth: 500},';
2618 2618
 						}
2619 2619
 
2620 2620
 
2621 2621
 
2622 2622
 						// limit to parent
2623
-						if( !empty( $this->options['parent'] ) ){
2624
-							echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2623
+						if (!empty($this->options['parent'])) {
2624
+							echo "parent : " . wp_json_encode($this->options['parent']) . ",";
2625 2625
 						}
2626 2626
 
2627 2627
 						// limit allowed blocks
2628
-						if( !empty( $this->options['allowed-blocks'] ) ){
2629
-							echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2628
+						if (!empty($this->options['allowed-blocks'])) {
2629
+							echo "allowedBlocks : " . wp_json_encode($this->options['allowed-blocks']) . ",";
2630 2630
 						}
2631 2631
 
2632 2632
 						// maybe set no_wrap
2633
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2634
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2633
+						$no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
2634
+						if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) {
2635 2635
 							$no_wrap = true;
2636 2636
 						}
2637
-						if ( $no_wrap ) {
2637
+						if ($no_wrap) {
2638 2638
 							$this->options['block-wrap'] = '';
2639 2639
 						}
2640 2640
 
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
 	
2645 2645
 							echo "attributes : {";
2646 2646
 
2647
-							if ( $show_advanced ) {
2647
+							if ($show_advanced) {
2648 2648
 								echo "show_advanced: {";
2649 2649
 								echo "  type: 'boolean',";
2650 2650
 								echo "  default: false";
@@ -2652,60 +2652,60 @@  discard block
 block discarded – undo
2652 2652
 							}
2653 2653
 
2654 2654
 							// Block wrap element
2655
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2655
+							if (!empty($this->options['block-wrap'])) { //@todo we should validate this?
2656 2656
 								echo "block_wrap: {";
2657 2657
 								echo "  type: 'string',";
2658
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "'";
2658
+								echo "  default: '" . esc_attr($this->options['block-wrap']) . "'";
2659 2659
 								echo "},";
2660 2660
 							}
2661 2661
 
2662
-							if ( ! empty( $this->arguments ) ) {
2663
-								foreach ( $this->arguments as $key => $args ) {
2664
-									if ( $args['type'] == 'image' ||  $args['type'] == 'images' ) {
2662
+							if (!empty($this->arguments)) {
2663
+								foreach ($this->arguments as $key => $args) {
2664
+									if ($args['type'] == 'image' || $args['type'] == 'images') {
2665 2665
 										$img_drag_drop = true;
2666 2666
 									}
2667 2667
 
2668 2668
 									// Set if we should show alignment.
2669
-									if ( $key == 'alignment' ) {
2669
+									if ($key == 'alignment') {
2670 2670
 										$show_alignment = true;
2671 2671
 									}
2672 2672
 
2673 2673
 									$extra = '';
2674
-									$_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : '';
2674
+									$_default = isset($args['default']) && !is_null($args['default']) ? $args['default'] : '';
2675 2675
 
2676
-									if ( ! empty( $_default ) ) {
2677
-										$_default = wp_slash( $_default );
2676
+									if (!empty($_default)) {
2677
+										$_default = wp_slash($_default);
2678 2678
 									}
2679 2679
 
2680
-									if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2680
+									if ($args['type'] == 'notice' || $args['type'] == 'tab') {
2681 2681
 										continue;
2682
-									} else if ( $args['type'] == 'checkbox' ) {
2682
+									} else if ($args['type'] == 'checkbox') {
2683 2683
 										$type    = 'boolean';
2684 2684
 										$default = $_default ? 'true' : 'false';
2685
-									} else if ( $args['type'] == 'number' ) {
2685
+									} else if ($args['type'] == 'number') {
2686 2686
 										$type    = 'number';
2687 2687
 										$default = "'" . $_default . "'";
2688
-									} else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2688
+									} else if ($args['type'] == 'select' && !empty($args['multiple'])) {
2689 2689
 										$type = 'array';
2690
-										if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2691
-											$default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]";
2690
+										if (isset($args['default']) && is_array($args['default'])) {
2691
+											$default = !empty($_default) ? "['" . implode("','", $_default) . "']" : "[]";
2692 2692
 										} else {
2693 2693
 											$default = "'" . $_default . "'";
2694 2694
 										}
2695
-									} else if ( $args['type'] == 'tagselect' ) {
2695
+									} else if ($args['type'] == 'tagselect') {
2696 2696
 										$type    = 'array';
2697 2697
 										$default = "'" . $_default . "'";
2698
-									} else if ( $args['type'] == 'multiselect' ) {
2698
+									} else if ($args['type'] == 'multiselect') {
2699 2699
 										$type    = 'array';
2700 2700
 										$default = "'" . $_default . "'";
2701
-									} else if ( $args['type'] == 'image_xy' ) {
2701
+									} else if ($args['type'] == 'image_xy') {
2702 2702
 										$type    = 'object';
2703 2703
 										$default = "'" . $_default . "'";
2704
-									} else if ( $args['type'] == 'image' ) {
2704
+									} else if ($args['type'] == 'image') {
2705 2705
 										$type    = 'string';
2706 2706
 										$default = "'" . $_default . "'";
2707 2707
 									} else {
2708
-										$type    = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string';
2708
+										$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2709 2709
 										$default = "'" . $_default . "'";
2710 2710
 									}
2711 2711
 
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
 							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2720 2720
 							echo "sd_shortcode : {type : 'string',default: ''},";
2721 2721
 
2722
-							if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) {
2722
+							if (!empty($this->options['nested-block']) || !empty($this->arguments['html'])) {
2723 2723
 								echo "sd_shortcode_close : {type : 'string',default: ''},";
2724 2724
 							}
2725 2725
 
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
 							const selectedBlock = wp.data.select('core/block-editor').getSelectedBlock();
2732 2732
 <?php
2733 2733
 // only include the drag/drop functions if required.
2734
-if ( $img_drag_drop ) {
2734
+if ($img_drag_drop) {
2735 2735
 ?>
2736 2736
 
2737 2737
 function enableDragSort(listClass) {
@@ -2796,9 +2796,9 @@  discard block
 block discarded – undo
2796 2796
 							}
2797 2797
 
2798 2798
 							<?php
2799
-							if(!empty($this->options['block-edit-raw'])) {
2799
+							if (!empty($this->options['block-edit-raw'])) {
2800 2800
 								echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2801
-							}else{
2801
+							} else {
2802 2802
 							?>
2803 2803
 
2804 2804
 function hasSelectedInnerBlock(props) {
@@ -2822,7 +2822,7 @@  discard block
 block discarded – undo
2822 2822
 	var $value = '';
2823 2823
 	<?php
2824 2824
 	// if we have a post_type and a category then link them
2825
-	if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2825
+	if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) {
2826 2826
 	?>
2827 2827
 	if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){
2828 2828
 		$pt = props.attributes.post_type;
@@ -2837,9 +2837,9 @@  discard block
 block discarded – undo
2837 2837
 		}
2838 2838
 <?php
2839 2839
 	$cat_path = '';
2840
-	if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2841
-		$cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2842
-		$cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2840
+	if (!empty($this->arguments['post_type']['onchange_rest']['path'])) {
2841
+		$cat_path = esc_js(strip_tags($this->arguments['post_type']['onchange_rest']['path']));
2842
+		$cat_path = str_replace(array('&quot;', '&#039;'), array('"', "'"), $cat_path);
2843 2843
 	}
2844 2844
 ?>
2845 2845
 		/* taxonomies */
@@ -2847,15 +2847,15 @@  discard block
 block discarded – undo
2847 2847
 			if (!window.gdCPTCats) {
2848 2848
 				window.gdCPTCats = [];
2849 2849
 			}
2850
-			var gdCatPath = "<?php echo ( ! empty( $cat_path ) ? $cat_path : "/wp/v2/" + $value + "/categories/?per_page=100" ); ?>";
2850
+			var gdCatPath = "<?php echo (!empty($cat_path) ? $cat_path : "/wp/v2/" +$value + "/categories/?per_page=100"); ?>";
2851 2851
 			if (window.gdCPTCats[gdCatPath]) {
2852 2852
 				terms = window.gdCPTCats[gdCatPath];
2853
-				while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
2854
-					taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
2853
+				while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2854
+					taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2855 2855
 				}
2856
-				taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0});
2856
+				taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0});
2857 2857
 				jQuery.each( terms, function( key, val ) {
2858
-					taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id});
2858
+					taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id});
2859 2859
 				});
2860 2860
 
2861 2861
 				/* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */
@@ -2865,12 +2865,12 @@  discard block
 block discarded – undo
2865 2865
 			} else {
2866 2866
 				wp.apiFetch({path: gdCatPath}).then(terms => {
2867 2867
 					window.gdCPTCats[gdCatPath] = terms;
2868
-					while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
2869
-						taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
2868
+					while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2869
+						taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2870 2870
 					}
2871
-					taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0});
2871
+					taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0});
2872 2872
 					jQuery.each( terms, function( key, val ) {
2873
-						taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id});
2873
+						taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id});
2874 2874
 					});
2875 2875
 
2876 2876
 					/* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */
@@ -2878,7 +2878,7 @@  discard block
 block discarded – undo
2878 2878
 					props.setAttributes({category: [0] });
2879 2879
 					props.setAttributes({category: $old_cat_value });
2880 2880
 
2881
-					return taxonomies_<?php echo str_replace("-","_", $this->id);?>;
2881
+					return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>;
2882 2882
 				});
2883 2883
 			}
2884 2884
 		}
@@ -2890,12 +2890,12 @@  discard block
 block discarded – undo
2890 2890
 			}
2891 2891
 			if (window.gdCPTSort[$pt]) {
2892 2892
 				response = window.gdCPTSort[$pt];
2893
-				while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) {
2894
-					sort_by_<?php echo str_replace("-","_", $this->id);?>.pop();
2893
+				while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2894
+					sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2895 2895
 				}
2896 2896
 
2897 2897
 				jQuery.each( response, function( key, val ) {
2898
-					sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key});
2898
+					sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key});
2899 2899
 				});
2900 2900
 
2901 2901
 				// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -2910,12 +2910,12 @@  discard block
 block discarded – undo
2910 2910
 				jQuery.post(ajaxurl, data, function(response) {
2911 2911
 					response = JSON.parse(response);
2912 2912
 					window.gdCPTSort[$pt] = response;
2913
-					while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) {
2914
-						sort_by_<?php echo str_replace("-","_", $this->id);?>.pop();
2913
+					while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) {
2914
+						sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop();
2915 2915
 					}
2916 2916
 
2917 2917
 					jQuery.each( response, function( key, val ) {
2918
-						sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key});
2918
+						sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key});
2919 2919
 					});
2920 2920
 
2921 2921
 					// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
 					props.setAttributes({sort_by: [0] });
2924 2924
 					props.setAttributes({sort_by: $old_sort_by_value });
2925 2925
 
2926
-					return sort_by_<?php echo str_replace("-","_", $this->id);?>;
2926
+					return sort_by_<?php echo str_replace("-", "_", $this->id); ?>;
2927 2927
 				});
2928 2928
 			}
2929 2929
 		}
@@ -2931,9 +2931,9 @@  discard block
 block discarded – undo
2931 2931
 	<?php } ?>
2932 2932
 <?php
2933 2933
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2934
-if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2934
+if (!empty($current_screen->base) && $current_screen->base === 'widgets') {
2935 2935
 	echo 'const { deviceType } = "";';
2936
-}else{
2936
+} else {
2937 2937
 ?>
2938 2938
 /** Get device type const. */
2939 2939
 const wpVersion = '<?php global $wp_version; echo esc_attr($wp_version); ?>';
@@ -2982,13 +2982,13 @@  discard block
 block discarded – undo
2982 2982
 
2983 2983
 									var data = {
2984 2984
 										'action': 'super_duper_output_shortcode',
2985
-										'shortcode': '<?php echo $this->options['base_id'];?>',
2985
+										'shortcode': '<?php echo $this->options['base_id']; ?>',
2986 2986
 										'attributes': props.attributes,
2987 2987
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2988
-										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2988
+										'post_id': <?php global $post; if (isset($post->ID)) {
2989 2989
 										echo $post->ID;
2990
-									}else{echo '0';}?>,
2991
-										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2990
+									} else {echo '0'; }?>,
2991
+										'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
2992 2992
 									};
2993 2993
 
2994 2994
 									jQuery.post(ajaxurl, data, function (response) {
@@ -2996,17 +2996,17 @@  discard block
 block discarded – undo
2996 2996
 									}).then(function (env) {
2997 2997
 										// if the content is empty then we place some placeholder text
2998 2998
 										if (env == '') {
2999
-											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for:', 'ayecode-connect' );?> " + props.name + "</div>";
2999
+											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for:', 'ayecode-connect'); ?> " + props.name + "</div>";
3000 3000
 										}
3001 3001
 
3002 3002
 										 <?php
3003
-										if(!empty($this->options['nested-block'])){
3003
+										if (!empty($this->options['nested-block'])) {
3004 3004
 											?>
3005 3005
 											// props.setAttributes({content: env});
3006 3006
 										is_fetching = false;
3007 3007
 										prev_attributes[props.clientId] = props.attributes;
3008 3008
 											 <?php
3009
-										}else{
3009
+										} else {
3010 3010
 										?>
3011 3011
 										props.setAttributes({content: env});
3012 3012
 										is_fetching = false;
@@ -3026,35 +3026,35 @@  discard block
 block discarded – undo
3026 3026
 							}
3027 3027
 
3028 3028
 							<?php
3029
-							if(!empty($this->options['block-edit-js'])) {
3030
-								echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3029
+							if (!empty($this->options['block-edit-js'])) {
3030
+								echo  $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues
3031 3031
 							}
3032 3032
 
3033
-							if(empty($this->options['block-save-return'])){
3033
+							if (empty($this->options['block-save-return'])) {
3034 3034
 							?>
3035 3035
 								///////////////////////////////////////////////////////////////////////
3036 3036
 
3037 3037
 								// build the shortcode.
3038
-								shortcode = "[<?php echo $this->options['base_id'];?>";
3038
+								shortcode = "[<?php echo $this->options['base_id']; ?>";
3039 3039
 								<?php
3040 3040
 
3041
-								if(! empty( $this->arguments )){
3041
+								if (!empty($this->arguments)) {
3042 3042
 
3043
-								foreach($this->arguments as $key => $args){
3043
+								foreach ($this->arguments as $key => $args) {
3044 3044
 								   // if($args['type']=='tabs'){continue;}
3045 3045
 
3046 3046
 								   // don't add metadata arguments
3047
-								   if (substr($key, 0, 9 ) === 'metadata_') {
3047
+								   if (substr($key, 0, 9) === 'metadata_') {
3048 3048
 									   continue;
3049 3049
 								   }
3050 3050
 								?>
3051
-								if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3052
-									if ('<?php echo esc_attr( $key );?>' == 'html') {
3053
-									} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
3054
-										shortcode += props.attributes.<?php echo esc_attr( $key );?>.length && ( props.attributes.<?php echo esc_attr( $key );?>.x.length || props.attributes.<?php echo esc_attr( $key );?>.y.length ) ? " <?php echo esc_attr( $key );?>='{x:" + props.attributes.<?php echo esc_attr( $key );?>.x + ",y:"+props.attributes.<?php echo esc_attr( $key );?>.y +"}' " : "";
3051
+								if (props.attributes.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
3052
+									if ('<?php echo esc_attr($key); ?>' == 'html') {
3053
+									} else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') {
3054
+										shortcode += props.attributes.<?php echo esc_attr($key); ?>.length && ( props.attributes.<?php echo esc_attr($key); ?>.x.length || props.attributes.<?php echo esc_attr($key); ?>.y.length ) ? " <?php echo esc_attr($key); ?>='{x:" + props.attributes.<?php echo esc_attr($key); ?>.x + ",y:"+props.attributes.<?php echo esc_attr($key); ?>.y +"}' " : "";
3055 3055
 									} else {
3056
-										//shortcode += props.attributes.<?php echo esc_attr( $key );?>.length ? " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'','&#39;') + "' " : "";
3057
-										shortcode +=  " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'','&#39;') + "' ";
3056
+										//shortcode += props.attributes.<?php echo esc_attr($key); ?>.length ? " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'','&#39;') + "' " : "";
3057
+										shortcode +=  " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'','&#39;') + "' ";
3058 3058
 									}
3059 3059
 								}
3060 3060
 								<?php
@@ -3073,8 +3073,8 @@  discard block
 block discarded – undo
3073 3073
 
3074 3074
 
3075 3075
 									<?php
3076
-									if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3077
-										echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3076
+									if (!empty($this->options['nested-block']) || !empty($this->arguments['html'])) {
3077
+										echo "props.setAttributes({sd_shortcode_close: '[/" . esc_attr($this->options['base_id']) . "]'});";
3078 3078
 									}
3079 3079
 									?>
3080 3080
 								}
@@ -3089,7 +3089,7 @@  discard block
 block discarded – undo
3089 3089
 
3090 3090
 								el(wp.blockEditor.BlockControls, {key: 'controls'},
3091 3091
 
3092
-									<?php if($show_alignment){?>
3092
+									<?php if ($show_alignment) {?>
3093 3093
 									el(
3094 3094
 										wp.blockEditor.AlignmentToolbar,
3095 3095
 										{
@@ -3107,9 +3107,9 @@  discard block
 block discarded – undo
3107 3107
 
3108 3108
 									<?php
3109 3109
 
3110
-									if(! empty( $this->arguments )){
3110
+									if (!empty($this->arguments)) {
3111 3111
 
3112
-									if ( $show_advanced ) {
3112
+									if ($show_advanced) {
3113 3113
 									?>
3114 3114
 									el('div', {
3115 3115
 											style: {'padding-left': '16px','padding-right': '16px'}
@@ -3129,42 +3129,42 @@  discard block
 block discarded – undo
3129 3129
 									<?php
3130 3130
 									}
3131 3131
 
3132
-									$arguments = $this->group_arguments( $this->arguments );
3133
-									$block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3132
+									$arguments = $this->group_arguments($this->arguments);
3133
+									$block_group_tabs = !empty($this->options['block_group_tabs']) ? $this->group_block_tabs($this->options['block_group_tabs'], $arguments) : array();
3134 3134
 
3135 3135
 									// Do we have sections?
3136 3136
 									$has_sections = $arguments == $this->arguments ? false : true;
3137 3137
 
3138
-									if($has_sections){
3138
+									if ($has_sections) {
3139 3139
 									$panel_count = 0;
3140 3140
 									$open_tab = '';
3141 3141
 
3142 3142
 									$open_tab_groups = array();
3143 3143
 									$used_tabs = array();
3144 3144
 
3145
-									foreach ( $arguments as $key => $args ) {
3145
+									foreach ($arguments as $key => $args) {
3146 3146
 										$close_tab = false;
3147 3147
 										$close_tabs = false;
3148 3148
 
3149
-										 if ( ! empty( $block_group_tabs ) ) {
3150
-											foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3151
-												if ( in_array( $key, $tab_args['groups'] ) ) {
3149
+										 if (!empty($block_group_tabs)) {
3150
+											foreach ($block_group_tabs as $tab_name => $tab_args) {
3151
+												if (in_array($key, $tab_args['groups'])) {
3152 3152
 													$open_tab_groups[] = $key;
3153 3153
 
3154
-													if ( $open_tab != $tab_name ) {
3154
+													if ($open_tab != $tab_name) {
3155 3155
 														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3156 3156
 														$tab_args['tab']['open'] = true;
3157 3157
 
3158
-														$this->block_tab_start( '', $tab_args );
3158
+														$this->block_tab_start('', $tab_args);
3159 3159
 														$open_tab = $tab_name;
3160 3160
 														$used_tabs[] = $tab_name;
3161 3161
 													}
3162 3162
 
3163
-													if ( $open_tab_groups == $tab_args['groups'] ) {
3163
+													if ($open_tab_groups == $tab_args['groups']) {
3164 3164
 														$close_tab = true;
3165 3165
 														$open_tab_groups = array();
3166 3166
 
3167
-														if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3167
+														if ($used_tabs == array_keys($block_group_tabs)) {
3168 3168
 															$close_tabs = true;
3169 3169
 														}
3170 3170
 													}
@@ -3173,27 +3173,27 @@  discard block
 block discarded – undo
3173 3173
 										}
3174 3174
 										?>
3175 3175
 										el(wp.components.PanelBody, {
3176
-												title: '<?php esc_attr_e( $key ); ?>',
3177
-												initialOpen: <?php if ( $panel_count ) {
3176
+												title: '<?php esc_attr_e($key); ?>',
3177
+												initialOpen: <?php if ($panel_count) {
3178 3178
 												echo "false";
3179 3179
 											} else {
3180 3180
 												echo "true";
3181 3181
 											}?>
3182 3182
 											},
3183 3183
 											<?php
3184
-											foreach ( $args as $k => $a ) {
3185
-												$this->block_tab_start( $k, $a );
3186
-												$this->block_row_start( $k, $a );
3187
-												$this->build_block_arguments( $k, $a );
3188
-												$this->block_row_end( $k, $a );
3189
-												$this->block_tab_end( $k, $a );
3184
+											foreach ($args as $k => $a) {
3185
+												$this->block_tab_start($k, $a);
3186
+												$this->block_row_start($k, $a);
3187
+												$this->build_block_arguments($k, $a);
3188
+												$this->block_row_end($k, $a);
3189
+												$this->block_tab_end($k, $a);
3190 3190
 											}
3191 3191
 											?>
3192 3192
 										),
3193 3193
 										<?php
3194
-										$panel_count ++;
3194
+										$panel_count++;
3195 3195
 
3196
-										if($close_tab || $close_tabs){
3196
+										if ($close_tab || $close_tabs) {
3197 3197
 											$tab_args = array(
3198 3198
 												'tab'	=> array(
3199 3199
 													'tabs_close' => $close_tabs,
@@ -3201,24 +3201,24 @@  discard block
 block discarded – undo
3201 3201
 												)
3202 3202
 
3203 3203
 											);
3204
-											$this->block_tab_end( '', $tab_args );
3204
+											$this->block_tab_end('', $tab_args);
3205 3205
 //											echo '###close'; print_r($tab_args);
3206 3206
 											$panel_count = 0;
3207 3207
 										}
3208 3208
 //
3209 3209
 
3210 3210
 									}
3211
-									}else {
3211
+									} else {
3212 3212
 									?>
3213 3213
 									el(wp.components.PanelBody, {
3214
-											title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>',
3214
+											title: '<?php esc_attr_e("Settings", 'ayecode-connect'); ?>',
3215 3215
 											initialOpen: true
3216 3216
 										},
3217 3217
 										<?php
3218
-										foreach ( $this->arguments as $key => $args ) {
3219
-											$this->block_row_start( $key, $args );
3220
-											$this->build_block_arguments( $key, $args );
3221
-											$this->block_row_end( $key, $args );
3218
+										foreach ($this->arguments as $key => $args) {
3219
+											$this->block_row_start($key, $args);
3220
+											$this->build_block_arguments($key, $args);
3221
+											$this->block_row_end($key, $args);
3222 3222
 										}
3223 3223
 										?>
3224 3224
 									),
@@ -3232,11 +3232,11 @@  discard block
 block discarded – undo
3232 3232
 
3233 3233
 								<?php
3234 3234
 								// If the user sets block-output array then build it
3235
-								if ( ! empty( $this->options['block-output'] ) ) {
3236
-								$this->block_element( $this->options['block-output'] );
3237
-							}elseif(!empty($this->options['block-edit-return'])){
3235
+								if (!empty($this->options['block-output'])) {
3236
+								$this->block_element($this->options['block-output']);
3237
+							}elseif (!empty($this->options['block-edit-return'])) {
3238 3238
 								   echo $this->options['block-edit-return'];
3239
-							}else{
3239
+							} else {
3240 3240
 								// if no block-output is set then we try and get the shortcode html output via ajax.
3241 3241
 								$block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3242 3242
 								?>
@@ -3263,27 +3263,27 @@  discard block
 block discarded – undo
3263 3263
 							var align = '';
3264 3264
 
3265 3265
 							// build the shortcode.
3266
-							var content = "[<?php echo $this->options['base_id'];?>";
3266
+							var content = "[<?php echo $this->options['base_id']; ?>";
3267 3267
 							$html = '';
3268 3268
 							<?php
3269 3269
 
3270
-							if(! empty( $this->arguments )){
3270
+							if (!empty($this->arguments)) {
3271 3271
 
3272
-							foreach($this->arguments as $key => $args){
3272
+							foreach ($this->arguments as $key => $args) {
3273 3273
 							   // if($args['type']=='tabs'){continue;}
3274 3274
 
3275 3275
 							   // don't add metadata arguments
3276
-							   if (substr($key, 0, 9 ) === 'metadata_') {
3276
+							   if (substr($key, 0, 9) === 'metadata_') {
3277 3277
 								   continue;
3278 3278
 							   }
3279 3279
 							?>
3280
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3281
-								if ('<?php echo esc_attr( $key );?>' == 'html') {
3282
-									$html = attr.<?php echo esc_attr( $key );?>;
3283
-								} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
3284
-									content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' ";
3280
+							if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
3281
+								if ('<?php echo esc_attr($key); ?>' == 'html') {
3282
+									$html = attr.<?php echo esc_attr($key); ?>;
3283
+								} else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') {
3284
+									content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' ";
3285 3285
 								} else {
3286
-									content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>.toString().replace('\'','&#39;') + "' ";
3286
+									content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>.toString().replace('\'','&#39;') + "' ";
3287 3287
 								}
3288 3288
 							}
3289 3289
 							<?php
@@ -3303,7 +3303,7 @@  discard block
 block discarded – undo
3303 3303
 							?>
3304 3304
 							// if has html element
3305 3305
 							if ($html) {
3306
-								//content += $html + "[/<?php echo $this->options['base_id'];?>]";
3306
+								//content += $html + "[/<?php echo $this->options['base_id']; ?>]";
3307 3307
 							}
3308 3308
 
3309 3309
 							// @todo should we add inline style here or just css classes?
@@ -3333,7 +3333,7 @@  discard block
 block discarded – undo
3333 3333
 //                                <x?php
3334 3334
 //							}else
3335 3335
 
3336
-							if(!empty($this->options['block-output'])){
3336
+							if (!empty($this->options['block-output'])) {
3337 3337
 //                               echo "return";
3338 3338
 //                               $this->block_element( $this->options['block-output'], true );
3339 3339
 //                               echo ";";
@@ -3343,30 +3343,30 @@  discard block
 block discarded – undo
3343 3343
 								   '',
3344 3344
 								   {},
3345 3345
 								  // el('', {dangerouslySetInnerHTML: {__html: content}}),
3346
-								   <?php $this->block_element( $this->options['block-output'], true ); ?>
3347
-								  // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3346
+								   <?php $this->block_element($this->options['block-output'], true); ?>
3347
+								  // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}})
3348 3348
 							   );
3349 3349
 								<?php
3350 3350
 
3351
-							}elseif(!empty($this->options['block-save-return'])){
3351
+							}elseif (!empty($this->options['block-save-return'])) {
3352 3352
 								   echo 'return ' . $this->options['block-save-return'];
3353
-							}elseif(!empty($this->options['nested-block'])){
3353
+							}elseif (!empty($this->options['nested-block'])) {
3354 3354
 								?>
3355 3355
 							  return el(
3356 3356
 								   '',
3357 3357
 								   {},
3358 3358
 								   el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}),
3359 3359
 								   InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here
3360
-								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3360
+								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}})
3361 3361
 							   );
3362 3362
 								<?php
3363
-							}elseif(!empty( $this->options['block-save-return'] ) ){
3364
-								echo "return ". $this->options['block-edit-return'].";";
3365
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3363
+							}elseif (!empty($this->options['block-save-return'])) {
3364
+								echo "return " . $this->options['block-edit-return'] . ";";
3365
+							}elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') {
3366 3366
 							?>
3367 3367
 							return content;
3368 3368
 							<?php
3369
-							}else{
3369
+							} else {
3370 3370
 							?>
3371 3371
 							var block_wrap = 'div';
3372 3372
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -3395,48 +3395,48 @@  discard block
 block discarded – undo
3395 3395
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
3396 3396
 			 */
3397 3397
 
3398
-			return str_replace( array(
3398
+			return str_replace(array(
3399 3399
 				'<script>',
3400 3400
 				'</script>'
3401
-			), '', $output );
3401
+			), '', $output);
3402 3402
 		}
3403 3403
 
3404 3404
 
3405 3405
 
3406
-		public function block_row_start($key, $args){
3406
+		public function block_row_start($key, $args) {
3407 3407
 
3408 3408
 			// check for row
3409
-			if(!empty($args['row'])){
3409
+			if (!empty($args['row'])) {
3410 3410
 
3411
-				if(!empty($args['row']['open'])){
3411
+				if (!empty($args['row']['open'])) {
3412 3412
 
3413 3413
 				// element require
3414
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3415
-				$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3416
-				$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3414
+				$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
3415
+				$device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : '';
3416
+				$device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3417 3417
 				$device_type_icon = '';
3418
-				if($device_type=='Desktop'){
3418
+				if ($device_type == 'Desktop') {
3419 3419
 					$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3420
-				}elseif($device_type=='Tablet'){
3420
+				}elseif ($device_type == 'Tablet') {
3421 3421
 					$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3422
-				}elseif($device_type=='Mobile'){
3422
+				}elseif ($device_type == 'Mobile') {
3423 3423
 					$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3424 3424
 				}
3425 3425
 				echo $element_require;
3426 3426
 				echo $device_type_require;
3427 3427
 
3428
-					if(false){?><script><?php }?>
3428
+					if (false) {?><script><?php }?>
3429 3429
 						el('div', {
3430 3430
 								className: 'bsui components-base-control',
3431 3431
 							},
3432
-							<?php if(!empty($args['row']['title'])){ ?>
3432
+							<?php if (!empty($args['row']['title'])) { ?>
3433 3433
 							el('label', {
3434 3434
 									className: 'components-base-control__label position-relative',
3435 3435
 									style: {width:"100%"}
3436 3436
 								},
3437
-								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}),
3438
-								<?php if($device_type_icon){ ?>
3439
-									deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3437
+								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}),
3438
+								<?php if ($device_type_icon) { ?>
3439
+									deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3440 3440
 								<?php
3441 3441
 								}
3442 3442
 								?>
@@ -3444,17 +3444,17 @@  discard block
 block discarded – undo
3444 3444
 
3445 3445
 							),
3446 3446
 							<?php }?>
3447
-							<?php if(!empty($args['row']['desc'])){ ?>
3447
+							<?php if (!empty($args['row']['desc'])) { ?>
3448 3448
 							el('p', {
3449 3449
 									className: 'components-base-control__help mb-0',
3450 3450
 								},
3451
-								'<?php echo addslashes( $args['row']['desc'] ); ?>'
3451
+								'<?php echo addslashes($args['row']['desc']); ?>'
3452 3452
 							),
3453 3453
 							<?php }?>
3454 3454
 							el(
3455 3455
 								'div',
3456 3456
 								{
3457
-									className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>',
3457
+									className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>',
3458 3458
 								},
3459 3459
 								el(
3460 3460
 									'div',
@@ -3463,36 +3463,36 @@  discard block
 block discarded – undo
3463 3463
 									},
3464 3464
 
3465 3465
 					<?php
3466
-					if(false){?></script><?php }
3467
-				}elseif(!empty($args['row']['close'])){
3468
-					if(false){?><script><?php }?>
3466
+					if (false) {?></script><?php }
3467
+				}elseif (!empty($args['row']['close'])) {
3468
+					if (false) {?><script><?php }?>
3469 3469
 						el(
3470 3470
 							'div',
3471 3471
 							{
3472 3472
 								className: 'col pl-0 ps-0',
3473 3473
 							},
3474 3474
 					<?php
3475
-					if(false){?></script><?php }
3476
-				}else{
3477
-					if(false){?><script><?php }?>
3475
+					if (false) {?></script><?php }
3476
+				} else {
3477
+					if (false) {?><script><?php }?>
3478 3478
 						el(
3479 3479
 							'div',
3480 3480
 							{
3481 3481
 								className: 'col pl-0 ps-0 pr-2 pe-2',
3482 3482
 							},
3483 3483
 					<?php
3484
-					if(false){?></script><?php }
3484
+					if (false) {?></script><?php }
3485 3485
 				}
3486 3486
 
3487 3487
 			}
3488 3488
 
3489 3489
 		}
3490 3490
 
3491
-		public function block_row_end($key, $args){
3491
+		public function block_row_end($key, $args) {
3492 3492
 
3493
-			if(!empty($args['row'])){
3493
+			if (!empty($args['row'])) {
3494 3494
 				// maybe close
3495
-				if(!empty($args['row']['close'])){
3495
+				if (!empty($args['row']['close'])) {
3496 3496
 					echo "))";
3497 3497
 				}
3498 3498
 
@@ -3500,14 +3500,14 @@  discard block
 block discarded – undo
3500 3500
 			}
3501 3501
 		}
3502 3502
 
3503
-		public function block_tab_start($key, $args){
3503
+		public function block_tab_start($key, $args) {
3504 3504
 
3505 3505
 			// check for row
3506
-			if(!empty($args['tab'])){
3506
+			if (!empty($args['tab'])) {
3507 3507
 
3508
-				if(!empty($args['tab']['tabs_open'])){
3508
+				if (!empty($args['tab']['tabs_open'])) {
3509 3509
 
3510
-					if(false){?><script><?php }?>
3510
+					if (false) {?><script><?php }?>
3511 3511
 
3512 3512
 el('div',{className: 'bsui'},
3513 3513
 
@@ -3516,52 +3516,52 @@  discard block
 block discarded – undo
3516 3516
 									{
3517 3517
 										activeClass: 'is-active',
3518 3518
 										className: 'btn-groupx',
3519
-										initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3519
+										initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>',
3520 3520
 										tabs: [
3521 3521
 
3522 3522
 					<?php
3523
-					if(false){?></script><?php }
3523
+					if (false) {?></script><?php }
3524 3524
 				}
3525 3525
 
3526
-				if(!empty($args['tab']['open'])){
3526
+				if (!empty($args['tab']['open'])) {
3527 3527
 
3528
-					if(false){?><script><?php }?>
3528
+					if (false) {?><script><?php }?>
3529 3529
 							{
3530
-												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3531
-												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
3532
-												className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>',
3533
-												content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', {
3530
+												name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>',
3531
+												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}),
3532
+												className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>',
3533
+												content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', {
3534 3534
 									className: 'components-base-control__help mb-0',
3535
-									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3535
+									dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'}
3536 3536
 								}),<?php }
3537
-					if(false){?></script><?php }
3537
+					if (false) {?></script><?php }
3538 3538
 				}
3539 3539
 
3540 3540
 			}
3541 3541
 
3542 3542
 		}
3543 3543
 
3544
-		public function block_tab_end($key, $args){
3544
+		public function block_tab_end($key, $args) {
3545 3545
 
3546
-			if(!empty($args['tab'])){
3546
+			if (!empty($args['tab'])) {
3547 3547
 				// maybe close
3548
-				if(!empty($args['tab']['close'])){
3548
+				if (!empty($args['tab']['close'])) {
3549 3549
 					echo ")}, /* tab close */";
3550 3550
 				}
3551 3551
 
3552
-				if(!empty($args['tab']['tabs_close'])){
3553
-					if(false){?><script><?php }?>
3552
+				if (!empty($args['tab']['tabs_close'])) {
3553
+					if (false) {?><script><?php }?>
3554 3554
 						]}, ( tab ) => {
3555 3555
 								return tab.content;
3556 3556
 							}
3557 3557
 						)), /* tabs close */
3558
-					<?php if(false){ ?></script><?php }
3558
+					<?php if (false) { ?></script><?php }
3559 3559
 				}
3560 3560
 			}
3561 3561
 		}
3562 3562
 
3563
-		public function build_block_arguments( $key, $args ) {
3564
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3563
+		public function build_block_arguments($key, $args) {
3564
+			$custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : '';
3565 3565
 			$options           = '';
3566 3566
 			$extra             = '';
3567 3567
 			$require           = '';
@@ -3569,28 +3569,28 @@  discard block
 block discarded – undo
3569 3569
 			$after_elements	   = '';
3570 3570
 
3571 3571
 			// `content` is a protected and special argument
3572
-			if ( $key == 'content' ) {
3572
+			if ($key == 'content') {
3573 3573
 				return;
3574 3574
 			}
3575 3575
 
3576
-			$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3577
-			$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3576
+			$device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : '';
3577
+			$device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3578 3578
 			$device_type_icon = '';
3579
-			if($device_type=='Desktop'){
3579
+			if ($device_type == 'Desktop') {
3580 3580
 				$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3581
-			}elseif($device_type=='Tablet'){
3581
+			}elseif ($device_type == 'Tablet') {
3582 3582
 				$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3583
-			}elseif($device_type=='Mobile'){
3583
+			}elseif ($device_type == 'Mobile') {
3584 3584
 				$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3585 3585
 			}
3586 3586
 
3587 3587
 			// icon
3588 3588
 			$icon = '';
3589
-			if( !empty( $args['icon'] ) ){
3589
+			if (!empty($args['icon'])) {
3590 3590
 				$icon .= "el('div', {";
3591
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3591
+									$icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},";
3592 3592
 									$icon .= "className: 'text-center',";
3593
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3593
+									$icon .= "title: '" . addslashes($args['title']) . "',";
3594 3594
 								$icon .= "}),";
3595 3595
 
3596 3596
 				// blank title as its added to the icon.
@@ -3598,27 +3598,27 @@  discard block
 block discarded – undo
3598 3598
 			}
3599 3599
 
3600 3600
 			// require advanced
3601
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3601
+			$require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : "";
3602 3602
 
3603 3603
 			// element require
3604
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3604
+			$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
3605 3605
 
3606 3606
 
3607 3607
 			$onchange  = "props.setAttributes({ $key: $key } )";
3608
-			$onchangecomplete  = "";
3608
+			$onchangecomplete = "";
3609 3609
 			$value     = "props.attributes.$key";
3610
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3611
-			if ( in_array( $args['type'], $text_type ) ) {
3610
+			$text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range');
3611
+			if (in_array($args['type'], $text_type)) {
3612 3612
 				$type = 'TextControl';
3613 3613
 				// Save numbers as numbers and not strings
3614
-				if ( $args['type'] == 'number' ) {
3614
+				if ($args['type'] == 'number') {
3615 3615
 					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3616 3616
 				}
3617 3617
 
3618
-				if (substr($key, 0, 9 ) === 'metadata_') {
3619
-					$real_key = str_replace('metadata_','', $key );
3618
+				if (substr($key, 0, 9) === 'metadata_') {
3619
+					$real_key = str_replace('metadata_', '', $key);
3620 3620
 					$onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3621
-					$value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3621
+					$value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3622 3622
 				}
3623 3623
 			}
3624 3624
 //			else if ( $args['type'] == 'popup' ) {
@@ -3638,12 +3638,12 @@  discard block
 block discarded – undo
3638 3638
 //
3639 3639
 //				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3640 3640
 //			}
3641
-			else if ( $args['type'] == 'styleid' ) {
3641
+			else if ($args['type'] == 'styleid') {
3642 3642
 				$type = 'TextControl';
3643 3643
 				$args['type'] == 'text';
3644 3644
 				// Save numbers as numbers and not strings
3645
-				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3646
-			}else if ( $args['type'] == 'notice' ) {
3645
+				$value = "props.attributes.$key ? props.attributes.$key : ''";
3646
+			} else if ($args['type'] == 'notice') {
3647 3647
 
3648 3648
 				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3649 3649
 				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
@@ -3705,11 +3705,11 @@  discard block
 block discarded – undo
3705 3705
 							return;
3706 3706
 						}
3707 3707
 */
3708
-			elseif ( $args['type'] == 'color' ) {
3708
+			elseif ($args['type'] == 'color') {
3709 3709
 				$type = 'ColorPicker';
3710 3710
 				$onchange = "";
3711 3711
 				$extra = "color: $value,";
3712
-				if(!empty($args['disable_alpha'])){
3712
+				if (!empty($args['disable_alpha'])) {
3713 3713
 					$extra .= "disableAlpha: true,";
3714 3714
 				}
3715 3715
 				$onchangecomplete = "onChangeComplete: function($key) {
@@ -3718,7 +3718,7 @@  discard block
 block discarded – undo
3718 3718
 							$key: value
3719 3719
 						});
3720 3720
 					},";
3721
-			}elseif ( $args['type'] == 'gradient' ) {
3721
+			}elseif ($args['type'] == 'gradient') {
3722 3722
 				$type = 'GradientPicker';
3723 3723
 				$extra .= "gradients: [{
3724 3724
 			name: 'Vivid cyan blue to vivid purple',
@@ -3757,7 +3757,7 @@  discard block
 block discarded – undo
3757 3757
 			slug: 'cool-to-warm-spectrum',
3758 3758
 		}],";
3759 3759
 
3760
-			}elseif ( $args['type'] == 'image' ) {
3760
+			}elseif ($args['type'] == 'image') {
3761 3761
 //                print_r($args);
3762 3762
 
3763 3763
 				$img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
 				$onchange = "";
3820 3820
 
3821 3821
 				//$inside_elements = ",el('div',{},'file upload')";
3822
-			} else if ( $args['type'] == 'images' ) {
3822
+			} else if ($args['type'] == 'images') {
3823 3823
 				$img_preview = "props.attributes.$key && (function() {
3824 3824
 	let uploads = JSON.parse('['+props.attributes.$key+']');
3825 3825
 	let images = [];
@@ -3832,7 +3832,7 @@  discard block
 block discarded – undo
3832 3832
 			el('i',{
3833 3833
 				className: 'fas fa-times-circle text-danger position-absolute  ml-n2 mt-n1 bg-white rounded-circle c-pointer',
3834 3834
 				onClick: function() {
3835
-					aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) {
3835
+					aui_confirm('" . esc_attr__('Are you sure?') . "', '" . esc_attr__('Delete') . "', '" . esc_attr__('Cancel') . "', true).then(function(confirmed) {
3836 3836
 						if (confirmed) {
3837 3837
 							let new_uploads = JSON.parse('['+props.attributes.$key+']');
3838 3838
 							new_uploads.splice(index, 1);
@@ -3895,36 +3895,36 @@  discard block
 block discarded – undo
3895 3895
 
3896 3896
 				//$inside_elements = ",el('div',{},'file upload')";
3897 3897
 			}
3898
-			elseif ( $args['type'] == 'checkbox' ) {
3898
+			elseif ($args['type'] == 'checkbox') {
3899 3899
 				$type = 'CheckboxControl';
3900 3900
 				$extra .= "checked: props.attributes.$key,";
3901 3901
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3902
-			} elseif ( $args['type'] == 'textarea' ) {
3902
+			} elseif ($args['type'] == 'textarea') {
3903 3903
 				$type = 'TextareaControl';
3904 3904
 
3905
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3905
+			} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
3906 3906
 				$type = 'SelectControl';
3907 3907
 
3908
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3909
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3910
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3911
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3912
-				}else {
3908
+				if ($args['name'] == 'category' && !empty($args['post_type_linked'])) {
3909
+					$options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ",";
3910
+				}elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) {
3911
+					$options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ",";
3912
+				} else {
3913 3913
 
3914
-					if ( ! empty( $args['options'] ) ) {
3914
+					if (!empty($args['options'])) {
3915 3915
 						$options .= "options: [";
3916
-						foreach ( $args['options'] as $option_val => $option_label ) {
3917
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3916
+						foreach ($args['options'] as $option_val => $option_label) {
3917
+							$options .= "{ value: '" . esc_attr($option_val) . "', label: '" . esc_js(addslashes($option_label)) . "' },";
3918 3918
 						}
3919 3919
 						$options .= "],";
3920 3920
 					}
3921 3921
 				}
3922
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3922
+				if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3923 3923
 					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3924 3924
 				}
3925 3925
 
3926
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3927
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3926
+				if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) {
3927
+					$after_elements .= "props.attributes.$key && el( wp.components.Button, {
3928 3928
 									  className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3929 3929
 									  style: {margin:'-8px 0 8px 0',display: 'block'},
3930 3930
 									  onClick: function(){
@@ -3936,7 +3936,7 @@  discard block
 block discarded – undo
3936 3936
 									'Clear'
3937 3937
 							),";
3938 3938
 				}
3939
-			} elseif ( $args['type'] == 'tagselect' ) {
3939
+			} elseif ($args['type'] == 'tagselect') {
3940 3940
 //				$type = 'FormTokenField';
3941 3941
 //
3942 3942
 //				if ( ! empty( $args['options'] ) ) {
@@ -3971,19 +3971,19 @@  discard block
 block discarded – undo
3971 3971
 //				$value     = "[]";
3972 3972
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3973 3973
 
3974
-			} else if ( $args['type'] == 'alignment' ) {
3974
+			} else if ($args['type'] == 'alignment') {
3975 3975
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3976
-			} else if ( $args['type'] == 'margins' ) {
3976
+			} else if ($args['type'] == 'margins') {
3977 3977
 
3978
-			} else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3978
+			} else if ($args['type'] == 'visibility_conditions' && (function_exists('wp_is_block_theme') && wp_is_block_theme())) {
3979 3979
 				$type = 'TextControl';
3980 3980
 				$value = "(props.attributes.$key ? props.attributes.$key : '')";
3981 3981
 				$args['type'] = 'text';
3982 3982
 				$options .= 'disabled:true,';
3983
-				$bsvc_title = esc_attr( addslashes( $args['title'] ) );
3984
-				$bsvc_body = $this->block_visibility_fields( $args );
3983
+				$bsvc_title = esc_attr(addslashes($args['title']));
3984
+				$bsvc_body = $this->block_visibility_fields($args);
3985 3985
 				// @TODO reset button
3986
-				$bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3986
+				$bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __('Reset', 'ayecode-connect') . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __('Close', 'ayecode-connect') . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __('Save Rules', 'ayecode-connect') . '</button>';
3987 3987
 				$after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3988 3988
 						className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3989 3989
 						onClick: function() {
@@ -4002,25 +4002,25 @@  discard block
 block discarded – undo
4002 4002
 									jQuery('.bs-vc-modal-form').trigger('change');
4003 4003
 								}
4004 4004
 							});
4005
-							aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', '');
4005
+							aui_modal('" . $bsvc_title . "', '" . addslashes($bsvc_body) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', '');
4006 4006
 							jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) {
4007 4007
 								props.setAttributes({" . $key . ": e.target.value});
4008 4008
 							});
4009 4009
 						}
4010 4010
 					},
4011
-					'" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "'
4011
+					'" . addslashes(!empty($args['button_title']) ? $args['button_title'] : $args['title']) . "'
4012 4012
 				) ),";
4013 4013
 			} else {
4014
-				return;// if we have not implemented the control then don't break the JS.
4014
+				return; // if we have not implemented the control then don't break the JS.
4015 4015
 			}
4016 4016
 
4017 4017
 			// color input does not show the labels so we add them
4018
-			if($args['type']=='color'){
4018
+			if ($args['type'] == 'color') {
4019 4019
 				// add show only if advanced
4020 4020
 				echo $require_advanced;
4021 4021
 				// add setting require if defined
4022 4022
 				echo $element_require;
4023
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
4023
+				echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),";
4024 4024
 			}
4025 4025
 
4026 4026
 			// add show only if advanced
@@ -4032,22 +4032,22 @@  discard block
 block discarded – undo
4032 4032
 			// icon
4033 4033
 			echo $icon;
4034 4034
 			?>
4035
-			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
4036
-			label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php
4037
-			} else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4038
-			help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>,
4035
+			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, {
4036
+			label: <?php if (empty($args['title'])) { echo "''"; } else if (empty($args['row']) && !empty($args['device_type'])) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['title']) ?>'}}),<?php if ($device_type_icon) { ?>deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php
4037
+			} else { ?>'<?php echo addslashes(trim(esc_html($args['title']))); ?>'<?php } ?>,
4038
+			help: <?php echo (isset($args['desc']) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim(wp_kses_post(addslashes($args['desc']))) . "'}})" : "''"); ?>,
4039 4039
 			value: <?php echo $value; ?>,
4040
-			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
4041
-				echo "type: '" . addslashes( $args['type'] ) . "',";
4040
+			<?php if ($type == 'TextControl' && $args['type'] != 'text') {
4041
+				echo "type: '" . addslashes($args['type']) . "',";
4042 4042
 			} ?>
4043
-			<?php if ( ! empty( $args['placeholder'] ) ) {
4044
-				echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4043
+			<?php if (!empty($args['placeholder'])) {
4044
+				echo "placeholder: '" . esc_js(addslashes(trim(esc_html($args['placeholder'])))) . "',";
4045 4045
 			} ?>
4046 4046
 			<?php echo $options; ?>
4047 4047
 			<?php echo $extra; ?>
4048 4048
 			<?php echo $custom_attributes; ?>
4049 4049
 			<?php echo $onchangecomplete; ?>
4050
-			<?php if ( $onchange ) { ?>
4050
+			<?php if ($onchange) { ?>
4051 4051
 			onChange: function ( <?php echo $key; ?> ) {
4052 4052
 				<?php echo $onchange; ?>
4053 4053
 			}
@@ -4066,15 +4066,15 @@  discard block
 block discarded – undo
4066 4066
 		 *@todo there is prob a faster way to do this, also we could add some validation here.
4067 4067
 		 *
4068 4068
 		 */
4069
-		public function array_to_attributes( $custom_attributes, $html = false ) {
4069
+		public function array_to_attributes($custom_attributes, $html = false) {
4070 4070
 			$attributes = '';
4071
-			if ( ! empty( $custom_attributes ) ) {
4071
+			if (!empty($custom_attributes)) {
4072 4072
 
4073
-				foreach ( $custom_attributes as $key => $val ) {
4074
-					if(is_array($val)){
4075
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4076
-					}else{
4077
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4073
+				foreach ($custom_attributes as $key => $val) {
4074
+					if (is_array($val)) {
4075
+						$attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},';
4076
+					} else {
4077
+						$attributes .= $html ? " $key='$val' " : "'$key': '$val',";
4078 4078
 					}
4079 4079
 				}
4080 4080
 
@@ -4092,113 +4092,113 @@  discard block
 block discarded – undo
4092 4092
 		 *
4093 4093
 		 * @param $args
4094 4094
 		 */
4095
-		public function block_element( $args, $save = false ) {
4095
+		public function block_element($args, $save = false) {
4096 4096
 
4097 4097
 //            print_r($args);echo '###';exit;
4098 4098
 
4099
-			if ( ! empty( $args ) ) {
4100
-				foreach ( $args as $element => $new_args ) {
4099
+			if (!empty($args)) {
4100
+				foreach ($args as $element => $new_args) {
4101 4101
 
4102
-					if ( is_array( $new_args ) ) { // its an element
4102
+					if (is_array($new_args)) { // its an element
4103 4103
 
4104 4104
 
4105
-						if ( isset( $new_args['element'] ) ) {
4105
+						if (isset($new_args['element'])) {
4106 4106
 
4107
-							if ( isset( $new_args['element_require'] ) ) {
4108
-								echo str_replace( array(
4107
+							if (isset($new_args['element_require'])) {
4108
+								echo str_replace(array(
4109 4109
 										"'+",
4110 4110
 										"+'"
4111
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4112
-								unset( $new_args['element_require'] );
4111
+									), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
4112
+								unset($new_args['element_require']);
4113 4113
 							}
4114 4114
 
4115
-							if($new_args['element']=='InnerBlocks'){
4115
+							if ($new_args['element'] == 'InnerBlocks') {
4116 4116
 								echo "\n el( InnerBlocks, {";
4117
-							}elseif($new_args['element']=='innerBlocksProps'){
4117
+							}elseif ($new_args['element'] == 'innerBlocksProps') {
4118 4118
 								$element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4119 4119
 							  //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4120 4120
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4121 4121
 								echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4122 4122
 								echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4123
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4123
+								echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : '';
4124 4124
 
4125 4125
 								echo "} ), {";
4126
-								echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4126
+								echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : '';
4127 4127
 							//    echo '###';
4128 4128
 
4129 4129
 							  //  echo '###';
4130
-							}elseif($new_args['element']=='BlocksProps'){
4130
+							}elseif ($new_args['element'] == 'BlocksProps') {
4131 4131
 
4132
-								if ( isset($new_args['if_inner_element']) ) {
4132
+								if (isset($new_args['if_inner_element'])) {
4133 4133
 									$element = $new_args['if_inner_element'];
4134
-								}else {
4135
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4134
+								} else {
4135
+									$element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'";
4136 4136
 								}
4137 4137
 
4138 4138
 								unset($new_args['inner_element']);
4139 4139
 								echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4140
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4140
+								echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : '';
4141 4141
 
4142 4142
 
4143 4143
 							   // echo "} ),";
4144 4144
 
4145
-							}else{
4145
+							} else {
4146 4146
 								echo "\n el( '" . $new_args['element'] . "', {";
4147 4147
 							}
4148 4148
 
4149 4149
 
4150 4150
 							// get the attributes
4151
-							foreach ( $new_args as $new_key => $new_value ) {
4151
+							foreach ($new_args as $new_key => $new_value) {
4152 4152
 
4153 4153
 
4154
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4154
+								if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
4155 4155
 									// do nothing
4156 4156
 								} else {
4157
-									echo $this->block_element( array( $new_key => $new_value ),$save );
4157
+									echo $this->block_element(array($new_key => $new_value), $save);
4158 4158
 								}
4159 4159
 							}
4160 4160
 
4161
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4161
+							echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes
4162 4162
 
4163 4163
 							// get the content
4164 4164
 							$first_item = 0;
4165
-							foreach ( $new_args as $new_key => $new_value ) {
4166
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4165
+							foreach ($new_args as $new_key => $new_value) {
4166
+								if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) {
4167 4167
 
4168
-									if ( $new_key === 'content' ) {
4169
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4170
-									}else if ( $new_key === 'if_content' ) {
4171
-										echo  $this->block_props_replace(  $new_value  );
4168
+									if ($new_key === 'content') {
4169
+										echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'";
4170
+									} else if ($new_key === 'if_content') {
4171
+										echo  $this->block_props_replace($new_value);
4172 4172
 									}
4173 4173
 
4174
-									if ( is_array( $new_value ) ) {
4174
+									if (is_array($new_value)) {
4175 4175
 
4176
-										if ( isset( $new_value['element_require'] ) ) {
4177
-											echo str_replace( array(
4176
+										if (isset($new_value['element_require'])) {
4177
+											echo str_replace(array(
4178 4178
 													"'+",
4179 4179
 													"+'"
4180
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4181
-											unset( $new_value['element_require'] );
4180
+												), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
4181
+											unset($new_value['element_require']);
4182 4182
 										}
4183 4183
 
4184
-										if ( isset( $new_value['element_repeat'] ) ) {
4184
+										if (isset($new_value['element_repeat'])) {
4185 4185
 											$x = 1;
4186
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
4187
-												$this->block_element( array( '' => $new_value ),$save );
4188
-												$x ++;
4186
+											while ($x <= absint($new_value['element_repeat'])) {
4187
+												$this->block_element(array('' => $new_value), $save);
4188
+												$x++;
4189 4189
 											}
4190 4190
 										} else {
4191
-											$this->block_element( array( '' => $new_value ),$save );
4191
+											$this->block_element(array('' => $new_value), $save);
4192 4192
 										}
4193 4193
 									}
4194
-									$first_item ++;
4194
+									$first_item++;
4195 4195
 								}
4196 4196
 							}
4197 4197
 
4198
-							if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4199
-								echo "))";// end content
4200
-							}else{
4201
-								echo ")";// end content
4198
+							if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') {
4199
+								echo "))"; // end content
4200
+							} else {
4201
+								echo ")"; // end content
4202 4202
 							}
4203 4203
 
4204 4204
 
@@ -4207,26 +4207,26 @@  discard block
 block discarded – undo
4207 4207
 						}
4208 4208
 					} else {
4209 4209
 
4210
-						if ( substr( $element, 0, 3 ) === "if_" ) {
4210
+						if (substr($element, 0, 3) === "if_") {
4211 4211
 							$extra = '';
4212
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
4213
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4214
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4212
+							if (strpos($new_args, '[%WrapClass%]') !== false) {
4213
+								$new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args);
4214
+								$new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args);
4215 4215
 							}
4216
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4217
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4218
-							$new_args = str_replace('[%WrapStyle%]','',$new_args);
4219
-							echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4216
+							echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ",";
4217
+						} elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) {
4218
+							$new_args = str_replace('[%WrapStyle%]', '', $new_args);
4219
+							echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },";
4220 4220
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4221
-						} elseif ( $element == 'style' ) {
4222
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4223
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4224
-							$new_args = str_replace('[%WrapClass%]','',$new_args);
4225
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4226
-						} elseif ( $element == 'template' && $new_args ) {
4221
+						} elseif ($element == 'style') {
4222
+							echo $element . ": " . $this->block_props_replace($new_args) . ",";
4223
+						} elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) {
4224
+							$new_args = str_replace('[%WrapClass%]', '', $new_args);
4225
+							echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),";
4226
+						} elseif ($element == 'template' && $new_args) {
4227 4227
 							echo $element . ": $new_args,";
4228 4228
 						} else {
4229
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4229
+							echo $element . ": '" . $this->block_props_replace($new_args) . "',";
4230 4230
 						}
4231 4231
 
4232 4232
 					}
@@ -4241,11 +4241,11 @@  discard block
 block discarded – undo
4241 4241
 		 *
4242 4242
 		 * @return mixed
4243 4243
 		 */
4244
-		public function block_props_replace( $string, $no_wrap = false ) {
4245
-			if ( $no_wrap ) {
4246
-				$string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4244
+		public function block_props_replace($string, $no_wrap = false) {
4245
+			if ($no_wrap) {
4246
+				$string = str_replace(array("[%", "%]", "%:checked]"), array("props.attributes.", "", ""), $string);
4247 4247
 			} else {
4248
-				$string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4248
+				$string = str_replace(array("![%", "[%", "%]", "%:checked]"), array("'+!props.attributes.", "'+props.attributes.", "+'", "+'"), $string);
4249 4249
 			}
4250 4250
 
4251 4251
 			return $string;
@@ -4257,65 +4257,65 @@  discard block
 block discarded – undo
4257 4257
 		 * @param array $args
4258 4258
 		 * @param array $instance
4259 4259
 		 */
4260
-		public function widget( $args, $instance ) {
4261
-			if ( ! is_array( $args ) ) {
4260
+		public function widget($args, $instance) {
4261
+			if (!is_array($args)) {
4262 4262
 				$args = array();
4263 4263
 			}
4264 4264
 
4265 4265
 			// Get the filtered values
4266
-			$argument_values = $this->argument_values( $instance );
4267
-			$argument_values = $this->string_to_bool( $argument_values );
4268
-			$output          = $this->output( $argument_values, $args );
4266
+			$argument_values = $this->argument_values($instance);
4267
+			$argument_values = $this->string_to_bool($argument_values);
4268
+			$output          = $this->output($argument_values, $args);
4269 4269
 
4270 4270
 			$no_wrap = false;
4271
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4271
+			if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) {
4272 4272
 				$no_wrap = true;
4273 4273
 			}
4274 4274
 
4275 4275
 			ob_start();
4276
-			if ( $output && ! $no_wrap ) {
4276
+			if ($output && !$no_wrap) {
4277 4277
 
4278 4278
 				$class_original = $this->options['widget_ops']['classname'];
4279
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4279
+				$class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash();
4280 4280
 
4281 4281
 				// Before widget
4282
-				$before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4283
-				$before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4284
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4285
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4282
+				$before_widget = !empty($args['before_widget']) ? $args['before_widget'] : '';
4283
+				$before_widget = $before_widget ? str_replace($class_original, $class, $before_widget) : $before_widget;
4284
+				$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
4285
+				$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this);
4286 4286
 
4287 4287
 				// After widget
4288
-				$after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4289
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4290
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4288
+				$after_widget = !empty($args['after_widget']) ? $args['after_widget'] : '';
4289
+				$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
4290
+				$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this);
4291 4291
 
4292 4292
 				echo $before_widget;
4293 4293
 				// elementor strips the widget wrapping div so we check for and add it back if needed
4294
-				if ( $this->is_elementor_widget_output() ) {
4294
+				if ($this->is_elementor_widget_output()) {
4295 4295
 					// Filter class & attrs for elementor widget output.
4296
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4297
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4296
+					$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
4297
+					$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
4298 4298
 
4299
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4300
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4299
+					$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
4300
+					$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
4301 4301
 
4302
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4302
+					echo "<span class='" . esc_attr($class) . "' " . $attrs . ">";
4303 4303
 				}
4304
-				echo $this->output_title( $args, $instance );
4304
+				echo $this->output_title($args, $instance);
4305 4305
 				echo $output;
4306
-				if ( $this->is_elementor_widget_output() ) {
4306
+				if ($this->is_elementor_widget_output()) {
4307 4307
 					echo "</span>";
4308 4308
 				}
4309 4309
 				echo $after_widget;
4310
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4311
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4310
+			} elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty
4311
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
4312 4312
 				echo $output;
4313
-			} elseif ( $output && $no_wrap ) {
4313
+			} elseif ($output && $no_wrap) {
4314 4314
 				echo $output;
4315 4315
 			}
4316 4316
 			$output = ob_get_clean();
4317 4317
 
4318
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4318
+			$output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this);
4319 4319
 
4320 4320
 			echo $output;
4321 4321
 		}
@@ -4328,7 +4328,7 @@  discard block
 block discarded – undo
4328 4328
 		 */
4329 4329
 		public function is_elementor_widget_output() {
4330 4330
 			$result = false;
4331
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4331
+			if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') {
4332 4332
 				$result = true;
4333 4333
 			}
4334 4334
 
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
 		 */
4344 4344
 		public function is_elementor_preview() {
4345 4345
 			$result = false;
4346
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4346
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
4347 4347
 				$result = true;
4348 4348
 			}
4349 4349
 
@@ -4358,7 +4358,7 @@  discard block
 block discarded – undo
4358 4358
 		 */
4359 4359
 		public function is_divi_preview() {
4360 4360
 			$result = false;
4361
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4361
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
4362 4362
 				$result = true;
4363 4363
 			}
4364 4364
 
@@ -4373,7 +4373,7 @@  discard block
 block discarded – undo
4373 4373
 		 */
4374 4374
 		public function is_beaver_preview() {
4375 4375
 			$result = false;
4376
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
4376
+			if (isset($_REQUEST['fl_builder'])) {
4377 4377
 				$result = true;
4378 4378
 			}
4379 4379
 
@@ -4388,7 +4388,7 @@  discard block
 block discarded – undo
4388 4388
 		 */
4389 4389
 		public function is_siteorigin_preview() {
4390 4390
 			$result = false;
4391
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4391
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
4392 4392
 				$result = true;
4393 4393
 			}
4394 4394
 
@@ -4403,7 +4403,7 @@  discard block
 block discarded – undo
4403 4403
 		 */
4404 4404
 		public function is_cornerstone_preview() {
4405 4405
 			$result = false;
4406
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4406
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
4407 4407
 				$result = true;
4408 4408
 			}
4409 4409
 
@@ -4418,7 +4418,7 @@  discard block
 block discarded – undo
4418 4418
 		 */
4419 4419
 		public function is_fusion_preview() {
4420 4420
 			$result = false;
4421
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4421
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
4422 4422
 				$result = true;
4423 4423
 			}
4424 4424
 
@@ -4433,7 +4433,7 @@  discard block
 block discarded – undo
4433 4433
 		 */
4434 4434
 		public function is_oxygen_preview() {
4435 4435
 			$result = false;
4436
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4436
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
4437 4437
 				$result = true;
4438 4438
 			}
4439 4439
 
@@ -4450,7 +4450,7 @@  discard block
 block discarded – undo
4450 4450
 		public function is_kallyas_zion_preview() {
4451 4451
 			$result = false;
4452 4452
 
4453
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4453
+			if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) {
4454 4454
 				$result = true;
4455 4455
 			}
4456 4456
 
@@ -4467,7 +4467,7 @@  discard block
 block discarded – undo
4467 4467
 		public function is_bricks_preview() {
4468 4468
 			$result = false;
4469 4469
 
4470
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4470
+			if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) {
4471 4471
 				$result = true;
4472 4472
 			}
4473 4473
 
@@ -4482,25 +4482,25 @@  discard block
 block discarded – undo
4482 4482
 		 */
4483 4483
 		public function is_preview() {
4484 4484
 			$preview = false;
4485
-			if ( $this->is_divi_preview() ) {
4485
+			if ($this->is_divi_preview()) {
4486 4486
 				$preview = true;
4487
-			} elseif ( $this->is_elementor_preview() ) {
4487
+			} elseif ($this->is_elementor_preview()) {
4488 4488
 				$preview = true;
4489
-			} elseif ( $this->is_beaver_preview() ) {
4489
+			} elseif ($this->is_beaver_preview()) {
4490 4490
 				$preview = true;
4491
-			} elseif ( $this->is_siteorigin_preview() ) {
4491
+			} elseif ($this->is_siteorigin_preview()) {
4492 4492
 				$preview = true;
4493
-			} elseif ( $this->is_cornerstone_preview() ) {
4493
+			} elseif ($this->is_cornerstone_preview()) {
4494 4494
 				$preview = true;
4495
-			} elseif ( $this->is_fusion_preview() ) {
4495
+			} elseif ($this->is_fusion_preview()) {
4496 4496
 				$preview = true;
4497
-			} elseif ( $this->is_oxygen_preview() ) {
4497
+			} elseif ($this->is_oxygen_preview()) {
4498 4498
 				$preview = true;
4499
-			} elseif( $this->is_kallyas_zion_preview() ) {
4499
+			} elseif ($this->is_kallyas_zion_preview()) {
4500 4500
 				$preview = true;
4501
-			} elseif( $this->is_block_content_call() ) {
4501
+			} elseif ($this->is_block_content_call()) {
4502 4502
 				$preview = true;
4503
-			} elseif( $this->is_bricks_preview() ) {
4503
+			} elseif ($this->is_bricks_preview()) {
4504 4504
 				$preview = true;
4505 4505
 			}
4506 4506
 
@@ -4515,44 +4515,44 @@  discard block
 block discarded – undo
4515 4515
 		 *
4516 4516
 		 * @return string
4517 4517
 		 */
4518
-		public function output_title( $args, $instance = array() ) {
4518
+		public function output_title($args, $instance = array()) {
4519 4519
 			$output = '';
4520
-			if ( ! empty( $instance['title'] ) ) {
4520
+			if (!empty($instance['title'])) {
4521 4521
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4522
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4522
+				$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
4523 4523
 
4524
-				if ( empty( $instance['widget_title_tag'] ) ) {
4525
-					if ( ! isset( $args['before_title'] ) ) {
4524
+				if (empty($instance['widget_title_tag'])) {
4525
+					if (!isset($args['before_title'])) {
4526 4526
 						$args['before_title'] = '';
4527 4527
 					}
4528 4528
 
4529
-					if ( ! isset( $args['after_title'] ) ) {
4529
+					if (!isset($args['after_title'])) {
4530 4530
 						$args['after_title'] = '';
4531 4531
 					}
4532 4532
 
4533 4533
 					$output = $args['before_title'] . $title . $args['after_title'];
4534 4534
 				} else {
4535
-					$tag 			= esc_attr( $instance['widget_title_tag'] );
4536
-					$allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4537
-					$title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4535
+					$tag 			= esc_attr($instance['widget_title_tag']);
4536
+					$allowed_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p');
4537
+					$title_tag = in_array($tag, $allowed_tags, true) ? esc_attr($tag) : 'h2';
4538 4538
 
4539 4539
 					// classes
4540 4540
 					$title_classes = array();
4541
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4542
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4543
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4544
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4545
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4546
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4547
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4548
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4549
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4550
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4551
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4552
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4553
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4554
-
4555
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4541
+					$title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : '';
4542
+					$title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : '';
4543
+					$title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : '';
4544
+					$title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : '';
4545
+					$title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : '';
4546
+					$title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : '';
4547
+					$title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : '';
4548
+					$title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : '';
4549
+					$title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : '';
4550
+					$title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : '';
4551
+					$title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : '';
4552
+					$title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : '';
4553
+					$title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : '';
4554
+
4555
+					$class = !empty($title_classes) ? implode(" ", $title_classes) : '';
4556 4556
 					$output = "<$title_tag class='$class' >$title</$title_tag>";
4557 4557
 				}
4558 4558
 
@@ -4566,7 +4566,7 @@  discard block
 block discarded – undo
4566 4566
 		 *
4567 4567
 		 * @param array $instance The widget options.
4568 4568
 		 */
4569
-		public function form( $instance ) {
4569
+		public function form($instance) {
4570 4570
 
4571 4571
 			// set widget instance
4572 4572
 			$this->instance = $instance;
@@ -4574,20 +4574,20 @@  discard block
 block discarded – undo
4574 4574
 			// set it as a SD widget
4575 4575
 			echo $this->widget_advanced_toggle();
4576 4576
 
4577
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4577
+			echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>";
4578 4578
 			$arguments_raw = $this->get_arguments();
4579 4579
 
4580
-			if ( is_array( $arguments_raw ) ) {
4580
+			if (is_array($arguments_raw)) {
4581 4581
 
4582
-				$arguments = $this->group_arguments( $arguments_raw );
4582
+				$arguments = $this->group_arguments($arguments_raw);
4583 4583
 
4584 4584
 				// Do we have sections?
4585 4585
 				$has_sections = $arguments == $arguments_raw ? false : true;
4586 4586
 
4587 4587
 
4588
-				if ( $has_sections ) {
4588
+				if ($has_sections) {
4589 4589
 					$panel_count = 0;
4590
-					foreach ( $arguments as $key => $args ) {
4590
+					foreach ($arguments as $key => $args) {
4591 4591
 
4592 4592
 						?>
4593 4593
 						<script>
@@ -4597,26 +4597,26 @@  discard block
 block discarded – undo
4597 4597
 
4598 4598
 						$hide       = $panel_count ? ' style="display:none;" ' : '';
4599 4599
 						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4600
-						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>";
4601
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4600
+						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>";
4601
+						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>";
4602 4602
 
4603
-						foreach ( $args as $k => $a ) {
4603
+						foreach ($args as $k => $a) {
4604 4604
 
4605 4605
 							$this->widget_inputs_row_start($k, $a);
4606
-							$this->widget_inputs( $a, $instance );
4606
+							$this->widget_inputs($a, $instance);
4607 4607
 							$this->widget_inputs_row_end($k, $a);
4608 4608
 
4609 4609
 						}
4610 4610
 
4611 4611
 						echo "</div>";
4612 4612
 
4613
-						$panel_count ++;
4613
+						$panel_count++;
4614 4614
 
4615 4615
 					}
4616 4616
 				} else {
4617
-					foreach ( $arguments as $key => $args ) {
4617
+					foreach ($arguments as $key => $args) {
4618 4618
 						$this->widget_inputs_row_start($key, $args);
4619
-						$this->widget_inputs( $args, $instance );
4619
+						$this->widget_inputs($args, $instance);
4620 4620
 						$this->widget_inputs_row_end($key, $args);
4621 4621
 					}
4622 4622
 				}
@@ -4624,28 +4624,28 @@  discard block
 block discarded – undo
4624 4624
 			}
4625 4625
 		}
4626 4626
 
4627
-		public function widget_inputs_row_start( $key, $args ) {
4628
-			if ( ! empty( $args['row'] ) ) {
4627
+		public function widget_inputs_row_start($key, $args) {
4628
+			if (!empty($args['row'])) {
4629 4629
 				// Maybe open
4630
-				if ( ! empty( $args['row']['open'] ) ) {
4630
+				if (!empty($args['row']['open'])) {
4631 4631
 					?>
4632
-					<div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'>
4633
-					<?php if ( ! empty( $args['row']['title'] ) ) { ?>
4632
+					<div class='bsui sd-argument' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php echo (!empty($args['row']['element_require']) ? $this->convert_element_require($args['row']['element_require']) : ''); ?>'>
4633
+					<?php if (!empty($args['row']['title'])) { ?>
4634 4634
 					<?php
4635
-						if ( isset( $args['row']['icon'] ) ) {
4635
+						if (isset($args['row']['icon'])) {
4636 4636
 							$args['row']['icon'] = '';
4637 4637
 						}
4638 4638
 
4639
-						if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4639
+						if (!isset($args['row']['device_type']) && isset($args['device_type'])) {
4640 4640
 							$args['row']['device_type'] = $args['device_type'];
4641 4641
 						}
4642 4642
 					?>
4643
-					<label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4643
+					<label class="mb-0"><?php echo $this->widget_field_title($args['row']); ?><?php echo $this->widget_field_desc($args['row']); ?></label>
4644 4644
 					<?php } ?>
4645
-					<div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'>
4645
+					<div class='row<?php echo (!empty($args['row']['class']) ? ' ' . esc_attr($args['row']['class']) : ''); ?>'>
4646 4646
 					<div class='col pr-2'>
4647 4647
 					<?php
4648
-				} else if ( ! empty( $args['row']['close'] ) ) {
4648
+				} else if (!empty($args['row']['close'])) {
4649 4649
 					echo "<div class='col pl-0 ps-0'>";
4650 4650
 				} else {
4651 4651
 					echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
@@ -4653,10 +4653,10 @@  discard block
 block discarded – undo
4653 4653
 			}
4654 4654
 		}
4655 4655
 
4656
-		public function widget_inputs_row_end( $key, $args ) {
4657
-			if ( ! empty( $args['row'] ) ) {
4656
+		public function widget_inputs_row_end($key, $args) {
4657
+			if (!empty($args['row'])) {
4658 4658
 				// Maybe close
4659
-				if ( ! empty( $args['row']['close'] ) ) {
4659
+				if (!empty($args['row']['close'])) {
4660 4660
 					echo "</div></div>";
4661 4661
 				}
4662 4662
 				echo "</div>";
@@ -4671,7 +4671,7 @@  discard block
 block discarded – undo
4671 4671
 		public function widget_advanced_toggle() {
4672 4672
 
4673 4673
 			$output = '';
4674
-			if ( $this->block_show_advanced() ) {
4674
+			if ($this->block_show_advanced()) {
4675 4675
 				$val = 1;
4676 4676
 			} else {
4677 4677
 				$val = 0;
@@ -4691,14 +4691,14 @@  discard block
 block discarded – undo
4691 4691
 		 *@since 1.0.0
4692 4692
 		 *
4693 4693
 		 */
4694
-		public function convert_element_require( $input ) {
4695
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4694
+		public function convert_element_require($input) {
4695
+			$input = str_replace("'", '"', $input); // we only want double quotes
4696 4696
 
4697
-			$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4697
+			$output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array(
4698 4698
 				"jQuery(form).find('[data-argument=\"",
4699 4699
 				"\"]').find('input,select,textarea').val()",
4700 4700
 				"\"]').find('input:checked').val()"
4701
-			), $input ) );
4701
+			), $input));
4702 4702
 
4703 4703
 			return $output;
4704 4704
 		}
@@ -4709,48 +4709,48 @@  discard block
 block discarded – undo
4709 4709
 		 * @param $args
4710 4710
 		 * @param $instance
4711 4711
 		 */
4712
-		public function widget_inputs( $args, $instance ) {
4712
+		public function widget_inputs($args, $instance) {
4713 4713
 
4714 4714
 			$class             = "";
4715 4715
 			$element_require   = "";
4716 4716
 			$custom_attributes = "";
4717 4717
 
4718 4718
 			// get value
4719
-			if ( isset( $instance[ $args['name'] ] ) ) {
4720
-				$value = $instance[ $args['name'] ];
4721
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4722
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4719
+			if (isset($instance[$args['name']])) {
4720
+				$value = $instance[$args['name']];
4721
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
4722
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
4723 4723
 			} else {
4724 4724
 				$value = '';
4725 4725
 			}
4726 4726
 
4727 4727
 			// get placeholder
4728
-			if ( ! empty( $args['placeholder'] ) ) {
4729
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4728
+			if (!empty($args['placeholder'])) {
4729
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
4730 4730
 			} else {
4731 4731
 				$placeholder = '';
4732 4732
 			}
4733 4733
 
4734 4734
 			// get if advanced
4735
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4735
+			if (isset($args['advanced']) && $args['advanced']) {
4736 4736
 				$class .= " sd-advanced-setting ";
4737 4737
 			}
4738 4738
 
4739 4739
 			// element_require
4740
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4740
+			if (isset($args['element_require']) && $args['element_require']) {
4741 4741
 				$element_require = $args['element_require'];
4742 4742
 			}
4743 4743
 
4744 4744
 			// custom_attributes
4745
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4746
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4745
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
4746
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
4747 4747
 			}
4748 4748
 
4749 4749
 			// before wrapper
4750 4750
 			?>
4751
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'>
4751
+			<p class="sd-argument <?php echo esc_attr($class); ?>" data-argument='<?php echo esc_attr($args['name']); ?>' data-element_require='<?php if ($element_require) { echo $this->convert_element_require($element_require); } ?>'>
4752 4752
 			<?php
4753
-			switch ( $args['type'] ) {
4753
+			switch ($args['type']) {
4754 4754
 				//array('text','password','number','email','tel','url','color')
4755 4755
 				case "text":
4756 4756
 				case "password":
@@ -4760,33 +4760,33 @@  discard block
 block discarded – undo
4760 4760
 				case "url":
4761 4761
 				case "color":
4762 4762
 					?>
4763
-					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4764
-					<input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="<?php echo esc_attr( $args['type'] ); ?>" value="<?php echo esc_attr( $value ); ?>">
4763
+					<label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4764
+					<input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="<?php echo esc_attr($args['type']); ?>" value="<?php echo esc_attr($value); ?>">
4765 4765
 					<?php
4766 4766
 
4767 4767
 					break;
4768 4768
 				case "select":
4769
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4770
-					if ( $multiple ) {
4771
-						if ( empty( $value ) ) {
4769
+					$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
4770
+					if ($multiple) {
4771
+						if (empty($value)) {
4772 4772
 							$value = array();
4773 4773
 						}
4774 4774
 					}
4775 4775
 					?>
4776
-					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4777
-					<select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); if ( $multiple ) { echo "[]"; } ?>"
4778
-						<?php if ( $multiple ) {
4776
+					<label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4777
+					<select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); if ($multiple) { echo "[]"; } ?>"
4778
+						<?php if ($multiple) {
4779 4779
 							echo "multiple";
4780 4780
 						} //@todo not implemented yet due to gutenberg not supporting it
4781 4781
 						?>>
4782 4782
 						<?php
4783 4783
 
4784
-						if ( ! empty( $args['options'] ) ) {
4785
-							foreach ( $args['options'] as $val => $label ) {
4786
-								if ( $multiple ) {
4787
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4784
+						if (!empty($args['options'])) {
4785
+							foreach ($args['options'] as $val => $label) {
4786
+								if ($multiple) {
4787
+									$selected = in_array($val, $value) ? 'selected="selected"' : '';
4788 4788
 								} else {
4789
-									$selected = selected( $value, $val, false );
4789
+									$selected = selected($value, $val, false);
4790 4790
 								}
4791 4791
 								echo "<option value='$val' " . $selected . ">$label</option>";
4792 4792
 							}
@@ -4797,20 +4797,20 @@  discard block
 block discarded – undo
4797 4797
 					break;
4798 4798
 				case "checkbox":
4799 4799
 					?>
4800
-					<input <?php echo $placeholder; ?> <?php checked( 1, $value, true ) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1">
4801
-					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4800
+					<input <?php echo $placeholder; ?> <?php checked(1, $value, true) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox" value="1">
4801
+					<label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4802 4802
 					<?php
4803 4803
 					break;
4804 4804
 				case "textarea":
4805 4805
 					?>
4806
-					<label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4807
-					<textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"><?php echo esc_attr( $value ); ?></textarea>
4806
+					<label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
4807
+					<textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"><?php echo esc_attr($value); ?></textarea>
4808 4808
 					<?php
4809 4809
 
4810 4810
 					break;
4811 4811
 				case "hidden":
4812 4812
 					?>
4813
-					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>">
4813
+					<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden" value="<?php echo esc_attr($value); ?>">
4814 4814
 					<?php
4815 4815
 					break;
4816 4816
 				default:
@@ -4820,15 +4820,15 @@  discard block
 block discarded – undo
4820 4820
 			?></p><?php
4821 4821
 		}
4822 4822
 
4823
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4824
-			if($icon=='box-top'){
4825
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4826
-			}elseif($icon=='box-right'){
4827
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4828
-			}elseif($icon=='box-bottom'){
4829
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4830
-			}elseif($icon=='box-left'){
4831
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4823
+		public function get_widget_icon($icon = 'box-top', $title = '') {
4824
+			if ($icon == 'box-top') {
4825
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4826
+			}elseif ($icon == 'box-right') {
4827
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4828
+			}elseif ($icon == 'box-bottom') {
4829
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4830
+			}elseif ($icon == 'box-left') {
4831
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4832 4832
 			}
4833 4833
 		}
4834 4834
 
@@ -4840,14 +4840,14 @@  discard block
 block discarded – undo
4840 4840
 		 * @return string
4841 4841
 		 * @todo, need to make its own tooltip script
4842 4842
 		 */
4843
-		public function widget_field_desc( $args ) {
4843
+		public function widget_field_desc($args) {
4844 4844
 
4845 4845
 			$description = '';
4846
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4847
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4848
-					$description = $this->desc_tip( $args['desc'] );
4846
+			if (isset($args['desc']) && $args['desc']) {
4847
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
4848
+					$description = $this->desc_tip($args['desc']);
4849 4849
 				} else {
4850
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4850
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
4851 4851
 				}
4852 4852
 			}
4853 4853
 
@@ -4861,18 +4861,18 @@  discard block
 block discarded – undo
4861 4861
 		 *
4862 4862
 		 * @return string
4863 4863
 		 */
4864
-		public function widget_field_title( $args ) {
4864
+		public function widget_field_title($args) {
4865 4865
 			$title = '';
4866 4866
 
4867
-			if ( isset( $args['title'] ) && $args['title'] ) {
4868
-				if ( ! empty( $args['device_type'] ) ) {
4867
+			if (isset($args['title']) && $args['title']) {
4868
+				if (!empty($args['device_type'])) {
4869 4869
 					$args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title.
4870 4870
 				}
4871 4871
 
4872
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4873
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4872
+				if (isset($args['icon']) && $args['icon']) {
4873
+					$title = self::get_widget_icon($args['icon'], $args['title']);
4874 4874
 				} else {
4875
-					$title = esc_attr( $args['title'] );
4875
+					$title = esc_attr($args['title']);
4876 4876
 				}
4877 4877
 			}
4878 4878
 
@@ -4887,11 +4887,11 @@  discard block
 block discarded – undo
4887 4887
 		 *
4888 4888
 		 * @return string
4889 4889
 		 */
4890
-		function desc_tip( $tip, $allow_html = false ) {
4891
-			if ( $allow_html ) {
4892
-				$tip = $this->sanitize_tooltip( $tip );
4890
+		function desc_tip($tip, $allow_html = false) {
4891
+			if ($allow_html) {
4892
+				$tip = $this->sanitize_tooltip($tip);
4893 4893
 			} else {
4894
-				$tip = esc_attr( $tip );
4894
+				$tip = esc_attr($tip);
4895 4895
 			}
4896 4896
 
4897 4897
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -4904,8 +4904,8 @@  discard block
 block discarded – undo
4904 4904
 		 *
4905 4905
 		 * @return string
4906 4906
 		 */
4907
-		public function sanitize_tooltip( $var ) {
4908
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4907
+		public function sanitize_tooltip($var) {
4908
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
4909 4909
 				'br'     => array(),
4910 4910
 				'em'     => array(),
4911 4911
 				'strong' => array(),
@@ -4915,7 +4915,7 @@  discard block
 block discarded – undo
4915 4915
 				'li'     => array(),
4916 4916
 				'ol'     => array(),
4917 4917
 				'p'      => array(),
4918
-			) ) );
4918
+			)));
4919 4919
 		}
4920 4920
 
4921 4921
 		/**
@@ -4927,30 +4927,30 @@  discard block
 block discarded – undo
4927 4927
 		 * @return array
4928 4928
 		 * @todo we should add some sanitation here.
4929 4929
 		 */
4930
-		public function update( $new_instance, $old_instance ) {
4930
+		public function update($new_instance, $old_instance) {
4931 4931
 
4932 4932
 			//save the widget
4933
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4933
+			$instance = array_merge((array) $old_instance, (array) $new_instance);
4934 4934
 
4935 4935
 			// set widget instance
4936 4936
 			$this->instance = $instance;
4937 4937
 
4938
-			if ( empty( $this->arguments ) ) {
4938
+			if (empty($this->arguments)) {
4939 4939
 				$this->get_arguments();
4940 4940
 			}
4941 4941
 
4942 4942
 			// check for checkboxes
4943
-			if ( ! empty( $this->arguments ) ) {
4944
-				foreach ( $this->arguments as $argument ) {
4945
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4946
-						$instance[ $argument['name'] ] = '0';
4943
+			if (!empty($this->arguments)) {
4944
+				foreach ($this->arguments as $argument) {
4945
+					if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
4946
+						$instance[$argument['name']] = '0';
4947 4947
 					}
4948 4948
 				}
4949 4949
 			}
4950 4950
 
4951 4951
             // maybe sanitize widget title
4952
-            if(!empty($instance['title'])) {
4953
-                $instance['title'] = wp_kses_post( $instance['title'] );
4952
+            if (!empty($instance['title'])) {
4953
+                $instance['title'] = wp_kses_post($instance['title']);
4954 4954
             }
4955 4955
 
4956 4956
 			return $instance;
@@ -4966,7 +4966,7 @@  discard block
 block discarded – undo
4966 4966
 		 */
4967 4967
 		public function is_block_content_call() {
4968 4968
 			$result = false;
4969
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4969
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
4970 4970
 				$result = true;
4971 4971
 			}
4972 4972
 
@@ -4979,9 +4979,9 @@  discard block
 block discarded – undo
4979 4979
 		 * @return string
4980 4980
 		 *@since 1.0.20
4981 4981
 		 */
4982
-		public function get_instance_hash(){
4983
-			$instance_string = $this->base_id.serialize($this->instance);
4984
-			return hash('crc32b',$instance_string);
4982
+		public function get_instance_hash() {
4983
+			$instance_string = $this->base_id . serialize($this->instance);
4984
+			return hash('crc32b', $instance_string);
4985 4985
 		}
4986 4986
 
4987 4987
 		/**
@@ -4992,14 +4992,14 @@  discard block
 block discarded – undo
4992 4992
 		 * @return string
4993 4993
 		 *@since 1.0.20
4994 4994
 		 */
4995
-		public function get_instance_style($rules = array()){
4995
+		public function get_instance_style($rules = array()) {
4996 4996
 			$css = '';
4997 4997
 
4998
-			if(!empty($rules)){
4998
+			if (!empty($rules)) {
4999 4999
 				$rules = array_unique($rules);
5000 5000
 				$instance_hash = $this->get_instance_hash();
5001 5001
 				$css .= "<style>";
5002
-				foreach($rules as $rule){
5002
+				foreach ($rules as $rule) {
5003 5003
 					$css .= ".sdel-$instance_hash $rule";
5004 5004
 				}
5005 5005
 				$css .= "</style>";
@@ -5017,9 +5017,9 @@  discard block
 block discarded – undo
5017 5017
 		 *@since 1.0.28
5018 5018
 		 *
5019 5019
 		 */
5020
-		public function encode_shortcodes( $content ) {
5020
+		public function encode_shortcodes($content) {
5021 5021
 			// Avoids existing encoded tags.
5022
-			$trans   = array(
5022
+			$trans = array(
5023 5023
 				'&#91;' => '&#091;',
5024 5024
 				'&#93;' => '&#093;',
5025 5025
 				'&amp;#91;' => '&#091;',
@@ -5030,7 +5030,7 @@  discard block
 block discarded – undo
5030 5030
 				'&amp;gt;' => '&0gt;',
5031 5031
 			);
5032 5032
 
5033
-			$content = strtr( $content, $trans );
5033
+			$content = strtr($content, $trans);
5034 5034
 
5035 5035
 			$trans   = array(
5036 5036
 				'[' => '&#91;',
@@ -5041,7 +5041,7 @@  discard block
 block discarded – undo
5041 5041
 				"'" => '&#39;',
5042 5042
 			);
5043 5043
 
5044
-			$content = strtr( $content, $trans );
5044
+			$content = strtr($content, $trans);
5045 5045
 
5046 5046
 			return $content;
5047 5047
 		}
@@ -5055,8 +5055,8 @@  discard block
 block discarded – undo
5055 5055
 		 *@since 1.0.28
5056 5056
 		 *
5057 5057
 		 */
5058
-		public function decode_shortcodes( $content ) {
5059
-			$trans   = array(
5058
+		public function decode_shortcodes($content) {
5059
+			$trans = array(
5060 5060
 				'&#91;' => '[',
5061 5061
 				'&#93;' => ']',
5062 5062
 				'&amp;#91;' => '[',
@@ -5069,7 +5069,7 @@  discard block
 block discarded – undo
5069 5069
 				'&apos;' => "'",
5070 5070
 			);
5071 5071
 
5072
-			$content = strtr( $content, $trans );
5072
+			$content = strtr($content, $trans);
5073 5073
 
5074 5074
 			$trans   = array(
5075 5075
 				'&#091;' => '&#91;',
@@ -5082,31 +5082,31 @@  discard block
 block discarded – undo
5082 5082
 				'&amp;0gt;' => '&gt;',
5083 5083
 			);
5084 5084
 
5085
-			$content = strtr( $content, $trans );
5085
+			$content = strtr($content, $trans);
5086 5086
 
5087 5087
 			return $content;
5088 5088
 		}
5089 5089
 
5090
-		public function block_visibility_fields( $args ) {
5091
-			$value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : '';
5090
+		public function block_visibility_fields($args) {
5091
+			$value = !empty($args['value']) ? esc_attr($args['value']) : '';
5092 5092
 			$content = '<div class="bs-vc-rule-template d-none">';
5093 5093
 				$content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >';
5094 5094
 					$content .= '<div class="row">';
5095 5095
 						$content .= '<div class="col-sm-12">';
5096
-							$content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5096
+							$content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__('Remove Rule', 'ayecode-connect') . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5097 5097
 							$content .= aui()->select(
5098 5098
 								array(
5099 5099
 									'id'          => 'bsvc_rule_BSVCINDEX',
5100 5100
 									'name'        => 'bsvc_rule_BSVCINDEX',
5101
-									'label'       => __( 'Rule', 'ayecode-connect' ),
5102
-									'placeholder' => __( 'Select Rule...', 'ayecode-connect' ),
5101
+									'label'       => __('Rule', 'ayecode-connect'),
5102
+									'placeholder' => __('Select Rule...', 'ayecode-connect'),
5103 5103
 									'class'       => 'bsvc_rule form-select-sm no-select2 mw-100',
5104 5104
 									'options'     => sd_visibility_rules_options(),
5105 5105
 									'default'     => '',
5106 5106
 									'value'       => '',
5107 5107
 									'label_type'  => '',
5108 5108
 									'select2'     => false,
5109
-									'input_group_left' => __( 'Rule:', 'ayecode-connect' ),
5109
+									'input_group_left' => __('Rule:', 'ayecode-connect'),
5110 5110
 									'extra_attributes' => array(
5111 5111
 										'data-minimum-results-for-search' => '-1'
5112 5112
 									)
@@ -5115,15 +5115,15 @@  discard block
 block discarded – undo
5115 5115
 
5116 5116
 						$content .= '</div>';
5117 5117
 
5118
-						if ( class_exists( 'GeoDirectory' ) ) {
5118
+						if (class_exists('GeoDirectory')) {
5119 5119
 							$content .= '<div class="col-md-7 col-sm-12">';
5120 5120
 
5121 5121
 								$content .= aui()->select(
5122 5122
 									array(
5123 5123
 										'id'          => 'bsvc_gd_field_BSVCINDEX',
5124 5124
 										'name'        => 'bsvc_gd_field_BSVCINDEX',
5125
-										'label'       => __( 'FIELD', 'ayecode-connect' ),
5126
-										'placeholder' => __( 'FIELD', 'ayecode-connect' ),
5125
+										'label'       => __('FIELD', 'ayecode-connect'),
5126
+										'placeholder' => __('FIELD', 'ayecode-connect'),
5127 5127
 										'class'       => 'bsvc_gd_field form-select-sm no-select2 mw-100',
5128 5128
 										'options'     => sd_visibility_gd_field_options(),
5129 5129
 										'default'     => '',
@@ -5144,8 +5144,8 @@  discard block
 block discarded – undo
5144 5144
 									array(
5145 5145
 										'id'          => 'bsvc_gd_field_condition_BSVCINDEX',
5146 5146
 										'name'        => 'bsvc_gd_field_condition_BSVCINDEX',
5147
-										'label'       => __( 'CONDITION', 'ayecode-connect' ),
5148
-										'placeholder' => __( 'CONDITION', 'ayecode-connect' ),
5147
+										'label'       => __('CONDITION', 'ayecode-connect'),
5148
+										'placeholder' => __('CONDITION', 'ayecode-connect'),
5149 5149
 										'class'       => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100',
5150 5150
 										'options'     => sd_visibility_field_condition_options(),
5151 5151
 										'default'     => '',
@@ -5167,9 +5167,9 @@  discard block
 block discarded – undo
5167 5167
 										'type'            => 'text',
5168 5168
 										'id'              => 'bsvc_gd_field_search_BSVCINDEX',
5169 5169
 										'name'            => 'bsvc_gd_field_search_BSVCINDEX',
5170
-										'label'           => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5170
+										'label'           => __('VALUE TO MATCH', 'ayecode-connect'),
5171 5171
 										'class'           => 'bsvc_gd_field_search form-control-sm',
5172
-										'placeholder'     => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5172
+										'placeholder'     => __('VALUE TO MATCH', 'ayecode-connect'),
5173 5173
 										'label_type'      => '',
5174 5174
 										'value'           => '',
5175 5175
 										'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")'
@@ -5179,15 +5179,15 @@  discard block
 block discarded – undo
5179 5179
 							$content .= '</div>';
5180 5180
 						}
5181 5181
 
5182
-                        $content .= apply_filters( 'sd_block_visibility_fields', '', $args );
5182
+                        $content .= apply_filters('sd_block_visibility_fields', '', $args);
5183 5183
 
5184 5184
 					$content .= '</div>';
5185 5185
 
5186
-					$content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>';
5186
+					$content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __('Select User Roles:', 'ayecode-connect') . '</label>';
5187 5187
 						$role_options = sd_user_roles_options();
5188 5188
 
5189 5189
 						$role_option_i = 0;
5190
-						foreach ( $role_options as $role_option_key => $role_option_name ) {
5190
+						foreach ($role_options as $role_option_key => $role_option_name) {
5191 5191
 							$role_option_i++;
5192 5192
 
5193 5193
 							$content .= '<div class="col-sm-6">';
@@ -5207,19 +5207,19 @@  discard block
 block discarded – undo
5207 5207
 							$content .= '</div>';
5208 5208
 						}
5209 5209
 					$content .= '</div>';
5210
-					$content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__( 'AND', 'ayecode-connect' ) . '</div></div>';
5210
+					$content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__('AND', 'ayecode-connect') . '</div></div>';
5211 5211
 				$content .= '</div>';
5212 5212
 			$content .= '</div>';
5213 5213
 			$content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">';
5214 5214
 			$content .= '<div class="bs-vc-rule-sets"></div>';
5215
-			$content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>';
5215
+			$content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __('Add Rule', 'ayecode-connect') . '</button></div></div>';
5216 5216
 			$content .= '<div class="row"><div class="col-md-6 col-sm-12">';
5217 5217
 			$content .= aui()->select(
5218 5218
 				array(
5219 5219
 					'id'          => 'bsvc_output',
5220 5220
 					'name'        => 'bsvc_output',
5221
-					'label'       => __( 'What should happen if rules met.', 'ayecode-connect' ),
5222
-					'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5221
+					'label'       => __('What should happen if rules met.', 'ayecode-connect'),
5222
+					'placeholder' => __('Show Block', 'ayecode-connect'),
5223 5223
 					'class'       => 'bsvc_output form-select-sm no-select2 mw-100',
5224 5224
 					'options'     => sd_visibility_output_options(),
5225 5225
 					'default'     => '',
@@ -5238,8 +5238,8 @@  discard block
 block discarded – undo
5238 5238
 				array(
5239 5239
 					'id'              => 'bsvc_page',
5240 5240
 					'name'            => 'bsvc_page',
5241
-					'label'           => __( 'Page Content', 'ayecode-connect' ),
5242
-					'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5241
+					'label'           => __('Page Content', 'ayecode-connect'),
5242
+					'placeholder'     => __('Select Page ID...', 'ayecode-connect'),
5243 5243
 					'class'           => 'bsvc_page form-select-sm no-select2 mw-100',
5244 5244
 					'options'         => sd_template_page_options(),
5245 5245
 					'default'         => '',
@@ -5254,8 +5254,8 @@  discard block
 block discarded – undo
5254 5254
 				array(
5255 5255
 					'id'          => 'bsvc_tmpl_part',
5256 5256
 					'name'        => 'bsvc_tmpl_part',
5257
-					'label'       => __( 'Template Part', 'ayecode-connect' ),
5258
-					'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5257
+					'label'       => __('Template Part', 'ayecode-connect'),
5258
+					'placeholder' => __('Select Template Part...', 'ayecode-connect'),
5259 5259
 					'class'       => 'bsvc_tmpl_part form-select-sm no-select2 mw-100',
5260 5260
 					'options'     => sd_template_part_options(),
5261 5261
 					'default'     => '',
@@ -5273,8 +5273,8 @@  discard block
 block discarded – undo
5273 5273
 				array(
5274 5274
 					'id'               => 'bsvc_message_type',
5275 5275
 					'name'             => 'bsvc_message_type',
5276
-					'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5277
-					'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5276
+					'label'            => __('Custom Message Type', 'ayecode-connect'),
5277
+					'placeholder'      => __('Default (none)', 'ayecode-connect'),
5278 5278
 					'class'            => 'bsvc_message_type form-select-sm no-select2 mw-100',
5279 5279
 					'options'          => sd_aui_colors(),
5280 5280
 					'default'          => '',
@@ -5297,7 +5297,7 @@  discard block
 block discarded – undo
5297 5297
 					'name'            => 'bsvc_message',
5298 5298
 					'label'           => '',
5299 5299
 					'class'           => 'bsvc_message form-control-sm mb-3',
5300
-					'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5300
+					'placeholder'     => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'),
5301 5301
 					'label_type'      => '',
5302 5302
 					'value'           => '',
5303 5303
 					'form_group_class' => ' ',
@@ -5310,8 +5310,8 @@  discard block
 block discarded – undo
5310 5310
 				array(
5311 5311
 					'id'          => 'bsvc_output_n',
5312 5312
 					'name'        => 'bsvc_output_n',
5313
-					'label'       => __( 'What should happen if rules NOT met.', 'ayecode-connect' ),
5314
-					'placeholder' => __( 'Show Block', 'ayecode-connect' ),
5313
+					'label'       => __('What should happen if rules NOT met.', 'ayecode-connect'),
5314
+					'placeholder' => __('Show Block', 'ayecode-connect'),
5315 5315
 					'class'       => 'bsvc_output_n form-select-sm no-select2 mw-100',
5316 5316
 					'options'     => sd_visibility_output_options(),
5317 5317
 					'default'     => '',
@@ -5330,8 +5330,8 @@  discard block
 block discarded – undo
5330 5330
 				array(
5331 5331
 					'id'              => 'bsvc_page_n',
5332 5332
 					'name'            => 'bsvc_page_n',
5333
-					'label'           => __( 'Page Content', 'ayecode-connect' ),
5334
-					'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5333
+					'label'           => __('Page Content', 'ayecode-connect'),
5334
+					'placeholder'     => __('Select Page ID...', 'ayecode-connect'),
5335 5335
 					'class'           => 'bsvc_page_n form-select-sm no-select2 mw-100',
5336 5336
 					'options'         => sd_template_page_options(),
5337 5337
 					'default'         => '',
@@ -5346,8 +5346,8 @@  discard block
 block discarded – undo
5346 5346
 				array(
5347 5347
 					'id'          => 'bsvc_tmpl_part_n',
5348 5348
 					'name'        => 'bsvc_tmpl_part_n',
5349
-					'label'       => __( 'Template Part', 'ayecode-connect' ),
5350
-					'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5349
+					'label'       => __('Template Part', 'ayecode-connect'),
5350
+					'placeholder' => __('Select Template Part...', 'ayecode-connect'),
5351 5351
 					'class'       => 'bsvc_tmpl_part_n form-select-sm no-select2 mw-100',
5352 5352
 					'options'     => sd_template_part_options(),
5353 5353
 					'default'     => '',
@@ -5365,8 +5365,8 @@  discard block
 block discarded – undo
5365 5365
 				array(
5366 5366
 					'id'               => 'bsvc_message_type_n',
5367 5367
 					'name'             => 'bsvc_message_type_n',
5368
-					'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5369
-					'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5368
+					'label'            => __('Custom Message Type', 'ayecode-connect'),
5369
+					'placeholder'      => __('Default (none)', 'ayecode-connect'),
5370 5370
 					'class'            => 'bsvc_message_type_n form-select-sm no-select2 mw-100',
5371 5371
 					'options'          => sd_aui_colors(),
5372 5372
 					'default'          => '',
@@ -5389,7 +5389,7 @@  discard block
 block discarded – undo
5389 5389
 					'name'            => 'bsvc_message_n',
5390 5390
 					'label'           => '',
5391 5391
 					'class'           => 'bsvc_message_n form-control-sm',
5392
-					'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5392
+					'placeholder'     => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'),
5393 5393
 					'label_type'      => '',
5394 5394
 					'value'           => '',
5395 5395
 					'form_group_class' => ' ',
@@ -5411,7 +5411,7 @@  discard block
 block discarded – undo
5411 5411
 			global $shortcode_insert_button_once;
5412 5412
 
5413 5413
 			// Fix conflicts with UpSolution Core in header template edit element.
5414
-			if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) {
5414
+			if (defined('US_CORE_DIR') && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html') {
5415 5415
 				$shortcode_insert_button_once = true;
5416 5416
 			}
5417 5417
 		}
Please login to merge, or discard this patch.
Switch Indentation   +2011 added lines, -2011 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1
-<?php
2
-if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
1
+    <?php
2
+    if ( ! defined( 'ABSPATH' ) ) {
3
+	    exit;
4 4
 }
5 5
 
6
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
6
+    if ( ! class_exists( 'WP_Super_Duper' ) ) {
7 7
 
8
-	define( 'SUPER_DUPER_VER', '1.2.25' );
8
+	    define( 'SUPER_DUPER_VER', '1.2.25' );
9 9
 
10
-	/**
10
+	    /**
11 11
 	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12 12
 	 *
13 13
 	 * Should not be called direct but extended instead.
@@ -16,397 +16,397 @@  discard block
 block discarded – undo
16 16
 	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17 17
 	 * @ver 1.1.1
18 18
 	 */
19
-	class WP_Super_Duper extends WP_Widget {
20
-
21
-		public $version = SUPER_DUPER_VER;
22
-		public $font_awesome_icon_version = "5.11.2";
23
-		public $block_code;
24
-		public $options;
25
-		public $base_id;
26
-		public $settings_hash;
27
-		public $arguments = array();
28
-		public $instance = array();
29
-		private $class_name;
30
-
31
-		/**
19
+	    class WP_Super_Duper extends WP_Widget {
20
+
21
+		    public $version = SUPER_DUPER_VER;
22
+		    public $font_awesome_icon_version = "5.11.2";
23
+		    public $block_code;
24
+		    public $options;
25
+		    public $base_id;
26
+		    public $settings_hash;
27
+		    public $arguments = array();
28
+		    public $instance = array();
29
+		    private $class_name;
30
+
31
+		    /**
32 32
 		 * The relative url to the current folder.
33 33
 		 *
34 34
 		 * @var string
35 35
 		 */
36
-		public $url = '';
36
+		    public $url = '';
37 37
 
38
-		/**
38
+		    /**
39 39
 		 * Take the array options and use them to build.
40 40
 		 */
41
-		public function __construct( $options ) {
42
-			global $sd_widgets;
43
-
44
-			$sd_widgets[ $options['base_id'] ] = array(
45
-				'name'       => $options['name'],
46
-				'class_name' => $options['class_name'],
47
-				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
-			);
49
-			$this->base_id                     = $options['base_id'];
50
-			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
54
-			$this->options = $options;
55
-
56
-			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58
-
59
-			// nested blocks can't work as a widget
60
-			if(!empty($this->options['nested-block'])){
61
-				if(empty($this->options['output_types'])){
62
-					$this->options['output_types'] = array('shortcode','block');
63
-				}elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
-					unset($this->options['output_types'][$key]);
65
-				}
66
-			}
67
-
68
-			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
-				parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
-			}
72
-
73
-
74
-			if ( isset( $options['class_name'] ) ) {
75
-				// register widget
76
-				$this->class_name = $options['class_name'];
77
-
78
-				// register shortcode, this needs to be done even for blocks and widgets
79
-				$this->register_shortcode();
80
-
81
-
82
-				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
85
-				}
86
-
87
-                // maybe load the Bricks transformer class
88
-                if( class_exists('\Bricks\Elements', false) ){
89
-					add_action( 'init', array( $this, 'load_bricks_element_class' ) );
90
-                }
91
-
92
-				// register block
93
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
94
-					add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
95
-				}
96
-			}
97
-
98
-			// add the CSS and JS we need ONCE
99
-			global $sd_widget_scripts;
100
-
101
-			if ( ! $sd_widget_scripts ) {
102
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
103
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
104
-				wp_add_inline_style( 'widgets', $this->widget_css() );
105
-
106
-				// maybe add elementor editor styles
107
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
108
-
109
-				$sd_widget_scripts = true;
110
-
111
-				// add shortcode insert button once
112
-				add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
113
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
114
-				// generatepress theme sections compatibility
115
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
116
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
117
-				}
118
-
119
-				/* Load script on Divi theme builder page */
120
-				if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) {
121
-					add_thickbox();
122
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
123
-				}
124
-
125
-				if ( $this->is_preview() ) {
126
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
127
-					// this makes the insert button work for elementor
128
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
129
-						$this,
130
-						'shortcode_insert_button_script'
131
-					) ); // for elementor
132
-				}
133
-				// this makes the insert button work for cornerstone
134
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
135
-
136
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
137
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
138
-
139
-				// add generator text to head
140
-				add_action( 'admin_head', array( $this, 'generator' ), 99 );
141
-				add_action( 'wp_head', array( $this, 'generator' ), 99 );
142
-			}
143
-
144
-			do_action( 'wp_super_duper_widget_init', $options, $this );
145
-		}
146
-
147
-        /**
41
+		    public function __construct( $options ) {
42
+			    global $sd_widgets;
43
+
44
+			    $sd_widgets[ $options['base_id'] ] = array(
45
+				    'name'       => $options['name'],
46
+				    'class_name' => $options['class_name'],
47
+				    'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
+			    );
49
+			    $this->base_id                     = $options['base_id'];
50
+			    // lets filter the options before we do anything
51
+			    $options       = apply_filters( "wp_super_duper_options", $options );
52
+			    $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
+			    $options       = $this->add_name_from_key( $options );
54
+			    $this->options = $options;
55
+
56
+			    $this->base_id   = $options['base_id'];
57
+			    $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58
+
59
+			    // nested blocks can't work as a widget
60
+			    if(!empty($this->options['nested-block'])){
61
+				    if(empty($this->options['output_types'])){
62
+					    $this->options['output_types'] = array('shortcode','block');
63
+				    }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
+					    unset($this->options['output_types'][$key]);
65
+				    }
66
+			    }
67
+
68
+			    // init parent
69
+			    if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
+				    parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
+			    }
72
+
73
+
74
+			    if ( isset( $options['class_name'] ) ) {
75
+				    // register widget
76
+				    $this->class_name = $options['class_name'];
77
+
78
+				    // register shortcode, this needs to be done even for blocks and widgets
79
+				    $this->register_shortcode();
80
+
81
+
82
+				    // Fusion Builder (avada) support
83
+				    if ( function_exists( 'fusion_builder_map' ) ) {
84
+					    add_action( 'init', array( $this, 'register_fusion_element' ) );
85
+				    }
86
+
87
+                    // maybe load the Bricks transformer class
88
+                    if( class_exists('\Bricks\Elements', false) ){
89
+					    add_action( 'init', array( $this, 'load_bricks_element_class' ) );
90
+                    }
91
+
92
+				    // register block
93
+				    if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
94
+					    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
95
+				    }
96
+			    }
97
+
98
+			    // add the CSS and JS we need ONCE
99
+			    global $sd_widget_scripts;
100
+
101
+			    if ( ! $sd_widget_scripts ) {
102
+				    wp_add_inline_script( 'admin-widgets', $this->widget_js() );
103
+				    wp_add_inline_script( 'customize-controls', $this->widget_js() );
104
+				    wp_add_inline_style( 'widgets', $this->widget_css() );
105
+
106
+				    // maybe add elementor editor styles
107
+				    add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
108
+
109
+				    $sd_widget_scripts = true;
110
+
111
+				    // add shortcode insert button once
112
+				    add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
113
+				    add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
114
+				    // generatepress theme sections compatibility
115
+				    if ( function_exists( 'generate_sections_sections_metabox' ) ) {
116
+					    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
117
+				    }
118
+
119
+				    /* Load script on Divi theme builder page */
120
+				    if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) {
121
+					    add_thickbox();
122
+					    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
123
+				    }
124
+
125
+				    if ( $this->is_preview() ) {
126
+					    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
127
+					    // this makes the insert button work for elementor
128
+					    add_action( 'elementor/editor/after_enqueue_scripts', array(
129
+						    $this,
130
+						    'shortcode_insert_button_script'
131
+					    ) ); // for elementor
132
+				    }
133
+				    // this makes the insert button work for cornerstone
134
+				    add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
135
+
136
+				    add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
137
+				    add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
138
+
139
+				    // add generator text to head
140
+				    add_action( 'admin_head', array( $this, 'generator' ), 99 );
141
+				    add_action( 'wp_head', array( $this, 'generator' ), 99 );
142
+			    }
143
+
144
+			    do_action( 'wp_super_duper_widget_init', $options, $this );
145
+		    }
146
+
147
+            /**
148 148
          * Load the Bricks conversion class if we are running Bricks.
149 149
          * @return void
150 150
          */
151
-        public function load_bricks_element_class() {
152
-                    include_once __DIR__ . '/includes/class-super-duper-bricks-element.php';
153
-        }
151
+            public function load_bricks_element_class() {
152
+                        include_once __DIR__ . '/includes/class-super-duper-bricks-element.php';
153
+            }
154 154
 
155
-		/**
155
+		    /**
156 156
 		 * The register widget function
157 157
 		 * @return void
158 158
 		 */
159
-		public function _register() {
160
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
161
-				parent::_register();
162
-			}
163
-		}
159
+		    public function _register() {
160
+			    if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
161
+				    parent::_register();
162
+			    }
163
+		    }
164 164
 
165
-		/**
165
+		    /**
166 166
 		 * Add our widget CSS to elementor editor.
167 167
 		 */
168
-		public function elementor_editor_styles() {
169
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
170
-		}
171
-
172
-		public function register_fusion_element() {
173
-
174
-			$options = $this->options;
175
-
176
-			if ( $this->base_id ) {
177
-
178
-				$params = $this->get_fusion_params();
179
-
180
-				$args = array(
181
-					'name'            => $options['name'],
182
-					'shortcode'       => $this->base_id,
183
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
184
-					'allow_generator' => true,
185
-				);
186
-
187
-				if ( ! empty( $params ) ) {
188
-					$args['params'] = $params;
189
-				}
190
-
191
-				fusion_builder_map( $args );
192
-			}
193
-
194
-		}
195
-
196
-		public function get_fusion_params() {
197
-			$params    = array();
198
-			$arguments = $this->get_arguments();
199
-
200
-			if ( ! empty( $arguments ) ) {
201
-				foreach ( $arguments as $key => $val ) {
202
-					$param = array();
203
-					// type
204
-					$param['type'] = str_replace(
205
-						array(
206
-							"text",
207
-							"number",
208
-							"email",
209
-							"color",
210
-							"checkbox"
211
-						),
212
-						array(
213
-							"textfield",
214
-							"textfield",
215
-							"textfield",
216
-							"colorpicker",
217
-							"select",
218
-
219
-						),
220
-						$val['type'] );
221
-
222
-					// multiselect
223
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
224
-						$param['type']     = 'multiple_select';
225
-						$param['multiple'] = true;
226
-					}
227
-
228
-					// heading
229
-					$param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
230
-
231
-					// description
232
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
233
-
234
-					// param_name
235
-					$param['param_name'] = $key;
236
-
237
-					// Default
238
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
239
-
240
-					// Group
241
-					if ( isset( $val['group'] ) ) {
242
-						$param['group'] = $val['group'];
243
-					}
244
-
245
-					// value
246
-					if ( $val['type'] == 'checkbox' ) {
247
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
248
-							unset( $param['default'] );
249
-						}
250
-						$param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
251
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
252
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
253
-					} else {
254
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
255
-					}
256
-
257
-					// setup the param
258
-					$params[] = $param;
259
-
260
-				}
261
-			}
262
-
263
-
264
-			return $params;
265
-		}
266
-
267
-		/**
168
+		    public function elementor_editor_styles() {
169
+			    wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
170
+		    }
171
+
172
+		    public function register_fusion_element() {
173
+
174
+			    $options = $this->options;
175
+
176
+			    if ( $this->base_id ) {
177
+
178
+				    $params = $this->get_fusion_params();
179
+
180
+				    $args = array(
181
+					    'name'            => $options['name'],
182
+					    'shortcode'       => $this->base_id,
183
+					    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
184
+					    'allow_generator' => true,
185
+				    );
186
+
187
+				    if ( ! empty( $params ) ) {
188
+					    $args['params'] = $params;
189
+				    }
190
+
191
+				    fusion_builder_map( $args );
192
+			    }
193
+
194
+		    }
195
+
196
+		    public function get_fusion_params() {
197
+			    $params    = array();
198
+			    $arguments = $this->get_arguments();
199
+
200
+			    if ( ! empty( $arguments ) ) {
201
+				    foreach ( $arguments as $key => $val ) {
202
+					    $param = array();
203
+					    // type
204
+					    $param['type'] = str_replace(
205
+						    array(
206
+							    "text",
207
+							    "number",
208
+							    "email",
209
+							    "color",
210
+							    "checkbox"
211
+						    ),
212
+						    array(
213
+							    "textfield",
214
+							    "textfield",
215
+							    "textfield",
216
+							    "colorpicker",
217
+							    "select",
218
+
219
+						    ),
220
+						    $val['type'] );
221
+
222
+					    // multiselect
223
+					    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
224
+						    $param['type']     = 'multiple_select';
225
+						    $param['multiple'] = true;
226
+					    }
227
+
228
+					    // heading
229
+					    $param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
230
+
231
+					    // description
232
+					    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
233
+
234
+					    // param_name
235
+					    $param['param_name'] = $key;
236
+
237
+					    // Default
238
+					    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
239
+
240
+					    // Group
241
+					    if ( isset( $val['group'] ) ) {
242
+						    $param['group'] = $val['group'];
243
+					    }
244
+
245
+					    // value
246
+					    if ( $val['type'] == 'checkbox' ) {
247
+						    if ( isset( $val['default'] ) && $val['default'] == '0' ) {
248
+							    unset( $param['default'] );
249
+						    }
250
+						    $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
251
+					    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
252
+						    $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
253
+					    } else {
254
+						    $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
255
+					    }
256
+
257
+					    // setup the param
258
+					    $params[] = $param;
259
+
260
+				    }
261
+			    }
262
+
263
+
264
+			    return $params;
265
+		    }
266
+
267
+		    /**
268 268
 		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
269 269
 		 */
270
-		public static function maybe_cornerstone_builder() {
271
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
272
-				self::shortcode_insert_button_script();
273
-			}
274
-		}
270
+		    public static function maybe_cornerstone_builder() {
271
+			    if ( did_action( 'cornerstone_before_boot_app' ) ) {
272
+				    self::shortcode_insert_button_script();
273
+			    }
274
+		    }
275 275
 
276
-		/**
276
+		    /**
277 277
 		 * A function to ge the shortcode builder picker html.
278 278
 		 *
279 279
 		 * @param string $editor_id
280 280
 		 *
281 281
 		 * @return string
282 282
 		 */
283
-		public static function get_picker( $editor_id = '' ) {
283
+		    public static function get_picker( $editor_id = '' ) {
284 284
 
285
-			ob_start();
286
-			if ( isset( $_POST['editor_id'] ) ) {
287
-				$editor_id = esc_attr( $_POST['editor_id'] );
288
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
289
-				$editor_id = 'main_content_content_vb_tiny_mce';
290
-			}
285
+			    ob_start();
286
+			    if ( isset( $_POST['editor_id'] ) ) {
287
+				    $editor_id = esc_attr( $_POST['editor_id'] );
288
+			    } elseif ( isset( $_REQUEST['et_fb'] ) ) {
289
+				    $editor_id = 'main_content_content_vb_tiny_mce';
290
+			    }
291 291
 
292
-			global $sd_widgets;
292
+			    global $sd_widgets;
293 293
 
294
-//			print_r($sd_widgets);exit;
295
-			?>
294
+    //			print_r($sd_widgets);exit;
295
+			    ?>
296 296
 
297 297
 			<div class="sd-shortcode-left-wrap">
298 298
 				<?php
299
-				ksort( $sd_widgets );
300
-				//				print_r($sd_widgets);exit;
301
-				if ( ! empty( $sd_widgets ) ) {
302
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
303
-					echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
304
-					foreach ( $sd_widgets as $shortcode => $class ) {
305
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
306
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
307
-					}
308
-					echo "</select>";
309
-
310
-				}
311
-				?>
299
+				    ksort( $sd_widgets );
300
+				    //				print_r($sd_widgets);exit;
301
+				    if ( ! empty( $sd_widgets ) ) {
302
+					    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
303
+					    echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
304
+					    foreach ( $sd_widgets as $shortcode => $class ) {
305
+						    if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
306
+						    echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
307
+					    }
308
+					    echo "</select>";
309
+
310
+				    }
311
+				    ?>
312 312
 				<div class="sd-shortcode-settings"></div>
313 313
 			</div>
314 314
 			<div class="sd-shortcode-right-wrap">
315 315
 				<textarea id='sd-shortcode-output' disabled></textarea>
316 316
 				<div id='sd-shortcode-output-actions'>
317 317
 					<?php if ( $editor_id != '' ) { ?>
318
-						<button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e( 'Insert shortcode', 'ayecode-connect' ); ?></button>
318
+    						<button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e( 'Insert shortcode', 'ayecode-connect' ); ?></button>
319 319
 					<?php } ?>
320
-					<button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy shortcode' ); ?></button>
320
+    					<button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy shortcode' ); ?></button>
321 321
 				</div>
322 322
 			</div>
323 323
 			<?php
324
-			$html = ob_get_clean();
325
-
326
-			if ( wp_doing_ajax() ) {
327
-				echo $html;
328
-				$should_die = true;
329
-
330
-				// some builder get the editor via ajax so we should not die on those occasions
331
-				$dont_die = array(
332
-					'parent_tag',// WP Bakery
333
-					'avia_request' // enfold
334
-				);
335
-
336
-				foreach ( $dont_die as $request ) {
337
-					if ( isset( $_REQUEST[ $request ] ) ) {
338
-						$should_die = false;
339
-					}
340
-				}
341
-
342
-				if ( $should_die ) {
343
-					wp_die();
344
-				}
345
-			} else {
346
-				return $html;
347
-			}
348
-
349
-			return '';
350
-		}
351
-
352
-		/**
324
+			    $html = ob_get_clean();
325
+
326
+			    if ( wp_doing_ajax() ) {
327
+				    echo $html;
328
+				    $should_die = true;
329
+
330
+				    // some builder get the editor via ajax so we should not die on those occasions
331
+				    $dont_die = array(
332
+					    'parent_tag',// WP Bakery
333
+					    'avia_request' // enfold
334
+				    );
335
+
336
+				    foreach ( $dont_die as $request ) {
337
+					    if ( isset( $_REQUEST[ $request ] ) ) {
338
+						    $should_die = false;
339
+					    }
340
+				    }
341
+
342
+				    if ( $should_die ) {
343
+					    wp_die();
344
+				    }
345
+			    } else {
346
+				    return $html;
347
+			    }
348
+
349
+			    return '';
350
+		    }
351
+
352
+		    /**
353 353
 		 * Output the version in the header.
354 354
 		 */
355
-		public function generator() {
356
-			$file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
357
-			$plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
358
-
359
-			// Find source plugin/theme of SD
360
-			$source = array();
361
-			if ( strpos( $file, $plugins_dir ) !== false ) {
362
-				$source = explode( "/", plugin_basename( $file ) );
363
-			} else if ( function_exists( 'get_theme_root' ) ) {
364
-				$themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
365
-
366
-				if ( strpos( $file, $themes_dir ) !== false ) {
367
-					$source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
368
-				}
369
-			}
370
-
371
-			echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
372
-		}
373
-
374
-		/**
355
+		    public function generator() {
356
+			    $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
357
+			    $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
358
+
359
+			    // Find source plugin/theme of SD
360
+			    $source = array();
361
+			    if ( strpos( $file, $plugins_dir ) !== false ) {
362
+				    $source = explode( "/", plugin_basename( $file ) );
363
+			    } else if ( function_exists( 'get_theme_root' ) ) {
364
+				    $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
365
+
366
+				    if ( strpos( $file, $themes_dir ) !== false ) {
367
+					    $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
368
+				    }
369
+			    }
370
+
371
+			    echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
372
+		    }
373
+
374
+		    /**
375 375
 		 * Get widget settings.
376 376
 		 *
377 377
 		 * @since 1.0.0
378 378
 		 */
379
-		public static function get_widget_settings() {
380
-			global $sd_widgets;
381
-
382
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
383
-			if ( ! $shortcode ) {
384
-				wp_die();
385
-			}
386
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
387
-			if ( ! $widget_args ) {
388
-				wp_die();
389
-			}
390
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
-			if ( ! $class_name ) {
392
-				wp_die();
393
-			}
394
-
395
-			// invoke an instance method
396
-			$widget = new $class_name;
397
-
398
-			ob_start();
399
-			$widget->form( array() );
400
-			$form = ob_get_clean();
401
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
402
-			echo "<style>" . $widget->widget_css() . "</style>";
403
-			echo "<script>" . $widget->widget_js() . "</script>";
404
-			?>
405
-			<?php
406
-			wp_die();
407
-		}
408
-
409
-		/**
379
+		    public static function get_widget_settings() {
380
+			    global $sd_widgets;
381
+
382
+			    $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
383
+			    if ( ! $shortcode ) {
384
+				    wp_die();
385
+			    }
386
+			    $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
387
+			    if ( ! $widget_args ) {
388
+				    wp_die();
389
+			    }
390
+			    $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
391
+			    if ( ! $class_name ) {
392
+				    wp_die();
393
+			    }
394
+
395
+			    // invoke an instance method
396
+			    $widget = new $class_name;
397
+
398
+			    ob_start();
399
+			    $widget->form( array() );
400
+			    $form = ob_get_clean();
401
+			    echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
402
+			    echo "<style>" . $widget->widget_css() . "</style>";
403
+			    echo "<script>" . $widget->widget_js() . "</script>";
404
+			    ?>
405
+    			<?php
406
+			    wp_die();
407
+		    }
408
+
409
+		    /**
410 410
 		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
411 411
 		 *
412 412
 		 * @param string $editor_id Optional. Shortcode editor id. Default null.
@@ -415,38 +415,38 @@  discard block
 block discarded – undo
415 415
 		 *@since 1.0.0
416 416
 		 *
417 417
 		 */
418
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
419
-			global $sd_widgets, $shortcode_insert_button_once;
420
-			if ( $shortcode_insert_button_once ) {
421
-				return;
422
-			}
423
-			add_thickbox();
424
-
425
-			/**
418
+		    public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
419
+			    global $sd_widgets, $shortcode_insert_button_once;
420
+			    if ( $shortcode_insert_button_once ) {
421
+				    return;
422
+			    }
423
+			    add_thickbox();
424
+
425
+			    /**
426 426
 			 * Cornerstone makes us play dirty tricks :/
427 427
 			 * 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.
428 428
 			 */
429
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
430
-				echo '<span id="insert-media-button">';
431
-			}
429
+			    if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
430
+				    echo '<span id="insert-media-button">';
431
+			    }
432 432
 
433
-			echo self::shortcode_button( 'this', 'true' );
433
+			    echo self::shortcode_button( 'this', 'true' );
434 434
 
435
-			// see opening note
436
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
437
-				echo '</span>'; // end #insert-media-button
438
-			}
435
+			    // see opening note
436
+			    if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
437
+				    echo '</span>'; // end #insert-media-button
438
+			    }
439 439
 
440
-			// Add separate script for generatepress theme sections
441
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
442
-			} else {
443
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
444
-			}
440
+			    // Add separate script for generatepress theme sections
441
+			    if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
442
+			    } else {
443
+				    self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
444
+			    }
445 445
 
446
-			$shortcode_insert_button_once = true;
447
-		}
446
+			    $shortcode_insert_button_once = true;
447
+		    }
448 448
 
449
-		/**
449
+		    /**
450 450
 		 * Gets the shortcode insert button html.
451 451
 		 *
452 452
 		 * @param string $id
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 		 *
455 455
 		 * @return mixed
456 456
 		 */
457
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
458
-			ob_start();
459
-			?>
457
+		    public static function shortcode_button( $id = '', $search_for_id = '' ) {
458
+			    ob_start();
459
+			    ?>
460 460
 			<span class="sd-lable-shortcode-inserter">
461 461
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
462
-				if ( $search_for_id ) {
463
-					echo "," . $search_for_id;
464
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
462
+				    if ( $search_for_id ) {
463
+					    echo "," . $search_for_id;
464
+				    } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
465 465
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
466 466
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
467 467
 						  class="dashicons dashicons-screenoptions"></span>
@@ -472,21 +472,21 @@  discard block
 block discarded – undo
472 472
 			</span>
473 473
 
474 474
 			<?php
475
-			$html = ob_get_clean();
475
+			    $html = ob_get_clean();
476 476
 
477
-			// remove line breaks so we can use it in js
478
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
479
-		}
477
+			    // remove line breaks so we can use it in js
478
+			    return preg_replace( "/\r|\n/", "", trim( $html ) );
479
+		    }
480 480
 
481
-		/**
481
+		    /**
482 482
 		 * Makes SD work with the siteOrigin page builder.
483 483
 		 *
484 484
 		 * @return mixed
485 485
 		 *@since 1.0.6
486 486
 		 */
487
-		public static function siteorigin_js() {
488
-			ob_start();
489
-			?>
487
+		    public static function siteorigin_js() {
488
+			    ob_start();
489
+			    ?>
490 490
 			<script>
491 491
 				/**
492 492
 				 * Check a form to see what items should be shown or hidden.
@@ -560,19 +560,19 @@  discard block
 block discarded – undo
560 560
 				});
561 561
 			</script>
562 562
 			<?php
563
-			$output = ob_get_clean();
563
+			    $output = ob_get_clean();
564 564
 
565
-			/*
565
+			    /*
566 566
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
567 567
 			 */
568 568
 
569
-			return str_replace( array(
570
-				'<script>',
571
-				'</script>'
572
-			), '', $output );
573
-		}
569
+			    return str_replace( array(
570
+				    '<script>',
571
+				    '</script>'
572
+			    ), '', $output );
573
+		    }
574 574
 
575
-		/**
575
+		    /**
576 576
 		 * Output the JS and CSS for the shortcode insert button.
577 577
 		 *
578 578
 		 * @param string $editor_id
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 		 *@since 1.0.6
582 582
 		 *
583 583
 		 */
584
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
585
-			?>
584
+		    public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
585
+			    ?>
586 586
 			<style>
587 587
 				.sd-shortcode-left-wrap {
588 588
 					float: left;
@@ -705,40 +705,40 @@  discard block
 block discarded – undo
705 705
 					display: inline;
706 706
 				}
707 707
 				<?php } ?>
708
-				<?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?>
709
-				body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999}
708
+    				<?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?>
709
+    				body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999}
710 710
 				<?php } ?>
711
-			</style>
711
+    			</style>
712 712
 			<?php
713
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
714
-				echo "<script>" . self::siteorigin_js() . "</script>";
715
-			}
716
-			?>
717
-			<script>
713
+			    if ( class_exists( 'SiteOrigin_Panels' ) ) {
714
+				    echo "<script>" . self::siteorigin_js() . "</script>";
715
+			    }
716
+			    ?>
717
+    			<script>
718 718
 				<?php
719
-				if(! empty( $insert_shortcode_function )){
720
-					echo $insert_shortcode_function;
721
-				}else{
719
+				    if(! empty( $insert_shortcode_function )){
720
+					    echo $insert_shortcode_function;
721
+				    }else{
722 722
 
723
-				/**
723
+				    /**
724 724
 				 * Function for super duper insert shortcode.
725 725
 				 *
726 726
 				 * @since 1.0.0
727 727
 				 */
728
-				?>
728
+				    ?>
729 729
 				function sd_insert_shortcode($editor_id) {
730 730
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
731 731
 					if ($shortcode) {
732 732
 						if (!$editor_id) {
733 733
 							<?php
734
-							if ( isset( $_REQUEST['et_fb'] ) ) {
735
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
736
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
737
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
738
-							} else {
739
-								echo '$editor_id = "#wp-content-editor-container textarea";';
740
-							}
741
-							?>
734
+							    if ( isset( $_REQUEST['et_fb'] ) ) {
735
+								    echo '$editor_id = "#main_content_content_vb_tiny_mce";';
736
+							    } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
737
+								    echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
738
+							    } else {
739
+								    echo '$editor_id = "#wp-content-editor-container textarea";';
740
+							    }
741
+							    ?>
742 742
 						} else {
743 743
 							$editor_id = '#' + $editor_id;
744 744
 						}
@@ -1069,19 +1069,19 @@  discard block
 block discarded – undo
1069 1069
 				}
1070 1070
 			</script>
1071 1071
 			<?php
1072
-		}
1072
+		    }
1073 1073
 
1074
-		/**
1074
+		    /**
1075 1075
 		 * Gets some CSS for the widgets screen.
1076 1076
 		 *
1077 1077
 		 * @param bool $advanced If we should include advanced CSS.
1078 1078
 		 *
1079 1079
 		 * @return mixed
1080 1080
 		 */
1081
-		public function widget_css( $advanced = true ) {
1082
-			ob_start();
1083
-			?>
1084
-			<style>
1081
+		    public function widget_css( $advanced = true ) {
1082
+			    ob_start();
1083
+			    ?>
1084
+    			<style>
1085 1085
 				<?php if( $advanced ){ ?>
1086 1086
 				.sd-advanced-setting {
1087 1087
 					display: none;
@@ -1120,26 +1120,26 @@  discard block
 block discarded – undo
1120 1120
 				.elementor-control .sd-argument select[multiple] option{padding:3px}
1121 1121
 			</style>
1122 1122
 			<?php
1123
-			$output = ob_get_clean();
1123
+			    $output = ob_get_clean();
1124 1124
 
1125
-			/*
1125
+			    /*
1126 1126
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1127 1127
 			 */
1128 1128
 
1129
-			return str_replace( array(
1130
-				'<style>',
1131
-				'</style>'
1132
-			), '', $output );
1133
-		}
1129
+			    return str_replace( array(
1130
+				    '<style>',
1131
+				    '</style>'
1132
+			    ), '', $output );
1133
+		    }
1134 1134
 
1135
-		/**
1135
+		    /**
1136 1136
 		 * Gets some JS for the widgets screen.
1137 1137
 		 *
1138 1138
 		 * @return mixed
1139 1139
 		 */
1140
-		public function widget_js() {
1141
-			ob_start();
1142
-			?>
1140
+		    public function widget_js() {
1141
+			    ob_start();
1142
+			    ?>
1143 1143
 			<script>
1144 1144
 
1145 1145
 				/**
@@ -1288,110 +1288,110 @@  discard block
 block discarded – undo
1288 1288
 
1289 1289
 				}
1290 1290
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1291
-			</script>
1291
+    			</script>
1292 1292
 			<?php
1293
-			$output = ob_get_clean();
1293
+			    $output = ob_get_clean();
1294 1294
 
1295
-			/*
1295
+			    /*
1296 1296
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1297 1297
 			 */
1298 1298
 
1299
-			return str_replace( array(
1300
-				'<script>',
1301
-				'</script>'
1302
-			), '', $output );
1303
-		}
1299
+			    return str_replace( array(
1300
+				    '<script>',
1301
+				    '</script>'
1302
+			    ), '', $output );
1303
+		    }
1304 1304
 
1305 1305
 
1306
-		/**
1306
+		    /**
1307 1307
 		 * Set the name from the argument key.
1308 1308
 		 *
1309 1309
 		 * @param $options
1310 1310
 		 *
1311 1311
 		 * @return mixed
1312 1312
 		 */
1313
-		private function add_name_from_key( $options, $arguments = false ) {
1314
-			if ( ! empty( $options['arguments'] ) ) {
1315
-				foreach ( $options['arguments'] as $key => $val ) {
1316
-					$options['arguments'][ $key ]['name'] = $key;
1317
-				}
1318
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1319
-				foreach ( $options as $key => $val ) {
1320
-					$options[ $key ]['name'] = $key;
1321
-				}
1322
-			}
1323
-
1324
-			return $options;
1325
-		}
1326
-
1327
-		/**
1313
+		    private function add_name_from_key( $options, $arguments = false ) {
1314
+			    if ( ! empty( $options['arguments'] ) ) {
1315
+				    foreach ( $options['arguments'] as $key => $val ) {
1316
+					    $options['arguments'][ $key ]['name'] = $key;
1317
+				    }
1318
+			    } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1319
+				    foreach ( $options as $key => $val ) {
1320
+					    $options[ $key ]['name'] = $key;
1321
+				    }
1322
+			    }
1323
+
1324
+			    return $options;
1325
+		    }
1326
+
1327
+		    /**
1328 1328
 		 * Register the parent shortcode.
1329 1329
 		 *
1330 1330
 		 * @since 1.0.0
1331 1331
 		 */
1332
-		public function register_shortcode() {
1333
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1334
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1335
-		}
1332
+		    public function register_shortcode() {
1333
+			    add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1334
+			    add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1335
+		    }
1336 1336
 
1337
-		/**
1337
+		    /**
1338 1338
 		 * Render the shortcode via ajax so we can return it to Gutenberg.
1339 1339
 		 *
1340 1340
 		 * @since 1.0.0
1341 1341
 		 */
1342
-		public function render_shortcode() {
1343
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1344
-			if ( ! current_user_can( 'manage_options' ) ) {
1345
-				wp_die();
1346
-			}
1347
-
1348
-			// we might need the $post value here so lets set it.
1349
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1350
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1351
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1352
-					global $post;
1353
-					$post = $post_obj;
1354
-				}
1355
-			}
1356
-
1357
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1358
-				$is_preview = $this->is_preview();
1359
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1360
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1361
-				$attributes       = '';
1362
-				if ( ! empty( $attributes_array ) ) {
1363
-					foreach ( $attributes_array as $key => $value ) {
1364
-						if ( is_array( $value ) ) {
1365
-							$value = implode( ",", $value );
1366
-						}
1367
-
1368
-						if ( ! empty( $value ) ) {
1369
-							$value = wp_unslash( $value );
1370
-
1371
-							// Encode [ and ].
1372
-							if ( $is_preview ) {
1373
-								$value = $this->encode_shortcodes( $value );
1374
-							}
1375
-						}
1376
-						$attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1377
-					}
1378
-				}
1379
-
1380
-				$shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1381
-
1382
-				$content = do_shortcode( $shortcode );
1383
-
1384
-				// Decode [ and ].
1385
-				if ( ! empty( $content ) && $is_preview ) {
1386
-					$content = $this->decode_shortcodes( $content );
1387
-				}
1388
-
1389
-				echo $content;
1390
-			}
1391
-			wp_die();
1392
-		}
1393
-
1394
-		/**
1342
+		    public function render_shortcode() {
1343
+			    check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1344
+			    if ( ! current_user_can( 'manage_options' ) ) {
1345
+				    wp_die();
1346
+			    }
1347
+
1348
+			    // we might need the $post value here so lets set it.
1349
+			    if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1350
+				    $post_obj = get_post( absint( $_POST['post_id'] ) );
1351
+				    if ( ! empty( $post_obj ) && empty( $post ) ) {
1352
+					    global $post;
1353
+					    $post = $post_obj;
1354
+				    }
1355
+			    }
1356
+
1357
+			    if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1358
+				    $is_preview = $this->is_preview();
1359
+				    $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1360
+				    $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1361
+				    $attributes       = '';
1362
+				    if ( ! empty( $attributes_array ) ) {
1363
+					    foreach ( $attributes_array as $key => $value ) {
1364
+						    if ( is_array( $value ) ) {
1365
+							    $value = implode( ",", $value );
1366
+						    }
1367
+
1368
+						    if ( ! empty( $value ) ) {
1369
+							    $value = wp_unslash( $value );
1370
+
1371
+							    // Encode [ and ].
1372
+							    if ( $is_preview ) {
1373
+								    $value = $this->encode_shortcodes( $value );
1374
+							    }
1375
+						    }
1376
+						    $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1377
+					    }
1378
+				    }
1379
+
1380
+				    $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1381
+
1382
+				    $content = do_shortcode( $shortcode );
1383
+
1384
+				    // Decode [ and ].
1385
+				    if ( ! empty( $content ) && $is_preview ) {
1386
+					    $content = $this->decode_shortcodes( $content );
1387
+				    }
1388
+
1389
+				    echo $content;
1390
+			    }
1391
+			    wp_die();
1392
+		    }
1393
+
1394
+		    /**
1395 1395
 		 * Output the shortcode.
1396 1396
 		 *
1397 1397
 		 * @param array $args
@@ -1399,22 +1399,22 @@  discard block
 block discarded – undo
1399 1399
 		 *
1400 1400
 		 * @return string
1401 1401
 		 */
1402
-		public function shortcode_output( $args = array(), $content = '' ) {
1403
-			$_instance = $args;
1402
+		    public function shortcode_output( $args = array(), $content = '' ) {
1403
+			    $_instance = $args;
1404 1404
 
1405
-			$args = $this->argument_values( $args );
1405
+			    $args = $this->argument_values( $args );
1406 1406
 
1407
-			// add extra argument so we know its a output to gutenberg
1408
-			//$args
1409
-			$args = $this->string_to_bool( $args );
1407
+			    // add extra argument so we know its a output to gutenberg
1408
+			    //$args
1409
+			    $args = $this->string_to_bool( $args );
1410 1410
 
1411
-			// if we have a enclosed shortcode we add it to the special `html` argument
1412
-			if ( ! empty( $content ) ) {
1413
-				$args['html'] = $content;
1414
-			}
1411
+			    // if we have a enclosed shortcode we add it to the special `html` argument
1412
+			    if ( ! empty( $content ) ) {
1413
+				    $args['html'] = $content;
1414
+			    }
1415 1415
 
1416
-			if ( ! $this->is_preview() ) {
1417
-				/**
1416
+			    if ( ! $this->is_preview() ) {
1417
+				    /**
1418 1418
 				 * Filters the settings for a particular widget args.
1419 1419
 				 *
1420 1420
 				 * @param array          $args      The current widget instance's settings.
@@ -1424,95 +1424,95 @@  discard block
 block discarded – undo
1424 1424
 				 *@since 1.0.28
1425 1425
 				 *
1426 1426
 				 */
1427
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1428
-
1429
-				if ( ! is_array( $args ) ) {
1430
-					return $args;
1431
-				}
1432
-			}
1433
-
1434
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1435
-			$class .= " sdel-".$this->get_instance_hash();
1436
-
1437
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1438
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1439
-
1440
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1441
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1442
-
1443
-			$shortcode_args = array();
1444
-			$output         = '';
1445
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1446
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1447
-				$no_wrap = true;
1448
-			}
1449
-			$main_content = $this->output( $args, $shortcode_args, $content );
1450
-			if ( $main_content && ! $no_wrap ) {
1451
-				// wrap the shortcode in a div with the same class as the widget
1452
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1453
-				if ( ! empty( $args['title'] ) ) {
1454
-					// if its a shortcode and there is a title try to grab the title wrappers
1455
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1456
-					if ( empty( $instance ) ) {
1457
-						global $wp_registered_sidebars;
1458
-						if ( ! empty( $wp_registered_sidebars ) ) {
1459
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1460
-								if ( ! empty( $sidebar['before_title'] ) ) {
1461
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1462
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1463
-									break;
1464
-								}
1465
-							}
1466
-						}
1467
-					}
1468
-					$output .= $this->output_title( $shortcode_args, $args );
1469
-				}
1470
-				$output .= $main_content;
1471
-				$output .= '</div>';
1472
-			} elseif ( $main_content && $no_wrap ) {
1473
-				$output .= $main_content;
1474
-			}
1475
-
1476
-			// if preview show a placeholder if empty
1477
-			if ( $this->is_preview() && $output == '' ) {
1478
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1479
-			}
1480
-
1481
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1482
-		}
1483
-
1484
-		/**
1427
+				    $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1428
+
1429
+				    if ( ! is_array( $args ) ) {
1430
+					    return $args;
1431
+				    }
1432
+			    }
1433
+
1434
+			    $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1435
+			    $class .= " sdel-".$this->get_instance_hash();
1436
+
1437
+			    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1438
+			    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1439
+
1440
+			    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1441
+			    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1442
+
1443
+			    $shortcode_args = array();
1444
+			    $output         = '';
1445
+			    $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1446
+			    if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1447
+				    $no_wrap = true;
1448
+			    }
1449
+			    $main_content = $this->output( $args, $shortcode_args, $content );
1450
+			    if ( $main_content && ! $no_wrap ) {
1451
+				    // wrap the shortcode in a div with the same class as the widget
1452
+				    $output .= '<div class="' . $class . '" ' . $attrs . '>';
1453
+				    if ( ! empty( $args['title'] ) ) {
1454
+					    // if its a shortcode and there is a title try to grab the title wrappers
1455
+					    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1456
+					    if ( empty( $instance ) ) {
1457
+						    global $wp_registered_sidebars;
1458
+						    if ( ! empty( $wp_registered_sidebars ) ) {
1459
+							    foreach ( $wp_registered_sidebars as $sidebar ) {
1460
+								    if ( ! empty( $sidebar['before_title'] ) ) {
1461
+									    $shortcode_args['before_title'] = $sidebar['before_title'];
1462
+									    $shortcode_args['after_title']  = $sidebar['after_title'];
1463
+									    break;
1464
+								    }
1465
+							    }
1466
+						    }
1467
+					    }
1468
+					    $output .= $this->output_title( $shortcode_args, $args );
1469
+				    }
1470
+				    $output .= $main_content;
1471
+				    $output .= '</div>';
1472
+			    } elseif ( $main_content && $no_wrap ) {
1473
+				    $output .= $main_content;
1474
+			    }
1475
+
1476
+			    // if preview show a placeholder if empty
1477
+			    if ( $this->is_preview() && $output == '' ) {
1478
+				    $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1479
+			    }
1480
+
1481
+			    return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1482
+		    }
1483
+
1484
+		    /**
1485 1485
 		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1486 1486
 		 *
1487 1487
 		 * @param string $name
1488 1488
 		 *
1489 1489
 		 * @return string
1490 1490
 		 */
1491
-		public function preview_placeholder_text( $name = '' ) {
1492
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1493
-		}
1491
+		    public function preview_placeholder_text( $name = '' ) {
1492
+			    return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1493
+		    }
1494 1494
 
1495
-		/**
1495
+		    /**
1496 1496
 		 * Sometimes booleans values can be turned to strings, so we fix that.
1497 1497
 		 *
1498 1498
 		 * @param $options
1499 1499
 		 *
1500 1500
 		 * @return mixed
1501 1501
 		 */
1502
-		public function string_to_bool( $options ) {
1503
-			// convert bool strings to booleans
1504
-			foreach ( $options as $key => $val ) {
1505
-				if ( $val == 'false' ) {
1506
-					$options[ $key ] = false;
1507
-				} elseif ( $val == 'true' ) {
1508
-					$options[ $key ] = true;
1509
-				}
1510
-			}
1511
-
1512
-			return $options;
1513
-		}
1514
-
1515
-		/**
1502
+		    public function string_to_bool( $options ) {
1503
+			    // convert bool strings to booleans
1504
+			    foreach ( $options as $key => $val ) {
1505
+				    if ( $val == 'false' ) {
1506
+					    $options[ $key ] = false;
1507
+				    } elseif ( $val == 'true' ) {
1508
+					    $options[ $key ] = true;
1509
+				    }
1510
+			    }
1511
+
1512
+			    return $options;
1513
+		    }
1514
+
1515
+		    /**
1516 1516
 		 * Get the argument values that are also filterable.
1517 1517
 		 *
1518 1518
 		 * @param $instance
@@ -1521,163 +1521,163 @@  discard block
 block discarded – undo
1521 1521
 		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1522 1522
 		 *
1523 1523
 		 */
1524
-		public function argument_values( $instance ) {
1525
-			$argument_values = array();
1526
-
1527
-			// set widget instance
1528
-			$this->instance = $instance;
1529
-
1530
-			if ( empty( $this->arguments ) ) {
1531
-				$this->arguments = $this->get_arguments();
1532
-			}
1533
-
1534
-			if ( ! empty( $this->arguments ) ) {
1535
-				foreach ( $this->arguments as $key => $args ) {
1536
-					// set the input name from the key
1537
-					$args['name'] = $key;
1538
-					//
1539
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1540
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1541
-						// don't set default for an empty checkbox
1542
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1543
-						$argument_values[ $key ] = $args['default'];
1544
-					}
1545
-				}
1546
-			}
1547
-
1548
-			return $argument_values;
1549
-		}
1550
-
1551
-		/**
1524
+		    public function argument_values( $instance ) {
1525
+			    $argument_values = array();
1526
+
1527
+			    // set widget instance
1528
+			    $this->instance = $instance;
1529
+
1530
+			    if ( empty( $this->arguments ) ) {
1531
+				    $this->arguments = $this->get_arguments();
1532
+			    }
1533
+
1534
+			    if ( ! empty( $this->arguments ) ) {
1535
+				    foreach ( $this->arguments as $key => $args ) {
1536
+					    // set the input name from the key
1537
+					    $args['name'] = $key;
1538
+					    //
1539
+					    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1540
+					    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1541
+						    // don't set default for an empty checkbox
1542
+					    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1543
+						    $argument_values[ $key ] = $args['default'];
1544
+					    }
1545
+				    }
1546
+			    }
1547
+
1548
+			    return $argument_values;
1549
+		    }
1550
+
1551
+		    /**
1552 1552
 		 * Set arguments in super duper.
1553 1553
 		 *
1554 1554
 		 * @return array Set arguments.
1555 1555
 		 *@since 1.0.0
1556 1556
 		 *
1557 1557
 		 */
1558
-		public function set_arguments() {
1559
-			return $this->arguments;
1560
-		}
1558
+		    public function set_arguments() {
1559
+			    return $this->arguments;
1560
+		    }
1561 1561
 
1562
-		/**
1562
+		    /**
1563 1563
 		 * Get arguments in super duper.
1564 1564
 		 *
1565 1565
 		 * @return array Get arguments.
1566 1566
 		 *@since 1.0.0
1567 1567
 		 *
1568 1568
 		 */
1569
-		public function get_arguments() {
1570
-			if ( empty( $this->arguments ) ) {
1571
-				$this->arguments = $this->set_arguments();
1572
-			}
1569
+		    public function get_arguments() {
1570
+			    if ( empty( $this->arguments ) ) {
1571
+				    $this->arguments = $this->set_arguments();
1572
+			    }
1573 1573
 
1574
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1575
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1574
+			    $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1575
+			    $this->arguments = $this->add_name_from_key( $this->arguments, true );
1576 1576
 
1577
-            if( !empty( $this->arguments['title']['value'] ) ){
1578
-                $this->arguments['title']['value'] = wp_kses_post( $this->arguments['title']['value'] );
1579
-            }
1577
+                if( !empty( $this->arguments['title']['value'] ) ){
1578
+                    $this->arguments['title']['value'] = wp_kses_post( $this->arguments['title']['value'] );
1579
+                }
1580 1580
 
1581
-			return $this->arguments;
1582
-		}
1581
+			    return $this->arguments;
1582
+		    }
1583 1583
 
1584
-		/**
1584
+		    /**
1585 1585
 		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1586 1586
 		 *
1587 1587
 		 * @param array $args
1588 1588
 		 * @param array $widget_args
1589 1589
 		 * @param string $content
1590 1590
 		 */
1591
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1591
+		    public function output( $args = array(), $widget_args = array(), $content = '' ) {
1592 1592
 
1593
-		}
1593
+		    }
1594 1594
 
1595
-		/**
1595
+		    /**
1596 1596
 		 * Add the dynamic block code inline when the wp-block in enqueued.
1597 1597
 		 */
1598
-		public function register_block() {
1599
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1600
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1601
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1602
-			}
1603
-		}
1604
-
1605
-		/**
1598
+		    public function register_block() {
1599
+			    wp_add_inline_script( 'wp-blocks', $this->block() );
1600
+			    if ( class_exists( 'SiteOrigin_Panels' ) ) {
1601
+				    wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1602
+			    }
1603
+		    }
1604
+
1605
+		    /**
1606 1606
 		 * Check if we need to show advanced options.
1607 1607
 		 *
1608 1608
 		 * @return bool
1609 1609
 		 */
1610
-		public function block_show_advanced() {
1610
+		    public function block_show_advanced() {
1611 1611
 
1612
-			$show      = false;
1613
-			$arguments = $this->get_arguments();
1612
+			    $show      = false;
1613
+			    $arguments = $this->get_arguments();
1614 1614
 
1615
-			if ( ! empty( $arguments ) ) {
1616
-				foreach ( $arguments as $argument ) {
1617
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1618
-						$show = true;
1619
-						break; // no need to continue if we know we have it
1620
-					}
1621
-				}
1622
-			}
1615
+			    if ( ! empty( $arguments ) ) {
1616
+				    foreach ( $arguments as $argument ) {
1617
+					    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1618
+						    $show = true;
1619
+						    break; // no need to continue if we know we have it
1620
+					    }
1621
+				    }
1622
+			    }
1623 1623
 
1624
-			return $show;
1625
-		}
1624
+			    return $show;
1625
+		    }
1626 1626
 
1627
-		/**
1627
+		    /**
1628 1628
 		 * Get the url path to the current folder.
1629 1629
 		 *
1630 1630
 		 * @return string
1631 1631
 		 */
1632
-		public function get_url() {
1633
-			$url = $this->url;
1632
+		    public function get_url() {
1633
+			    $url = $this->url;
1634 1634
 
1635
-			if ( ! $url ) {
1636
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1637
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1635
+			    if ( ! $url ) {
1636
+				    $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1637
+				    $content_url = untrailingslashit( WP_CONTENT_URL );
1638 1638
 
1639
-				// Replace http:// to https://.
1640
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1641
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1642
-				}
1639
+				    // Replace http:// to https://.
1640
+				    if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1641
+					    $content_url = str_replace( 'http://', 'https://', $content_url );
1642
+				    }
1643 1643
 
1644
-				// Check if we are inside a plugin
1645
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1646
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1647
-				$url = trailingslashit( $url );
1648
-				$this->url = $url;
1649
-			}
1644
+				    // Check if we are inside a plugin
1645
+				    $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1646
+				    $url = str_replace( $content_dir, $content_url, $file_dir );
1647
+				    $url = trailingslashit( $url );
1648
+				    $this->url = $url;
1649
+			    }
1650 1650
 
1651
-			return $url;
1652
-		}
1651
+			    return $url;
1652
+		    }
1653 1653
 
1654
-		/**
1654
+		    /**
1655 1655
 		 * Get the url path to the current folder.
1656 1656
 		 *
1657 1657
 		 * @return string
1658 1658
 		 */
1659
-		public function get_url_old() {
1659
+		    public function get_url_old() {
1660 1660
 
1661
-			$url = $this->url;
1661
+			    $url = $this->url;
1662 1662
 
1663
-			if ( ! $url ) {
1664
-				// check if we are inside a plugin
1665
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1663
+			    if ( ! $url ) {
1664
+				    // check if we are inside a plugin
1665
+				    $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1666 1666
 
1667
-				$dir_parts = explode( "/wp-content/", $file_dir );
1668
-				$url_parts = explode( "/wp-content/", plugins_url() );
1667
+				    $dir_parts = explode( "/wp-content/", $file_dir );
1668
+				    $url_parts = explode( "/wp-content/", plugins_url() );
1669 1669
 
1670
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1671
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1672
-					$this->url = $url;
1673
-				}
1674
-			}
1670
+				    if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1671
+					    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1672
+					    $this->url = $url;
1673
+				    }
1674
+			    }
1675 1675
 
1676 1676
 
1677
-			return $url;
1678
-		}
1677
+			    return $url;
1678
+		    }
1679 1679
 
1680
-		/**
1680
+		    /**
1681 1681
 		 * Generate the block icon.
1682 1682
 		 *
1683 1683
 		 * Enables the use of Font Awesome icons.
@@ -1689,99 +1689,99 @@  discard block
 block discarded – undo
1689 1689
 		 * @return string
1690 1690
 		 *@since 1.1.0
1691 1691
 		 */
1692
-		public function get_block_icon( $icon ) {
1693
-
1694
-			// check if we have a Font Awesome icon
1695
-			$fa_type = '';
1696
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1697
-				$fa_type = 'solid';
1698
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1699
-				$fa_type = 'regular';
1700
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1701
-				$fa_type = 'brands';
1702
-			} else {
1703
-				$icon = "'" . $icon . "'";
1704
-			}
1692
+		    public function get_block_icon( $icon ) {
1693
+
1694
+			    // check if we have a Font Awesome icon
1695
+			    $fa_type = '';
1696
+			    if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1697
+				    $fa_type = 'solid';
1698
+			    } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1699
+				    $fa_type = 'regular';
1700
+			    } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1701
+				    $fa_type = 'brands';
1702
+			    } else {
1703
+				    $icon = "'" . $icon . "'";
1704
+			    }
1705
+
1706
+			    // set the icon if we found one
1707
+			    if ( $fa_type ) {
1708
+				    $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1709
+				    $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 . "'}))";
1710
+			    }
1711
+
1712
+			    return $icon;
1713
+		    }
1714
+
1715
+		    public function group_arguments( $arguments ) {
1716
+			    if ( ! empty( $arguments ) ) {
1717
+				    $temp_arguments = array();
1718
+				    $general        = __( "General", 'ayecode-connect' );
1719
+				    $add_sections   = false;
1720
+				    foreach ( $arguments as $key => $args ) {
1721
+					    if ( isset( $args['group'] ) ) {
1722
+						    $temp_arguments[ $args['group'] ][ $key ] = $args;
1723
+						    $add_sections                             = true;
1724
+					    } else {
1725
+						    $temp_arguments[ $general ][ $key ] = $args;
1726
+					    }
1727
+				    }
1728
+
1729
+				    // only add sections if more than one
1730
+				    if ( $add_sections ) {
1731
+					    $arguments = $temp_arguments;
1732
+				    }
1733
+			    }
1734
+
1735
+			    return $arguments;
1736
+		    }
1737
+
1738
+		    /**
1739
+		 * Parse used group tabs.
1740
+		 *
1741
+		 * @since 1.1.17
1742
+		 */
1743
+		    public function group_block_tabs( $tabs, $arguments ) {
1744
+			    if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1745
+				    $has_sections = false;
1705 1746
 
1706
-			// set the icon if we found one
1707
-			if ( $fa_type ) {
1708
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1709
-				$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 . "'}))";
1710
-			}
1747
+				    foreach ( $this->arguments as $key => $args ) {
1748
+					    if ( isset( $args['group'] ) ) {
1749
+						    $has_sections = true;
1750
+						    break;
1751
+					    }
1752
+				    }
1711 1753
 
1712
-			return $icon;
1713
-		}
1714
-
1715
-		public function group_arguments( $arguments ) {
1716
-			if ( ! empty( $arguments ) ) {
1717
-				$temp_arguments = array();
1718
-				$general        = __( "General", 'ayecode-connect' );
1719
-				$add_sections   = false;
1720
-				foreach ( $arguments as $key => $args ) {
1721
-					if ( isset( $args['group'] ) ) {
1722
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1723
-						$add_sections                             = true;
1724
-					} else {
1725
-						$temp_arguments[ $general ][ $key ] = $args;
1726
-					}
1727
-				}
1728
-
1729
-				// only add sections if more than one
1730
-				if ( $add_sections ) {
1731
-					$arguments = $temp_arguments;
1732
-				}
1733
-			}
1734
-
1735
-			return $arguments;
1736
-		}
1737
-
1738
-		/**
1739
-		 * Parse used group tabs.
1740
-		 *
1741
-		 * @since 1.1.17
1742
-		 */
1743
-		public function group_block_tabs( $tabs, $arguments ) {
1744
-			if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1745
-				$has_sections = false;
1746
-
1747
-				foreach ( $this->arguments as $key => $args ) {
1748
-					if ( isset( $args['group'] ) ) {
1749
-						$has_sections = true;
1750
-						break;
1751
-					}
1752
-				}
1754
+				    if ( ! $has_sections ) {
1755
+					    return $tabs;
1756
+				    }
1753 1757
 
1754
-				if ( ! $has_sections ) {
1755
-					return $tabs;
1756
-				}
1757
-
1758
-				$new_tabs = array();
1758
+				    $new_tabs = array();
1759 1759
 
1760
-				foreach ( $tabs as $tab_key => $tab ) {
1761
-					$new_groups = array();
1760
+				    foreach ( $tabs as $tab_key => $tab ) {
1761
+					    $new_groups = array();
1762 1762
 
1763
-					if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1764
-						foreach ( $tab['groups'] as $group ) {
1765
-							if ( isset( $arguments[ $group ] ) ) {
1766
-								$new_groups[] = $group;
1767
-							}
1768
-						}
1769
-					}
1763
+					    if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1764
+						    foreach ( $tab['groups'] as $group ) {
1765
+							    if ( isset( $arguments[ $group ] ) ) {
1766
+								    $new_groups[] = $group;
1767
+							    }
1768
+						    }
1769
+					    }
1770 1770
 
1771
-					if ( ! empty( $new_groups ) ) {
1772
-						$tab['groups'] = $new_groups;
1771
+					    if ( ! empty( $new_groups ) ) {
1772
+						    $tab['groups'] = $new_groups;
1773 1773
 
1774
-						$new_tabs[ $tab_key ] = $tab;
1775
-					}
1776
-				}
1774
+						    $new_tabs[ $tab_key ] = $tab;
1775
+					    }
1776
+				    }
1777 1777
 
1778
-				$tabs = $new_tabs;
1779
-			}
1778
+				    $tabs = $new_tabs;
1779
+			    }
1780 1780
 
1781
-			return $tabs;
1782
-		}
1781
+			    return $tabs;
1782
+		    }
1783 1783
 
1784
-		/**
1784
+		    /**
1785 1785
 		 * Output the JS for building the dynamic Guntenberg block.
1786 1786
 		 *
1787 1787
 		 * @return mixed
@@ -1789,18 +1789,18 @@  discard block
 block discarded – undo
1789 1789
 		 * @since 1.1.0 Font Awesome classes can be used for icons.
1790 1790
 		 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1791 1791
 		 */
1792
-		public function block() {
1793
-			global $sd_is_js_functions_loaded, $aui_bs5;
1792
+		    public function block() {
1793
+			    global $sd_is_js_functions_loaded, $aui_bs5;
1794 1794
 
1795
-			$show_advanced = $this->block_show_advanced();
1795
+			    $show_advanced = $this->block_show_advanced();
1796 1796
 
1797
-			ob_start();
1798
-			?>
1799
-			<script>
1797
+			    ob_start();
1798
+			    ?>
1799
+    			<script>
1800 1800
 			<?php
1801
-			if ( ! $sd_is_js_functions_loaded ) {
1802
-				$sd_is_js_functions_loaded = true;
1803
-			?>
1801
+			    if ( ! $sd_is_js_functions_loaded ) {
1802
+				    $sd_is_js_functions_loaded = true;
1803
+			    ?>
1804 1804
 function sd_show_view_options($this){
1805 1805
 	if(jQuery($this).html().length){
1806 1806
 		jQuery($this).html('');
@@ -2300,8 +2300,8 @@  discard block
 block discarded – undo
2300 2300
 				$classes = [];
2301 2301
 
2302 2302
 				<?php
2303
-				if($aui_bs5){
2304
-					?>
2303
+				    if($aui_bs5){
2304
+					    ?>
2305 2305
 				$aui_bs5 = true;
2306 2306
 				$p_ml = 'ms-';
2307 2307
 				$p_mr = 'me-';
@@ -2309,8 +2309,8 @@  discard block
 block discarded – undo
2309 2309
 				$p_pl = 'ps-';
2310 2310
 				$p_pr = 'pe-';
2311 2311
 					<?php
2312
-				}else{
2313
-						?>
2312
+				    }else{
2313
+						    ?>
2314 2314
 				$aui_bs5 = false;
2315 2315
 				$p_ml = 'ml-';
2316 2316
 				$p_mr = 'mr-';
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
 				$p_pl = 'pl-';
2319 2319
 				$p_pr = 'pr-';
2320 2320
 					<?php
2321
-				}
2322
-				?>
2321
+				    }
2322
+				    ?>
2323 2323
 
2324 2324
 				// margins
2325 2325
 				if ( $args['mt'] !== undefined && $args['mt'] !== '' ) { $classes.push( "mt-" + $args['mt'] );  $mt = $args['mt']; }else{$mt = null;}
@@ -2503,12 +2503,12 @@  discard block
 block discarded – undo
2503 2503
 			<?php
2504 2504
 
2505 2505
 
2506
-			}
2506
+			    }
2507 2507
 
2508
-			if(method_exists($this,'block_global_js')){
2509
-					echo $this->block_global_js();
2510
-			}
2511
-			?>
2508
+			    if(method_exists($this,'block_global_js')){
2509
+					    echo $this->block_global_js();
2510
+			    }
2511
+			    ?>
2512 2512
 
2513 2513
 jQuery(function() {
2514 2514
 
@@ -2561,13 +2561,13 @@  discard block
 block discarded – undo
2561 2561
 						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/.
2562 2562
 						supports: {
2563 2563
 							<?php
2564
-							if(!isset($this->options['block-supports']['renaming'])){
2565
-								$this->options['block-supports']['renaming'] = false;
2566
-							}
2567
-							if ( isset( $this->options['block-supports'] ) ) {
2568
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2569
-							}
2570
-							?>
2564
+							    if(!isset($this->options['block-supports']['renaming'])){
2565
+								    $this->options['block-supports']['renaming'] = false;
2566
+							    }
2567
+							    if ( isset( $this->options['block-supports'] ) ) {
2568
+								    echo $this->array_to_attributes( $this->options['block-supports'] );
2569
+							    }
2570
+							    ?>
2571 2571
 						},
2572 2572
 						__experimentalLabel( attributes, { context } ) {
2573 2573
 							var visibility_html = attributes && attributes.visibility_conditions ? ' &#128065;' : '';
@@ -2577,162 +2577,162 @@  discard block
 block discarded – undo
2577 2577
 						},
2578 2578
 						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.
2579 2579
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2580
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2581
-						}
2582
-
2583
-
2584
-						// block hover preview.
2585
-						$example_args = array();
2586
-						if(!empty($this->arguments)){
2587
-							foreach($this->arguments as $key => $a_args){
2588
-								if(isset($a_args['example'])){
2589
-									$example_args[$key] = $a_args['example'];
2590
-								}
2591
-							}
2592
-						}
2593
-						$viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2594
-						$example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2595
-						if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2596
-							// no preview if set to false
2597
-						}elseif( !empty( $example_args ) ){
2598
-							echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2599
-						}elseif( !empty( $this->options['example'] ) ){
2600
-							unset($this->options['example']['viewportWidth']);
2601
-							unset($this->options['example']['innerBlocks']);
2602
-							$example_atts = $this->array_to_attributes( $this->options['example'] );
2603
-							$example_parts = array();
2604
-							if($example_atts){
2605
-								$example_parts[] = rtrim($example_atts,",");
2606
-							}
2607
-							if($viewport_width){
2608
-								$example_parts[] = $viewport_width;
2609
-							}
2610
-							if($example_inner_blocks){
2611
-								$example_parts[] = $example_inner_blocks;
2612
-							}
2613
-							if(!empty($example_parts)){
2614
-								echo "example : {".implode(',', $example_parts)."},";
2615
-							}
2616
-						}else{
2617
-							echo 'example : {viewportWidth: 500},';
2618
-						}
2619
-
2620
-
2621
-
2622
-						// limit to parent
2623
-						if( !empty( $this->options['parent'] ) ){
2624
-							echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2625
-						}
2626
-
2627
-						// limit allowed blocks
2628
-						if( !empty( $this->options['allowed-blocks'] ) ){
2629
-							echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2630
-						}
2631
-
2632
-						// maybe set no_wrap
2633
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2634
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2635
-							$no_wrap = true;
2636
-						}
2637
-						if ( $no_wrap ) {
2638
-							$this->options['block-wrap'] = '';
2639
-						}
2640
-
2641
-						// Maybe load the drag/drop functions.
2642
-						$img_drag_drop = false;
2643
-						$show_alignment = false;
2580
+						    echo "keywords : " . $this->options['block-keywords'] . ",";
2581
+						    }
2582
+
2583
+
2584
+						    // block hover preview.
2585
+						    $example_args = array();
2586
+						    if(!empty($this->arguments)){
2587
+							    foreach($this->arguments as $key => $a_args){
2588
+								    if(isset($a_args['example'])){
2589
+									    $example_args[$key] = $a_args['example'];
2590
+								    }
2591
+							    }
2592
+						    }
2593
+						    $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2594
+						    $example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2595
+						    if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2596
+							    // no preview if set to false
2597
+						    }elseif( !empty( $example_args ) ){
2598
+							    echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2599
+						    }elseif( !empty( $this->options['example'] ) ){
2600
+							    unset($this->options['example']['viewportWidth']);
2601
+							    unset($this->options['example']['innerBlocks']);
2602
+							    $example_atts = $this->array_to_attributes( $this->options['example'] );
2603
+							    $example_parts = array();
2604
+							    if($example_atts){
2605
+								    $example_parts[] = rtrim($example_atts,",");
2606
+							    }
2607
+							    if($viewport_width){
2608
+								    $example_parts[] = $viewport_width;
2609
+							    }
2610
+							    if($example_inner_blocks){
2611
+								    $example_parts[] = $example_inner_blocks;
2612
+							    }
2613
+							    if(!empty($example_parts)){
2614
+								    echo "example : {".implode(',', $example_parts)."},";
2615
+							    }
2616
+						    }else{
2617
+							    echo 'example : {viewportWidth: 500},';
2618
+						    }
2619
+
2620
+
2621
+
2622
+						    // limit to parent
2623
+						    if( !empty( $this->options['parent'] ) ){
2624
+							    echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2625
+						    }
2626
+
2627
+						    // limit allowed blocks
2628
+						    if( !empty( $this->options['allowed-blocks'] ) ){
2629
+							    echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2630
+						    }
2631
+
2632
+						    // maybe set no_wrap
2633
+						    $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2634
+						    if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2635
+							    $no_wrap = true;
2636
+						    }
2637
+						    if ( $no_wrap ) {
2638
+							    $this->options['block-wrap'] = '';
2639
+						    }
2640
+
2641
+						    // Maybe load the drag/drop functions.
2642
+						    $img_drag_drop = false;
2643
+						    $show_alignment = false;
2644 2644
 	
2645
-							echo "attributes : {";
2646
-
2647
-							if ( $show_advanced ) {
2648
-								echo "show_advanced: {";
2649
-								echo "  type: 'boolean',";
2650
-								echo "  default: false";
2651
-								echo "},";
2652
-							}
2653
-
2654
-							// Block wrap element
2655
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2656
-								echo "block_wrap: {";
2657
-								echo "  type: 'string',";
2658
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "'";
2659
-								echo "},";
2660
-							}
2661
-
2662
-							if ( ! empty( $this->arguments ) ) {
2663
-								foreach ( $this->arguments as $key => $args ) {
2664
-									if ( $args['type'] == 'image' ||  $args['type'] == 'images' ) {
2665
-										$img_drag_drop = true;
2666
-									}
2667
-
2668
-									// Set if we should show alignment.
2669
-									if ( $key == 'alignment' ) {
2670
-										$show_alignment = true;
2671
-									}
2672
-
2673
-									$extra = '';
2674
-									$_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : '';
2675
-
2676
-									if ( ! empty( $_default ) ) {
2677
-										$_default = wp_slash( $_default );
2678
-									}
2679
-
2680
-									if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2681
-										continue;
2682
-									} else if ( $args['type'] == 'checkbox' ) {
2683
-										$type    = 'boolean';
2684
-										$default = $_default ? 'true' : 'false';
2685
-									} else if ( $args['type'] == 'number' ) {
2686
-										$type    = 'number';
2687
-										$default = "'" . $_default . "'";
2688
-									} else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2689
-										$type = 'array';
2690
-										if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2691
-											$default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]";
2692
-										} else {
2693
-											$default = "'" . $_default . "'";
2694
-										}
2695
-									} else if ( $args['type'] == 'tagselect' ) {
2696
-										$type    = 'array';
2697
-										$default = "'" . $_default . "'";
2698
-									} else if ( $args['type'] == 'multiselect' ) {
2699
-										$type    = 'array';
2700
-										$default = "'" . $_default . "'";
2701
-									} else if ( $args['type'] == 'image_xy' ) {
2702
-										$type    = 'object';
2703
-										$default = "'" . $_default . "'";
2704
-									} else if ( $args['type'] == 'image' ) {
2705
-										$type    = 'string';
2706
-										$default = "'" . $_default . "'";
2707
-									} else {
2708
-										$type    = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string';
2709
-										$default = "'" . $_default . "'";
2710
-									}
2711
-
2712
-									echo $key . " : {";
2713
-									echo "type : '$type',";
2714
-									echo "default : $default";
2715
-									echo "},";
2716
-								}
2717
-							}
2718
-
2719
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2720
-							echo "sd_shortcode : {type : 'string',default: ''},";
2721
-
2722
-							if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) {
2723
-								echo "sd_shortcode_close : {type : 'string',default: ''},";
2724
-							}
2725
-
2726
-							echo "className: { type: 'string', default: '' }";
2727
-							echo "},";
2728
-						?>
2645
+							    echo "attributes : {";
2646
+
2647
+							    if ( $show_advanced ) {
2648
+								    echo "show_advanced: {";
2649
+								    echo "  type: 'boolean',";
2650
+								    echo "  default: false";
2651
+								    echo "},";
2652
+							    }
2653
+
2654
+							    // Block wrap element
2655
+							    if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2656
+								    echo "block_wrap: {";
2657
+								    echo "  type: 'string',";
2658
+								    echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "'";
2659
+								    echo "},";
2660
+							    }
2661
+
2662
+							    if ( ! empty( $this->arguments ) ) {
2663
+								    foreach ( $this->arguments as $key => $args ) {
2664
+									    if ( $args['type'] == 'image' ||  $args['type'] == 'images' ) {
2665
+										    $img_drag_drop = true;
2666
+									    }
2667
+
2668
+									    // Set if we should show alignment.
2669
+									    if ( $key == 'alignment' ) {
2670
+										    $show_alignment = true;
2671
+									    }
2672
+
2673
+									    $extra = '';
2674
+									    $_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : '';
2675
+
2676
+									    if ( ! empty( $_default ) ) {
2677
+										    $_default = wp_slash( $_default );
2678
+									    }
2679
+
2680
+									    if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2681
+										    continue;
2682
+									    } else if ( $args['type'] == 'checkbox' ) {
2683
+										    $type    = 'boolean';
2684
+										    $default = $_default ? 'true' : 'false';
2685
+									    } else if ( $args['type'] == 'number' ) {
2686
+										    $type    = 'number';
2687
+										    $default = "'" . $_default . "'";
2688
+									    } else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2689
+										    $type = 'array';
2690
+										    if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2691
+											    $default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]";
2692
+										    } else {
2693
+											    $default = "'" . $_default . "'";
2694
+										    }
2695
+									    } else if ( $args['type'] == 'tagselect' ) {
2696
+										    $type    = 'array';
2697
+										    $default = "'" . $_default . "'";
2698
+									    } else if ( $args['type'] == 'multiselect' ) {
2699
+										    $type    = 'array';
2700
+										    $default = "'" . $_default . "'";
2701
+									    } else if ( $args['type'] == 'image_xy' ) {
2702
+										    $type    = 'object';
2703
+										    $default = "'" . $_default . "'";
2704
+									    } else if ( $args['type'] == 'image' ) {
2705
+										    $type    = 'string';
2706
+										    $default = "'" . $_default . "'";
2707
+									    } else {
2708
+										    $type    = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string';
2709
+										    $default = "'" . $_default . "'";
2710
+									    }
2711
+
2712
+									    echo $key . " : {";
2713
+									    echo "type : '$type',";
2714
+									    echo "default : $default";
2715
+									    echo "},";
2716
+								    }
2717
+							    }
2718
+
2719
+							    echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2720
+							    echo "sd_shortcode : {type : 'string',default: ''},";
2721
+
2722
+							    if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) {
2723
+								    echo "sd_shortcode_close : {type : 'string',default: ''},";
2724
+							    }
2725
+
2726
+							    echo "className: { type: 'string', default: '' }";
2727
+							    echo "},";
2728
+						    ?>
2729 2729
 						// The "edit" property must be a valid function.
2730 2730
 						edit: function (props) {
2731 2731
 							const selectedBlock = wp.data.select('core/block-editor').getSelectedBlock();
2732 2732
 <?php
2733
-// only include the drag/drop functions if required.
2734
-if ( $img_drag_drop ) {
2735
-?>
2733
+    // only include the drag/drop functions if required.
2734
+    if ( $img_drag_drop ) {
2735
+    ?>
2736 2736
 
2737 2737
 function enableDragSort(listClass) {
2738 2738
 	setTimeout(function(){
@@ -2796,10 +2796,10 @@  discard block
 block discarded – undo
2796 2796
 							}
2797 2797
 
2798 2798
 							<?php
2799
-							if(!empty($this->options['block-edit-raw'])) {
2800
-								echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2801
-							}else{
2802
-							?>
2799
+							    if(!empty($this->options['block-edit-raw'])) {
2800
+								    echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2801
+							    }else{
2802
+							    ?>
2803 2803
 
2804 2804
 function hasSelectedInnerBlock(props) {
2805 2805
 	const select = wp.data.select('core/editor');
@@ -2821,9 +2821,9 @@  discard block
 block discarded – undo
2821 2821
 
2822 2822
 	var $value = '';
2823 2823
 	<?php
2824
-	// if we have a post_type and a category then link them
2825
-	if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2826
-	?>
2824
+	    // if we have a post_type and a category then link them
2825
+	    if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2826
+	    ?>
2827 2827
 	if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){
2828 2828
 		$pt = props.attributes.post_type;
2829 2829
 		if(post_type_rest_slugs.length){
@@ -2836,12 +2836,12 @@  discard block
 block discarded – undo
2836 2836
 			term_query_type = $pt;
2837 2837
 		}
2838 2838
 <?php
2839
-	$cat_path = '';
2840
-	if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2841
-		$cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2842
-		$cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2843
-	}
2844
-?>
2839
+	    $cat_path = '';
2840
+	    if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2841
+		    $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2842
+		    $cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2843
+	    }
2844
+    ?>
2845 2845
 		/* taxonomies */
2846 2846
 		if($value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run){
2847 2847
 			if (!window.gdCPTCats) {
@@ -2929,12 +2929,12 @@  discard block
 block discarded – undo
2929 2929
 		}
2930 2930
 	}
2931 2931
 	<?php } ?>
2932
-<?php
2933
-$current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2934
-if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2935
-	echo 'const { deviceType } = "";';
2932
+    <?php
2933
+    $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2934
+    if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2935
+	    echo 'const { deviceType } = "";';
2936 2936
 }else{
2937
-?>
2937
+    ?>
2938 2938
 /** Get device type const. */
2939 2939
 const wpVersion = '<?php global $wp_version; echo esc_attr($wp_version); ?>';
2940 2940
 const { deviceType } = typeof wp.data.useSelect !== 'undefined' ? wp.data.useSelect(select => {
@@ -2986,8 +2986,8 @@  discard block
 block discarded – undo
2986 2986
 										'attributes': props.attributes,
2987 2987
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2988 2988
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2989
-										echo $post->ID;
2990
-									}else{echo '0';}?>,
2989
+										    echo $post->ID;
2990
+									    }else{echo '0';}?>,
2991 2991
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2992 2992
 									};
2993 2993
 
@@ -3000,20 +3000,20 @@  discard block
 block discarded – undo
3000 3000
 										}
3001 3001
 
3002 3002
 										 <?php
3003
-										if(!empty($this->options['nested-block'])){
3004
-											?>
3003
+										    if(!empty($this->options['nested-block'])){
3004
+											    ?>
3005 3005
 											// props.setAttributes({content: env});
3006 3006
 										is_fetching = false;
3007 3007
 										prev_attributes[props.clientId] = props.attributes;
3008 3008
 											 <?php
3009
-										}else{
3010
-										?>
3009
+										    }else{
3010
+										    ?>
3011 3011
 										props.setAttributes({content: env});
3012 3012
 										is_fetching = false;
3013 3013
 										prev_attributes[props.clientId] = props.attributes;
3014 3014
 										<?php
3015
-										}
3016
-										?>
3015
+										    }
3016
+										    ?>
3017 3017
 
3018 3018
 										// if AUI is active call the js init function
3019 3019
 										if (typeof aui_init === "function") {
@@ -3026,29 +3026,29 @@  discard block
 block discarded – undo
3026 3026
 							}
3027 3027
 
3028 3028
 							<?php
3029
-							if(!empty($this->options['block-edit-js'])) {
3030
-								echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3031
-							}
3029
+							    if(!empty($this->options['block-edit-js'])) {
3030
+								    echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3031
+							    }
3032 3032
 
3033
-							if(empty($this->options['block-save-return'])){
3034
-							?>
3033
+							    if(empty($this->options['block-save-return'])){
3034
+							    ?>
3035 3035
 								///////////////////////////////////////////////////////////////////////
3036 3036
 
3037 3037
 								// build the shortcode.
3038 3038
 								shortcode = "[<?php echo $this->options['base_id'];?>";
3039 3039
 								<?php
3040 3040
 
3041
-								if(! empty( $this->arguments )){
3041
+								    if(! empty( $this->arguments )){
3042 3042
 
3043
-								foreach($this->arguments as $key => $args){
3044
-								   // if($args['type']=='tabs'){continue;}
3043
+								    foreach($this->arguments as $key => $args){
3044
+								       // if($args['type']=='tabs'){continue;}
3045 3045
 
3046
-								   // don't add metadata arguments
3047
-								   if (substr($key, 0, 9 ) === 'metadata_') {
3048
-									   continue;
3049
-								   }
3050
-								?>
3051
-								if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3046
+								       // don't add metadata arguments
3047
+								       if (substr($key, 0, 9 ) === 'metadata_') {
3048
+									       continue;
3049
+								       }
3050
+								    ?>
3051
+    								if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3052 3052
 									if ('<?php echo esc_attr( $key );?>' == 'html') {
3053 3053
 									} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
3054 3054
 										shortcode += props.attributes.<?php echo esc_attr( $key );?>.length && ( props.attributes.<?php echo esc_attr( $key );?>.x.length || props.attributes.<?php echo esc_attr( $key );?>.y.length ) ? " <?php echo esc_attr( $key );?>='{x:" + props.attributes.<?php echo esc_attr( $key );?>.x + ",y:"+props.attributes.<?php echo esc_attr( $key );?>.y +"}' " : "";
@@ -3058,10 +3058,10 @@  discard block
 block discarded – undo
3058 3058
 									}
3059 3059
 								}
3060 3060
 								<?php
3061
-								}
3062
-								}
3061
+								    }
3062
+								    }
3063 3063
 
3064
-								?>
3064
+								    ?>
3065 3065
 								shortcode += "]";
3066 3066
 
3067 3067
 								if(shortcode){
@@ -3073,17 +3073,17 @@  discard block
 block discarded – undo
3073 3073
 
3074 3074
 
3075 3075
 									<?php
3076
-									if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3077
-										echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3078
-									}
3079
-									?>
3076
+									    if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3077
+										    echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3078
+									    }
3079
+									    ?>
3080 3080
 								}
3081 3081
 
3082 3082
 
3083 3083
 							///////////////////////////////////////////////////////////////////////
3084 3084
 							<?php
3085
-							} // end nested block check
3086
-							?>
3085
+							    } // end nested block check
3086
+							    ?>
3087 3087
 
3088 3088
 							return [
3089 3089
 
@@ -3107,10 +3107,10 @@  discard block
 block discarded – undo
3107 3107
 
3108 3108
 									<?php
3109 3109
 
3110
-									if(! empty( $this->arguments )){
3110
+									    if(! empty( $this->arguments )){
3111 3111
 
3112
-									if ( $show_advanced ) {
3113
-									?>
3112
+									    if ( $show_advanced ) {
3113
+									    ?>
3114 3114
 									el('div', {
3115 3115
 											style: {'padding-left': '16px','padding-right': '16px'}
3116 3116
 										},
@@ -3127,133 +3127,133 @@  discard block
 block discarded – undo
3127 3127
 									)
3128 3128
 									,
3129 3129
 									<?php
3130
-									}
3131
-
3132
-									$arguments = $this->group_arguments( $this->arguments );
3133
-									$block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3134
-
3135
-									// Do we have sections?
3136
-									$has_sections = $arguments == $this->arguments ? false : true;
3137
-
3138
-									if($has_sections){
3139
-									$panel_count = 0;
3140
-									$open_tab = '';
3141
-
3142
-									$open_tab_groups = array();
3143
-									$used_tabs = array();
3144
-
3145
-									foreach ( $arguments as $key => $args ) {
3146
-										$close_tab = false;
3147
-										$close_tabs = false;
3148
-
3149
-										 if ( ! empty( $block_group_tabs ) ) {
3150
-											foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3151
-												if ( in_array( $key, $tab_args['groups'] ) ) {
3152
-													$open_tab_groups[] = $key;
3153
-
3154
-													if ( $open_tab != $tab_name ) {
3155
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3156
-														$tab_args['tab']['open'] = true;
3157
-
3158
-														$this->block_tab_start( '', $tab_args );
3159
-														$open_tab = $tab_name;
3160
-														$used_tabs[] = $tab_name;
3161
-													}
3162
-
3163
-													if ( $open_tab_groups == $tab_args['groups'] ) {
3164
-														$close_tab = true;
3165
-														$open_tab_groups = array();
3166
-
3167
-														if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3168
-															$close_tabs = true;
3169
-														}
3170
-													}
3171
-												}
3172
-											}
3173
-										}
3174
-										?>
3130
+									    }
3131
+
3132
+									    $arguments = $this->group_arguments( $this->arguments );
3133
+									    $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3134
+
3135
+									    // Do we have sections?
3136
+									    $has_sections = $arguments == $this->arguments ? false : true;
3137
+
3138
+									    if($has_sections){
3139
+									    $panel_count = 0;
3140
+									    $open_tab = '';
3141
+
3142
+									    $open_tab_groups = array();
3143
+									    $used_tabs = array();
3144
+
3145
+									    foreach ( $arguments as $key => $args ) {
3146
+										    $close_tab = false;
3147
+										    $close_tabs = false;
3148
+
3149
+										     if ( ! empty( $block_group_tabs ) ) {
3150
+											    foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3151
+												    if ( in_array( $key, $tab_args['groups'] ) ) {
3152
+													    $open_tab_groups[] = $key;
3153
+
3154
+													    if ( $open_tab != $tab_name ) {
3155
+														    $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3156
+														    $tab_args['tab']['open'] = true;
3157
+
3158
+														    $this->block_tab_start( '', $tab_args );
3159
+														    $open_tab = $tab_name;
3160
+														    $used_tabs[] = $tab_name;
3161
+													    }
3162
+
3163
+													    if ( $open_tab_groups == $tab_args['groups'] ) {
3164
+														    $close_tab = true;
3165
+														    $open_tab_groups = array();
3166
+
3167
+														    if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3168
+															    $close_tabs = true;
3169
+														    }
3170
+													    }
3171
+												    }
3172
+											    }
3173
+										    }
3174
+										    ?>
3175 3175
 										el(wp.components.PanelBody, {
3176 3176
 												title: '<?php esc_attr_e( $key ); ?>',
3177 3177
 												initialOpen: <?php if ( $panel_count ) {
3178
-												echo "false";
3179
-											} else {
3180
-												echo "true";
3181
-											}?>
3182
-											},
3178
+												    echo "false";
3179
+											    } else {
3180
+												    echo "true";
3181
+											    }?>
3182
+    											},
3183 3183
 											<?php
3184
-											foreach ( $args as $k => $a ) {
3185
-												$this->block_tab_start( $k, $a );
3186
-												$this->block_row_start( $k, $a );
3187
-												$this->build_block_arguments( $k, $a );
3188
-												$this->block_row_end( $k, $a );
3189
-												$this->block_tab_end( $k, $a );
3190
-											}
3191
-											?>
3192
-										),
3184
+											    foreach ( $args as $k => $a ) {
3185
+												    $this->block_tab_start( $k, $a );
3186
+												    $this->block_row_start( $k, $a );
3187
+												    $this->build_block_arguments( $k, $a );
3188
+												    $this->block_row_end( $k, $a );
3189
+												    $this->block_tab_end( $k, $a );
3190
+											    }
3191
+											    ?>
3192
+    										),
3193 3193
 										<?php
3194
-										$panel_count ++;
3195
-
3196
-										if($close_tab || $close_tabs){
3197
-											$tab_args = array(
3198
-												'tab'	=> array(
3199
-													'tabs_close' => $close_tabs,
3200
-												'close' => true,
3201
-												)
3202
-
3203
-											);
3204
-											$this->block_tab_end( '', $tab_args );
3205
-//											echo '###close'; print_r($tab_args);
3206
-											$panel_count = 0;
3207
-										}
3208
-//
3209
-
3210
-									}
3211
-									}else {
3212
-									?>
3194
+										    $panel_count ++;
3195
+
3196
+										    if($close_tab || $close_tabs){
3197
+											    $tab_args = array(
3198
+												    'tab'	=> array(
3199
+													    'tabs_close' => $close_tabs,
3200
+												    'close' => true,
3201
+												    )
3202
+
3203
+											    );
3204
+											    $this->block_tab_end( '', $tab_args );
3205
+    //											echo '###close'; print_r($tab_args);
3206
+											    $panel_count = 0;
3207
+										    }
3208
+    //
3209
+
3210
+									    }
3211
+									    }else {
3212
+									    ?>
3213 3213
 									el(wp.components.PanelBody, {
3214 3214
 											title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>',
3215 3215
 											initialOpen: true
3216 3216
 										},
3217 3217
 										<?php
3218
-										foreach ( $this->arguments as $key => $args ) {
3219
-											$this->block_row_start( $key, $args );
3220
-											$this->build_block_arguments( $key, $args );
3221
-											$this->block_row_end( $key, $args );
3222
-										}
3223
-										?>
3224
-									),
3218
+										    foreach ( $this->arguments as $key => $args ) {
3219
+											    $this->block_row_start( $key, $args );
3220
+											    $this->build_block_arguments( $key, $args );
3221
+											    $this->block_row_end( $key, $args );
3222
+										    }
3223
+										    ?>
3224
+    									),
3225 3225
 									<?php
3226
-									}
3226
+									    }
3227 3227
 
3228
-									}
3229
-									?>
3228
+									    }
3229
+									    ?>
3230 3230
 
3231 3231
 								),
3232 3232
 
3233 3233
 								<?php
3234
-								// If the user sets block-output array then build it
3235
-								if ( ! empty( $this->options['block-output'] ) ) {
3236
-								$this->block_element( $this->options['block-output'] );
3237
-							}elseif(!empty($this->options['block-edit-return'])){
3238
-								   echo $this->options['block-edit-return'];
3239
-							}else{
3240
-								// if no block-output is set then we try and get the shortcode html output via ajax.
3241
-								$block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3242
-								?>
3243
-								el('<?php echo esc_attr($block_edit_wrap_tag); ?>', wp.blockEditor.useBlockProps({
3234
+								    // If the user sets block-output array then build it
3235
+								    if ( ! empty( $this->options['block-output'] ) ) {
3236
+								    $this->block_element( $this->options['block-output'] );
3237
+							    }elseif(!empty($this->options['block-edit-return'])){
3238
+								       echo $this->options['block-edit-return'];
3239
+							    }else{
3240
+								    // if no block-output is set then we try and get the shortcode html output via ajax.
3241
+								    $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3242
+								    ?>
3243
+    								el('<?php echo esc_attr($block_edit_wrap_tag); ?>', wp.blockEditor.useBlockProps({
3244 3244
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
3245 3245
 									className: props.className,
3246 3246
 									<?php //if(isset($this->arguments['visibility_conditions'])){ echo 'dataVisibilityConditionSD: props.visibility_conditions ? true : false,';} //@todo we need to implement this in the other outputs also ?>
3247 3247
 									style: {'minHeight': '30px'}
3248 3248
 								}))
3249 3249
 								<?php
3250
-								}
3251
-								?>
3252
-							]; // end return
3250
+								    }
3251
+								    ?>
3252
+    							]; // end return
3253 3253
 
3254 3254
 							<?php
3255
-							} // end block-edit-raw else
3256
-							?>
3255
+							    } // end block-edit-raw else
3256
+							    ?>
3257 3257
 						},
3258 3258
 
3259 3259
 						// The "save" property must be specified and must be a valid function.
@@ -3267,17 +3267,17 @@  discard block
 block discarded – undo
3267 3267
 							$html = '';
3268 3268
 							<?php
3269 3269
 
3270
-							if(! empty( $this->arguments )){
3270
+							    if(! empty( $this->arguments )){
3271 3271
 
3272
-							foreach($this->arguments as $key => $args){
3273
-							   // if($args['type']=='tabs'){continue;}
3272
+							    foreach($this->arguments as $key => $args){
3273
+							       // if($args['type']=='tabs'){continue;}
3274 3274
 
3275
-							   // don't add metadata arguments
3276
-							   if (substr($key, 0, 9 ) === 'metadata_') {
3277
-								   continue;
3278
-							   }
3279
-							?>
3280
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3275
+							       // don't add metadata arguments
3276
+							       if (substr($key, 0, 9 ) === 'metadata_') {
3277
+								       continue;
3278
+							       }
3279
+							    ?>
3280
+    							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3281 3281
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
3282 3282
 									$html = attr.<?php echo esc_attr( $key );?>;
3283 3283
 								} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
@@ -3287,20 +3287,20 @@  discard block
 block discarded – undo
3287 3287
 								}
3288 3288
 							}
3289 3289
 							<?php
3290
-							}
3291
-							}
3290
+							    }
3291
+							    }
3292 3292
 
3293
-							?>
3293
+							    ?>
3294 3294
 							content += "]";
3295 3295
 							 content = '';
3296 3296
 
3297 3297
 							<?php
3298
-//                            if(!empty($this->options['nested-block'])){
3299
-//                                ?>
3298
+    //                            if(!empty($this->options['nested-block'])){
3299
+    //                                ?>
3300 3300
 //                                $html = 'el( InnerBlocks.Content )';
3301 3301
 //                                <?php
3302
-//                            }
3303
-							?>
3302
+    //                            }
3303
+							    ?>
3304 3304
 							// if has html element
3305 3305
 							if ($html) {
3306 3306
 								//content += $html + "[/<?php echo $this->options['base_id'];?>]";
@@ -3320,38 +3320,38 @@  discard block
 block discarded – undo
3320 3320
 							}
3321 3321
 
3322 3322
 							<?php
3323
-//							if(!empty($this->options['nested-block'])){
3324
-//                                ?x>
3325
-//                              return el(
3326
-//                                    'div',
3327
-//                                    { className: props.className,
3328
-//                                        style: {'minHeight': '300px','position':'relative','overflow':'hidden','backgroundImage': 'url(https://s.w.org/images/core/5.5/don-quixote-06.jpg)'}
3329
-//                                    },
3330
-//                                    el( InnerBlocks.Content ),
3331
-//                                    el('div', {dangerouslySetInnerHTML: {__html: content}, className: align})
3332
-//                                );
3333
-//                                <x?php
3334
-//							}else
3335
-
3336
-							if(!empty($this->options['block-output'])){
3337
-//                               echo "return";
3338
-//                               $this->block_element( $this->options['block-output'], true );
3339
-//                               echo ";";
3340
-
3341
-							   ?>
3323
+    //							if(!empty($this->options['nested-block'])){
3324
+    //                                ?x>
3325
+    //                              return el(
3326
+    //                                    'div',
3327
+    //                                    { className: props.className,
3328
+    //                                        style: {'minHeight': '300px','position':'relative','overflow':'hidden','backgroundImage': 'url(https://s.w.org/images/core/5.5/don-quixote-06.jpg)'}
3329
+    //                                    },
3330
+    //                                    el( InnerBlocks.Content ),
3331
+    //                                    el('div', {dangerouslySetInnerHTML: {__html: content}, className: align})
3332
+    //                                );
3333
+    //                                <x?php
3334
+    //							}else
3335
+
3336
+							    if(!empty($this->options['block-output'])){
3337
+    //                               echo "return";
3338
+    //                               $this->block_element( $this->options['block-output'], true );
3339
+    //                               echo ";";
3340
+
3341
+							       ?>
3342 3342
 							  return el(
3343 3343
 								   '',
3344 3344
 								   {},
3345 3345
 								  // el('', {dangerouslySetInnerHTML: {__html: content}}),
3346 3346
 								   <?php $this->block_element( $this->options['block-output'], true ); ?>
3347
-								  // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3347
+    								  // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3348 3348
 							   );
3349 3349
 								<?php
3350 3350
 
3351
-							}elseif(!empty($this->options['block-save-return'])){
3352
-								   echo 'return ' . $this->options['block-save-return'];
3353
-							}elseif(!empty($this->options['nested-block'])){
3354
-								?>
3351
+							    }elseif(!empty($this->options['block-save-return'])){
3352
+								       echo 'return ' . $this->options['block-save-return'];
3353
+							    }elseif(!empty($this->options['nested-block'])){
3354
+								    ?>
3355 3355
 							  return el(
3356 3356
 								   '',
3357 3357
 								   {},
@@ -3360,22 +3360,22 @@  discard block
 block discarded – undo
3360 3360
 								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3361 3361
 							   );
3362 3362
 								<?php
3363
-							}elseif(!empty( $this->options['block-save-return'] ) ){
3364
-								echo "return ". $this->options['block-edit-return'].";";
3365
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3366
-							?>
3367
-							return content;
3363
+							    }elseif(!empty( $this->options['block-save-return'] ) ){
3364
+								    echo "return ". $this->options['block-edit-return'].";";
3365
+							    }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3366
+							    ?>
3367
+    							return content;
3368 3368
 							<?php
3369
-							}else{
3370
-							?>
3369
+							    }else{
3370
+							    ?>
3371 3371
 							var block_wrap = 'div';
3372 3372
 							if (attr.hasOwnProperty("block_wrap")) {
3373 3373
 								block_wrap = attr.block_wrap;
3374 3374
 							}
3375 3375
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
3376 3376
 							<?php
3377
-							}
3378
-							?>
3377
+							    }
3378
+							    ?>
3379 3379
 
3380 3380
 
3381 3381
 						}
@@ -3389,43 +3389,43 @@  discard block
 block discarded – undo
3389 3389
 				});
3390 3390
 			</script>
3391 3391
 			<?php
3392
-			$output = ob_get_clean();
3392
+			    $output = ob_get_clean();
3393 3393
 
3394
-			/*
3394
+			    /*
3395 3395
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
3396 3396
 			 */
3397 3397
 
3398
-			return str_replace( array(
3399
-				'<script>',
3400
-				'</script>'
3401
-			), '', $output );
3402
-		}
3398
+			    return str_replace( array(
3399
+				    '<script>',
3400
+				    '</script>'
3401
+			    ), '', $output );
3402
+		    }
3403 3403
 
3404 3404
 
3405 3405
 
3406
-		public function block_row_start($key, $args){
3406
+		    public function block_row_start($key, $args){
3407 3407
 
3408
-			// check for row
3409
-			if(!empty($args['row'])){
3408
+			    // check for row
3409
+			    if(!empty($args['row'])){
3410 3410
 
3411
-				if(!empty($args['row']['open'])){
3411
+				    if(!empty($args['row']['open'])){
3412 3412
 
3413
-				// element require
3414
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3415
-				$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3416
-				$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3417
-				$device_type_icon = '';
3418
-				if($device_type=='Desktop'){
3419
-					$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3420
-				}elseif($device_type=='Tablet'){
3421
-					$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3422
-				}elseif($device_type=='Mobile'){
3423
-					$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3424
-				}
3425
-				echo $element_require;
3426
-				echo $device_type_require;
3413
+				    // element require
3414
+				    $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3415
+				    $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3416
+				    $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3417
+				    $device_type_icon = '';
3418
+				    if($device_type=='Desktop'){
3419
+					    $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3420
+				    }elseif($device_type=='Tablet'){
3421
+					    $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3422
+				    }elseif($device_type=='Mobile'){
3423
+					    $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3424
+				    }
3425
+				    echo $element_require;
3426
+				    echo $device_type_require;
3427 3427
 
3428
-					if(false){?><script><?php }?>
3428
+					    if(false){?><script><?php }?>
3429 3429
 						el('div', {
3430 3430
 								className: 'bsui components-base-control',
3431 3431
 							},
@@ -3436,15 +3436,15 @@  discard block
 block discarded – undo
3436 3436
 								},
3437 3437
 								el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}),
3438 3438
 								<?php if($device_type_icon){ ?>
3439
-									deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3439
+    									deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3440 3440
 								<?php
3441
-								}
3442
-								?>
3441
+								    }
3442
+								    ?>
3443 3443
 
3444 3444
 
3445 3445
 							),
3446 3446
 							<?php }?>
3447
-							<?php if(!empty($args['row']['desc'])){ ?>
3447
+    							<?php if(!empty($args['row']['desc'])){ ?>
3448 3448
 							el('p', {
3449 3449
 									className: 'components-base-control__help mb-0',
3450 3450
 								},
@@ -3463,51 +3463,51 @@  discard block
 block discarded – undo
3463 3463
 									},
3464 3464
 
3465 3465
 					<?php
3466
-					if(false){?></script><?php }
3467
-				}elseif(!empty($args['row']['close'])){
3468
-					if(false){?><script><?php }?>
3466
+					    if(false){?></script><?php }
3467
+				    }elseif(!empty($args['row']['close'])){
3468
+					    if(false){?><script><?php }?>
3469 3469
 						el(
3470 3470
 							'div',
3471 3471
 							{
3472 3472
 								className: 'col pl-0 ps-0',
3473 3473
 							},
3474 3474
 					<?php
3475
-					if(false){?></script><?php }
3476
-				}else{
3477
-					if(false){?><script><?php }?>
3475
+					    if(false){?></script><?php }
3476
+				    }else{
3477
+					    if(false){?><script><?php }?>
3478 3478
 						el(
3479 3479
 							'div',
3480 3480
 							{
3481 3481
 								className: 'col pl-0 ps-0 pr-2 pe-2',
3482 3482
 							},
3483 3483
 					<?php
3484
-					if(false){?></script><?php }
3485
-				}
3484
+					    if(false){?></script><?php }
3485
+				    }
3486 3486
 
3487
-			}
3487
+			    }
3488 3488
 
3489
-		}
3489
+		    }
3490 3490
 
3491
-		public function block_row_end($key, $args){
3491
+		    public function block_row_end($key, $args){
3492 3492
 
3493
-			if(!empty($args['row'])){
3494
-				// maybe close
3495
-				if(!empty($args['row']['close'])){
3496
-					echo "))";
3497
-				}
3493
+			    if(!empty($args['row'])){
3494
+				    // maybe close
3495
+				    if(!empty($args['row']['close'])){
3496
+					    echo "))";
3497
+				    }
3498 3498
 
3499
-				echo "),";
3500
-			}
3501
-		}
3499
+				    echo "),";
3500
+			    }
3501
+		    }
3502 3502
 
3503
-		public function block_tab_start($key, $args){
3503
+		    public function block_tab_start($key, $args){
3504 3504
 
3505
-			// check for row
3506
-			if(!empty($args['tab'])){
3505
+			    // check for row
3506
+			    if(!empty($args['tab'])){
3507 3507
 
3508
-				if(!empty($args['tab']['tabs_open'])){
3508
+				    if(!empty($args['tab']['tabs_open'])){
3509 3509
 
3510
-					if(false){?><script><?php }?>
3510
+					    if(false){?><script><?php }?>
3511 3511
 
3512 3512
 el('div',{className: 'bsui'},
3513 3513
 
@@ -3520,12 +3520,12 @@  discard block
 block discarded – undo
3520 3520
 										tabs: [
3521 3521
 
3522 3522
 					<?php
3523
-					if(false){?></script><?php }
3524
-				}
3523
+					    if(false){?></script><?php }
3524
+				    }
3525 3525
 
3526
-				if(!empty($args['tab']['open'])){
3526
+				    if(!empty($args['tab']['open'])){
3527 3527
 
3528
-					if(false){?><script><?php }?>
3528
+					    if(false){?><script><?php }?>
3529 3529
 							{
3530 3530
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3531 3531
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -3534,125 +3534,125 @@  discard block
 block discarded – undo
3534 3534
 									className: 'components-base-control__help mb-0',
3535 3535
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3536 3536
 								}),<?php }
3537
-					if(false){?></script><?php }
3538
-				}
3537
+					    if(false){?></script><?php }
3538
+				    }
3539 3539
 
3540
-			}
3540
+			    }
3541 3541
 
3542
-		}
3542
+		    }
3543 3543
 
3544
-		public function block_tab_end($key, $args){
3544
+		    public function block_tab_end($key, $args){
3545 3545
 
3546
-			if(!empty($args['tab'])){
3547
-				// maybe close
3548
-				if(!empty($args['tab']['close'])){
3549
-					echo ")}, /* tab close */";
3550
-				}
3546
+			    if(!empty($args['tab'])){
3547
+				    // maybe close
3548
+				    if(!empty($args['tab']['close'])){
3549
+					    echo ")}, /* tab close */";
3550
+				    }
3551 3551
 
3552
-				if(!empty($args['tab']['tabs_close'])){
3553
-					if(false){?><script><?php }?>
3552
+				    if(!empty($args['tab']['tabs_close'])){
3553
+					    if(false){?><script><?php }?>
3554 3554
 						]}, ( tab ) => {
3555 3555
 								return tab.content;
3556 3556
 							}
3557 3557
 						)), /* tabs close */
3558 3558
 					<?php if(false){ ?></script><?php }
3559
-				}
3560
-			}
3561
-		}
3562
-
3563
-		public function build_block_arguments( $key, $args ) {
3564
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3565
-			$options           = '';
3566
-			$extra             = '';
3567
-			$require           = '';
3568
-			$inside_elements   = '';
3569
-			$after_elements	   = '';
3570
-
3571
-			// `content` is a protected and special argument
3572
-			if ( $key == 'content' ) {
3573
-				return;
3574
-			}
3575
-
3576
-			$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3577
-			$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3578
-			$device_type_icon = '';
3579
-			if($device_type=='Desktop'){
3580
-				$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3581
-			}elseif($device_type=='Tablet'){
3582
-				$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3583
-			}elseif($device_type=='Mobile'){
3584
-				$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3585
-			}
3586
-
3587
-			// icon
3588
-			$icon = '';
3589
-			if( !empty( $args['icon'] ) ){
3590
-				$icon .= "el('div', {";
3591
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3592
-									$icon .= "className: 'text-center',";
3593
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3594
-								$icon .= "}),";
3595
-
3596
-				// blank title as its added to the icon.
3597
-				$args['title'] = '';
3598
-			}
3599
-
3600
-			// require advanced
3601
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3602
-
3603
-			// element require
3604
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3605
-
3606
-
3607
-			$onchange  = "props.setAttributes({ $key: $key } )";
3608
-			$onchangecomplete  = "";
3609
-			$value     = "props.attributes.$key";
3610
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3611
-			if ( in_array( $args['type'], $text_type ) ) {
3612
-				$type = 'TextControl';
3613
-				// Save numbers as numbers and not strings
3614
-				if ( $args['type'] == 'number' ) {
3615
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3616
-				}
3617
-
3618
-				if (substr($key, 0, 9 ) === 'metadata_') {
3619
-					$real_key = str_replace('metadata_','', $key );
3620
-					$onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3621
-					$value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3622
-				}
3623
-			}
3624
-//			else if ( $args['type'] == 'popup' ) {
3625
-//				$type = 'TextControl';
3626
-//				$args['type'] == 'text';
3627
-//				$after_elements .= "el( wp.components.Button, {
3628
-//                          className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3629
-//                          onClick: function(){
3630
-//							  aui_modal('','<input id=\'zzz\' value= />');
3631
-//							  const source = document.getElementById('zzz');
3632
-//							  source.value = props.attributes.$key;
3633
-//							  source.addEventListener('input', function(e){props.setAttributes({ $key: e.target.value });});
3634
-//                          }
3635
-//                        },
3636
-//                        'test'
3637
-//                        ),";
3638
-//
3639
-//				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3640
-//			}
3641
-			else if ( $args['type'] == 'styleid' ) {
3642
-				$type = 'TextControl';
3643
-				$args['type'] == 'text';
3644
-				// Save numbers as numbers and not strings
3645
-				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3646
-			}else if ( $args['type'] == 'notice' ) {
3647
-
3648
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3649
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3650
-
3651
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3652
-				echo $notice_message ? $element_require . $notice : '';
3653
-				return;
3654
-			}
3655
-			/*
3559
+				    }
3560
+			    }
3561
+		    }
3562
+
3563
+		    public function build_block_arguments( $key, $args ) {
3564
+			    $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3565
+			    $options           = '';
3566
+			    $extra             = '';
3567
+			    $require           = '';
3568
+			    $inside_elements   = '';
3569
+			    $after_elements	   = '';
3570
+
3571
+			    // `content` is a protected and special argument
3572
+			    if ( $key == 'content' ) {
3573
+				    return;
3574
+			    }
3575
+
3576
+			    $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3577
+			    $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3578
+			    $device_type_icon = '';
3579
+			    if($device_type=='Desktop'){
3580
+				    $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3581
+			    }elseif($device_type=='Tablet'){
3582
+				    $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3583
+			    }elseif($device_type=='Mobile'){
3584
+				    $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3585
+			    }
3586
+
3587
+			    // icon
3588
+			    $icon = '';
3589
+			    if( !empty( $args['icon'] ) ){
3590
+				    $icon .= "el('div', {";
3591
+									    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3592
+									    $icon .= "className: 'text-center',";
3593
+									    $icon .= "title: '".addslashes( $args['title'] )."',";
3594
+								    $icon .= "}),";
3595
+
3596
+				    // blank title as its added to the icon.
3597
+				    $args['title'] = '';
3598
+			    }
3599
+
3600
+			    // require advanced
3601
+			    $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3602
+
3603
+			    // element require
3604
+			    $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3605
+
3606
+
3607
+			    $onchange  = "props.setAttributes({ $key: $key } )";
3608
+			    $onchangecomplete  = "";
3609
+			    $value     = "props.attributes.$key";
3610
+			    $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3611
+			    if ( in_array( $args['type'], $text_type ) ) {
3612
+				    $type = 'TextControl';
3613
+				    // Save numbers as numbers and not strings
3614
+				    if ( $args['type'] == 'number' ) {
3615
+					    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3616
+				    }
3617
+
3618
+				    if (substr($key, 0, 9 ) === 'metadata_') {
3619
+					    $real_key = str_replace('metadata_','', $key );
3620
+					    $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3621
+					    $value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3622
+				    }
3623
+			    }
3624
+    //			else if ( $args['type'] == 'popup' ) {
3625
+    //				$type = 'TextControl';
3626
+    //				$args['type'] == 'text';
3627
+    //				$after_elements .= "el( wp.components.Button, {
3628
+    //                          className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3629
+    //                          onClick: function(){
3630
+    //							  aui_modal('','<input id=\'zzz\' value= />');
3631
+    //							  const source = document.getElementById('zzz');
3632
+    //							  source.value = props.attributes.$key;
3633
+    //							  source.addEventListener('input', function(e){props.setAttributes({ $key: e.target.value });});
3634
+    //                          }
3635
+    //                        },
3636
+    //                        'test'
3637
+    //                        ),";
3638
+    //
3639
+    //				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3640
+    //			}
3641
+			    else if ( $args['type'] == 'styleid' ) {
3642
+				    $type = 'TextControl';
3643
+				    $args['type'] == 'text';
3644
+				    // Save numbers as numbers and not strings
3645
+				    $value     = "props.attributes.$key ? props.attributes.$key : ''";
3646
+			    }else if ( $args['type'] == 'notice' ) {
3647
+
3648
+				    $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3649
+				    $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3650
+
3651
+				    $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3652
+				    echo $notice_message ? $element_require . $notice : '';
3653
+				    return;
3654
+			    }
3655
+			    /*
3656 3656
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3657 3657
 						elseif($args['type']=='tabs'){
3658 3658
 							?>
@@ -3705,22 +3705,22 @@  discard block
 block discarded – undo
3705 3705
 							return;
3706 3706
 						}
3707 3707
 */
3708
-			elseif ( $args['type'] == 'color' ) {
3709
-				$type = 'ColorPicker';
3710
-				$onchange = "";
3711
-				$extra = "color: $value,";
3712
-				if(!empty($args['disable_alpha'])){
3713
-					$extra .= "disableAlpha: true,";
3714
-				}
3715
-				$onchangecomplete = "onChangeComplete: function($key) {
3708
+			    elseif ( $args['type'] == 'color' ) {
3709
+				    $type = 'ColorPicker';
3710
+				    $onchange = "";
3711
+				    $extra = "color: $value,";
3712
+				    if(!empty($args['disable_alpha'])){
3713
+					    $extra .= "disableAlpha: true,";
3714
+				    }
3715
+				    $onchangecomplete = "onChangeComplete: function($key) {
3716 3716
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3717 3717
 						props.setAttributes({
3718 3718
 							$key: value
3719 3719
 						});
3720 3720
 					},";
3721
-			}elseif ( $args['type'] == 'gradient' ) {
3722
-				$type = 'GradientPicker';
3723
-				$extra .= "gradients: [{
3721
+			    }elseif ( $args['type'] == 'gradient' ) {
3722
+				    $type = 'GradientPicker';
3723
+				    $extra .= "gradients: [{
3724 3724
 			name: 'Vivid cyan blue to vivid purple',
3725 3725
 			gradient:
3726 3726
 				'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
@@ -3757,10 +3757,10 @@  discard block
 block discarded – undo
3757 3757
 			slug: 'cool-to-warm-spectrum',
3758 3758
 		}],";
3759 3759
 
3760
-			}elseif ( $args['type'] == 'image' ) {
3761
-//                print_r($args);
3760
+			    }elseif ( $args['type'] == 'image' ) {
3761
+    //                print_r($args);
3762 3762
 
3763
-				$img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
3763
+				    $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
3764 3764
 							url:  props.attributes.{$key}_use_featured === true ? 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxzdmcgYmFzZVByb2ZpbGU9InRpbnkiIGhlaWdodD0iNDAwIiB2ZXJzaW9uPSIxLjIiIHdpZHRoPSI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6ZXY9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEveG1sLWV2ZW50cyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzIC8+PHJlY3QgZmlsbD0iI2QzZDNkMyIgaGVpZ2h0PSI0MDAiIHdpZHRoPSI0MDAiIHg9IjAiIHk9IjAiIC8+PGxpbmUgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxMCIgeDE9IjAiIHgyPSI0MDAiIHkxPSIwIiB5Mj0iNDAwIiAvPjxsaW5lIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMTAiIHgxPSIwIiB4Mj0iNDAwIiB5MT0iNDAwIiB5Mj0iMCIgLz48cmVjdCBmaWxsPSIjZDNkM2QzIiBoZWlnaHQ9IjUwIiB3aWR0aD0iMjE4LjAiIHg9IjkxLjAiIHk9IjE3NS4wIiAvPjx0ZXh0IGZpbGw9IndoaXRlIiBmb250LXNpemU9IjMwIiBmb250LXdlaWdodD0iYm9sZCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgeD0iMjAwLjAiIHk9IjIwNy41Ij5QTEFDRUhPTERFUjwvdGV4dD48L3N2Zz4='  : props.attributes.$key,
3765 3765
 							value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy  : {x: 0.5,y: 0.5,},
3766 3766
 //                            value: props.attributes.{$key}_xy,
@@ -3781,16 +3781,16 @@  discard block
 block discarded – undo
3781 3781
 						}), ";
3782 3782
 
3783 3783
 
3784
-				$value = '""';
3785
-				$type = 'MediaUpload';
3786
-				$extra .= "onSelect: function(media){
3784
+				    $value = '""';
3785
+				    $type = 'MediaUpload';
3786
+				    $extra .= "onSelect: function(media){
3787 3787
 					  return props.setAttributes({
3788 3788
 						  $key: media.url,
3789 3789
 						  {$key}_id: media.id
3790 3790
 						});
3791 3791
 					  },";
3792
-				   $extra .= "type: 'image',";
3793
-				   $extra .= "render: function (obj) {
3792
+				       $extra .= "type: 'image',";
3793
+				       $extra .= "render: function (obj) {
3794 3794
 						return el( 'div',{},
3795 3795
 						( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3796 3796
 						  className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3816,11 +3816,11 @@  discard block
 block discarded – undo
3816 3816
 
3817 3817
 
3818 3818
 					  }";
3819
-				$onchange = "";
3819
+				    $onchange = "";
3820 3820
 
3821
-				//$inside_elements = ",el('div',{},'file upload')";
3822
-			} else if ( $args['type'] == 'images' ) {
3823
-				$img_preview = "props.attributes.$key && (function() {
3821
+				    //$inside_elements = ",el('div',{},'file upload')";
3822
+			    } else if ( $args['type'] == 'images' ) {
3823
+				    $img_preview = "props.attributes.$key && (function() {
3824 3824
 	let uploads = JSON.parse('['+props.attributes.$key+']');
3825 3825
 	let images = [];
3826 3826
 	uploads.map((upload, index) => (
@@ -3847,9 +3847,9 @@  discard block
 block discarded – undo
3847 3847
 })(),";
3848 3848
 
3849 3849
 
3850
-				$value = '""';
3851
-				$type = 'MediaUpload';
3852
-				$extra .= "onSelect: function(media){
3850
+				    $value = '""';
3851
+				    $type = 'MediaUpload';
3852
+				    $extra .= "onSelect: function(media){
3853 3853
 	let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
3854 3854
 	if(media.length){
3855 3855
 		for (var i=0; i < media.length; i++) {
@@ -3862,9 +3862,9 @@  discard block
 block discarded – undo
3862 3862
 	}
3863 3863
 	return props.setAttributes({ $key: slimImagesV});
3864 3864
 },";
3865
-				$extra .= "type: 'image',";
3866
-				$extra .= "multiple: true,";
3867
-				$extra .= "render: function (obj) {
3865
+				    $extra .= "type: 'image',";
3866
+				    $extra .= "multiple: true,";
3867
+				    $extra .= "render: function (obj) {
3868 3868
 	/* Init the sort */
3869 3869
 	enableDragSort('sd-sortable');
3870 3870
 	return el( 'div',{},
@@ -3891,40 +3891,40 @@  discard block
 block discarded – undo
3891 3891
 		)
3892 3892
 	)
3893 3893
 }";
3894
-				$onchange = "";
3895
-
3896
-				//$inside_elements = ",el('div',{},'file upload')";
3897
-			}
3898
-			elseif ( $args['type'] == 'checkbox' ) {
3899
-				$type = 'CheckboxControl';
3900
-				$extra .= "checked: props.attributes.$key,";
3901
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3902
-			} elseif ( $args['type'] == 'textarea' ) {
3903
-				$type = 'TextareaControl';
3904
-
3905
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3906
-				$type = 'SelectControl';
3907
-
3908
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3909
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3910
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3911
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3912
-				}else {
3913
-
3914
-					if ( ! empty( $args['options'] ) ) {
3915
-						$options .= "options: [";
3916
-						foreach ( $args['options'] as $option_val => $option_label ) {
3917
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3918
-						}
3919
-						$options .= "],";
3920
-					}
3921
-				}
3922
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3923
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3924
-				}
3925
-
3926
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3927
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3894
+				    $onchange = "";
3895
+
3896
+				    //$inside_elements = ",el('div',{},'file upload')";
3897
+			    }
3898
+			    elseif ( $args['type'] == 'checkbox' ) {
3899
+				    $type = 'CheckboxControl';
3900
+				    $extra .= "checked: props.attributes.$key,";
3901
+				    $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3902
+			    } elseif ( $args['type'] == 'textarea' ) {
3903
+				    $type = 'TextareaControl';
3904
+
3905
+			    } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3906
+				    $type = 'SelectControl';
3907
+
3908
+				    if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3909
+					    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3910
+				    }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3911
+					    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3912
+				    }else {
3913
+
3914
+					    if ( ! empty( $args['options'] ) ) {
3915
+						    $options .= "options: [";
3916
+						    foreach ( $args['options'] as $option_val => $option_label ) {
3917
+							    $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3918
+						    }
3919
+						    $options .= "],";
3920
+					    }
3921
+				    }
3922
+				    if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3923
+					    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3924
+				    }
3925
+
3926
+				    if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3927
+					    $after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3928 3928
 									  className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3929 3929
 									  style: {margin:'-8px 0 8px 0',display: 'block'},
3930 3930
 									  onClick: function(){
@@ -3935,56 +3935,56 @@  discard block
 block discarded – undo
3935 3935
 									},
3936 3936
 									'Clear'
3937 3937
 							),";
3938
-				}
3939
-			} elseif ( $args['type'] == 'tagselect' ) {
3940
-//				$type = 'FormTokenField';
3941
-//
3942
-//				if ( ! empty( $args['options'] ) ) {
3943
-//						$options .= "suggestions: [";
3944
-//						foreach ( $args['options'] as $option_val => $option_label ) {
3945
-//							$options .= "{ value: '" . esc_attr( $option_val ) . "', title: '" . addslashes( $option_label ) . "' },";
3946
-////							$options .= "'" . esc_attr( $option_val ) . "':'" . addslashes( $option_label ) . "',";
3947
-//						}
3948
-//						$options .= "],";
3949
-//				}
3950
-//
3951
-//				$onchangex  = "{ ( selectedItems ) => {
3952
-//						// Build array of selected posts.
3953
-//						let selectedPostsArray = [];
3954
-//						selectedPosts.map(
3955
-//							( postName ) => {
3956
-//								const matchingPost = posts.find( ( post ) => {
3957
-//									return post.title.raw === postName;
3958
-//
3959
-//								} );
3960
-//								if ( matchingPost !== undefined ) {
3961
-//									selectedPostsArray.push( matchingPost.id );
3962
-//								}
3963
-//							}
3964
-//						)
3965
-//
3966
-//						setAttributes( { selectedPosts: selectedPostsArray } );
3967
-//					} } ";
3968
-//				$onchange  = '';// "props.setAttributes({ $key: [ props.attributes.$key ] } )";
3969
-//
3970
-////				$options  = "";
3971
-//				$value     = "[]";
3972
-//				$extra .= ' __experimentalExpandOnFocus: true,';
3973
-
3974
-			} else if ( $args['type'] == 'alignment' ) {
3975
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3976
-			} else if ( $args['type'] == 'margins' ) {
3977
-
3978
-			} else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3979
-				$type = 'TextControl';
3980
-				$value = "(props.attributes.$key ? props.attributes.$key : '')";
3981
-				$args['type'] = 'text';
3982
-				$options .= 'disabled:true,';
3983
-				$bsvc_title = esc_attr( addslashes( $args['title'] ) );
3984
-				$bsvc_body = $this->block_visibility_fields( $args );
3985
-				// @TODO reset button
3986
-				$bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3987
-				$after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3938
+				    }
3939
+			    } elseif ( $args['type'] == 'tagselect' ) {
3940
+    //				$type = 'FormTokenField';
3941
+    //
3942
+    //				if ( ! empty( $args['options'] ) ) {
3943
+    //						$options .= "suggestions: [";
3944
+    //						foreach ( $args['options'] as $option_val => $option_label ) {
3945
+    //							$options .= "{ value: '" . esc_attr( $option_val ) . "', title: '" . addslashes( $option_label ) . "' },";
3946
+    ////							$options .= "'" . esc_attr( $option_val ) . "':'" . addslashes( $option_label ) . "',";
3947
+    //						}
3948
+    //						$options .= "],";
3949
+    //				}
3950
+    //
3951
+    //				$onchangex  = "{ ( selectedItems ) => {
3952
+    //						// Build array of selected posts.
3953
+    //						let selectedPostsArray = [];
3954
+    //						selectedPosts.map(
3955
+    //							( postName ) => {
3956
+    //								const matchingPost = posts.find( ( post ) => {
3957
+    //									return post.title.raw === postName;
3958
+    //
3959
+    //								} );
3960
+    //								if ( matchingPost !== undefined ) {
3961
+    //									selectedPostsArray.push( matchingPost.id );
3962
+    //								}
3963
+    //							}
3964
+    //						)
3965
+    //
3966
+    //						setAttributes( { selectedPosts: selectedPostsArray } );
3967
+    //					} } ";
3968
+    //				$onchange  = '';// "props.setAttributes({ $key: [ props.attributes.$key ] } )";
3969
+    //
3970
+    ////				$options  = "";
3971
+    //				$value     = "[]";
3972
+    //				$extra .= ' __experimentalExpandOnFocus: true,';
3973
+
3974
+			    } else if ( $args['type'] == 'alignment' ) {
3975
+				    $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3976
+			    } else if ( $args['type'] == 'margins' ) {
3977
+
3978
+			    } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3979
+				    $type = 'TextControl';
3980
+				    $value = "(props.attributes.$key ? props.attributes.$key : '')";
3981
+				    $args['type'] = 'text';
3982
+				    $options .= 'disabled:true,';
3983
+				    $bsvc_title = esc_attr( addslashes( $args['title'] ) );
3984
+				    $bsvc_body = $this->block_visibility_fields( $args );
3985
+				    // @TODO reset button
3986
+				    $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3987
+				    $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3988 3988
 						className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3989 3989
 						onClick: function() {
3990 3990
 							var sValue = props.attributes." . $key . ";
@@ -4010,54 +4010,54 @@  discard block
 block discarded – undo
4010 4010
 					},
4011 4011
 					'" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "'
4012 4012
 				) ),";
4013
-			} else {
4014
-				return;// if we have not implemented the control then don't break the JS.
4015
-			}
4016
-
4017
-			// color input does not show the labels so we add them
4018
-			if($args['type']=='color'){
4019
-				// add show only if advanced
4020
-				echo $require_advanced;
4021
-				// add setting require if defined
4022
-				echo $element_require;
4023
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
4024
-			}
4025
-
4026
-			// add show only if advanced
4027
-			echo $require_advanced;
4028
-			// add setting require if defined
4029
-			echo $element_require;
4030
-			echo $device_type_require;
4031
-
4032
-			// icon
4033
-			echo $icon;
4034
-			?>
4035
-			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
4013
+			    } else {
4014
+				    return;// if we have not implemented the control then don't break the JS.
4015
+			    }
4016
+
4017
+			    // color input does not show the labels so we add them
4018
+			    if($args['type']=='color'){
4019
+				    // add show only if advanced
4020
+				    echo $require_advanced;
4021
+				    // add setting require if defined
4022
+				    echo $element_require;
4023
+				    echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
4024
+			    }
4025
+
4026
+			    // add show only if advanced
4027
+			    echo $require_advanced;
4028
+			    // add setting require if defined
4029
+			    echo $element_require;
4030
+			    echo $device_type_require;
4031
+
4032
+			    // icon
4033
+			    echo $icon;
4034
+			    ?>
4035
+    			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
4036 4036
 			label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php
4037
-			} else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4037
+			    } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4038 4038
 			help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>,
4039 4039
 			value: <?php echo $value; ?>,
4040 4040
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
4041
-				echo "type: '" . addslashes( $args['type'] ) . "',";
4042
-			} ?>
4043
-			<?php if ( ! empty( $args['placeholder'] ) ) {
4044
-				echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4045
-			} ?>
4046
-			<?php echo $options; ?>
4047
-			<?php echo $extra; ?>
4048
-			<?php echo $custom_attributes; ?>
4049
-			<?php echo $onchangecomplete; ?>
4050
-			<?php if ( $onchange ) { ?>
4051
-			onChange: function ( <?php echo $key; ?> ) {
4041
+				    echo "type: '" . addslashes( $args['type'] ) . "',";
4042
+			    } ?>
4043
+    			<?php if ( ! empty( $args['placeholder'] ) ) {
4044
+				    echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4045
+			    } ?>
4046
+    			<?php echo $options; ?>
4047
+    			<?php echo $extra; ?>
4048
+    			<?php echo $custom_attributes; ?>
4049
+    			<?php echo $onchangecomplete; ?>
4050
+    			<?php if ( $onchange ) { ?>
4051
+    			onChange: function ( <?php echo $key; ?> ) {
4052 4052
 				<?php echo $onchange; ?>
4053
-			}
4053
+    			}
4054 4054
 			<?php } ?>
4055
-		} <?php echo $inside_elements; ?> ),
4055
+    		} <?php echo $inside_elements; ?> ),
4056 4056
 			<?php
4057
-			echo $after_elements;
4058
-		}
4057
+			    echo $after_elements;
4058
+		    }
4059 4059
 
4060
-		/**
4060
+		    /**
4061 4061
 		 * Convert an array of attributes to block string.
4062 4062
 		 *
4063 4063
 		 * @param $custom_attributes
@@ -4066,448 +4066,448 @@  discard block
 block discarded – undo
4066 4066
 		 *@todo there is prob a faster way to do this, also we could add some validation here.
4067 4067
 		 *
4068 4068
 		 */
4069
-		public function array_to_attributes( $custom_attributes, $html = false ) {
4070
-			$attributes = '';
4071
-			if ( ! empty( $custom_attributes ) ) {
4069
+		    public function array_to_attributes( $custom_attributes, $html = false ) {
4070
+			    $attributes = '';
4071
+			    if ( ! empty( $custom_attributes ) ) {
4072 4072
 
4073
-				foreach ( $custom_attributes as $key => $val ) {
4074
-					if(is_array($val)){
4075
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4076
-					}else{
4077
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4078
-					}
4079
-				}
4073
+				    foreach ( $custom_attributes as $key => $val ) {
4074
+					    if(is_array($val)){
4075
+						    $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4076
+					    }else{
4077
+						    $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4078
+					    }
4079
+				    }
4080 4080
 
4081
-			}
4081
+			    }
4082 4082
 
4083
-			return $attributes;
4084
-		}
4083
+			    return $attributes;
4084
+		    }
4085 4085
 
4086 4086
 
4087 4087
 
4088
-		/**
4088
+		    /**
4089 4089
 		 * A self looping function to create the output for JS block elements.
4090 4090
 		 *
4091 4091
 		 * This is what is output in the WP Editor visual view.
4092 4092
 		 *
4093 4093
 		 * @param $args
4094 4094
 		 */
4095
-		public function block_element( $args, $save = false ) {
4096
-
4097
-//            print_r($args);echo '###';exit;
4098
-
4099
-			if ( ! empty( $args ) ) {
4100
-				foreach ( $args as $element => $new_args ) {
4095
+		    public function block_element( $args, $save = false ) {
4096
+
4097
+    //            print_r($args);echo '###';exit;
4098
+
4099
+			    if ( ! empty( $args ) ) {
4100
+				    foreach ( $args as $element => $new_args ) {
4101
+
4102
+					    if ( is_array( $new_args ) ) { // its an element
4103
+
4101 4104
 
4102
-					if ( is_array( $new_args ) ) { // its an element
4105
+						    if ( isset( $new_args['element'] ) ) {
4103 4106
 
4104
-
4105
-						if ( isset( $new_args['element'] ) ) {
4106
-
4107
-							if ( isset( $new_args['element_require'] ) ) {
4108
-								echo str_replace( array(
4109
-										"'+",
4110
-										"+'"
4111
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4112
-								unset( $new_args['element_require'] );
4113
-							}
4114
-
4115
-							if($new_args['element']=='InnerBlocks'){
4116
-								echo "\n el( InnerBlocks, {";
4117
-							}elseif($new_args['element']=='innerBlocksProps'){
4118
-								$element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4119
-							  //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4120
-//                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4121
-								echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4122
-								echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4123
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4124
-
4125
-								echo "} ), {";
4126
-								echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4127
-							//    echo '###';
4128
-
4129
-							  //  echo '###';
4130
-							}elseif($new_args['element']=='BlocksProps'){
4131
-
4132
-								if ( isset($new_args['if_inner_element']) ) {
4133
-									$element = $new_args['if_inner_element'];
4134
-								}else {
4135
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4136
-								}
4137
-
4138
-								unset($new_args['inner_element']);
4139
-								echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4140
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4141
-
4142
-
4143
-							   // echo "} ),";
4144
-
4145
-							}else{
4146
-								echo "\n el( '" . $new_args['element'] . "', {";
4147
-							}
4148
-
4149
-
4150
-							// get the attributes
4151
-							foreach ( $new_args as $new_key => $new_value ) {
4152
-
4153
-
4154
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4155
-									// do nothing
4156
-								} else {
4157
-									echo $this->block_element( array( $new_key => $new_value ),$save );
4158
-								}
4159
-							}
4160
-
4161
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4162
-
4163
-							// get the content
4164
-							$first_item = 0;
4165
-							foreach ( $new_args as $new_key => $new_value ) {
4166
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4167
-
4168
-									if ( $new_key === 'content' ) {
4169
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4170
-									}else if ( $new_key === 'if_content' ) {
4171
-										echo  $this->block_props_replace(  $new_value  );
4172
-									}
4173
-
4174
-									if ( is_array( $new_value ) ) {
4175
-
4176
-										if ( isset( $new_value['element_require'] ) ) {
4177
-											echo str_replace( array(
4178
-													"'+",
4179
-													"+'"
4180
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4181
-											unset( $new_value['element_require'] );
4182
-										}
4183
-
4184
-										if ( isset( $new_value['element_repeat'] ) ) {
4185
-											$x = 1;
4186
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
4187
-												$this->block_element( array( '' => $new_value ),$save );
4188
-												$x ++;
4189
-											}
4190
-										} else {
4191
-											$this->block_element( array( '' => $new_value ),$save );
4192
-										}
4193
-									}
4194
-									$first_item ++;
4195
-								}
4196
-							}
4197
-
4198
-							if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4199
-								echo "))";// end content
4200
-							}else{
4201
-								echo ")";// end content
4202
-							}
4203
-
4204
-
4205
-							echo ", \n";
4206
-
4207
-						}
4208
-					} else {
4209
-
4210
-						if ( substr( $element, 0, 3 ) === "if_" ) {
4211
-							$extra = '';
4212
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
4213
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4214
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4215
-							}
4216
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4217
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4218
-							$new_args = str_replace('[%WrapStyle%]','',$new_args);
4219
-							echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4220
-//                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4221
-						} elseif ( $element == 'style' ) {
4222
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4223
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4224
-							$new_args = str_replace('[%WrapClass%]','',$new_args);
4225
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4226
-						} elseif ( $element == 'template' && $new_args ) {
4227
-							echo $element . ": $new_args,";
4228
-						} else {
4229
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4230
-						}
4231
-
4232
-					}
4233
-				}
4234
-			}
4235
-		}
4236
-
4237
-		/**
4107
+							    if ( isset( $new_args['element_require'] ) ) {
4108
+								    echo str_replace( array(
4109
+										    "'+",
4110
+										    "+'"
4111
+									    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4112
+								    unset( $new_args['element_require'] );
4113
+							    }
4114
+
4115
+							    if($new_args['element']=='InnerBlocks'){
4116
+								    echo "\n el( InnerBlocks, {";
4117
+							    }elseif($new_args['element']=='innerBlocksProps'){
4118
+								    $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4119
+							      //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4120
+    //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4121
+								    echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4122
+								    echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4123
+								    echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4124
+
4125
+								    echo "} ), {";
4126
+								    echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4127
+							    //    echo '###';
4128
+
4129
+							      //  echo '###';
4130
+							    }elseif($new_args['element']=='BlocksProps'){
4131
+
4132
+								    if ( isset($new_args['if_inner_element']) ) {
4133
+									    $element = $new_args['if_inner_element'];
4134
+								    }else {
4135
+									    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4136
+								    }
4137
+
4138
+								    unset($new_args['inner_element']);
4139
+								    echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4140
+								    echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4141
+
4142
+
4143
+							       // echo "} ),";
4144
+
4145
+							    }else{
4146
+								    echo "\n el( '" . $new_args['element'] . "', {";
4147
+							    }
4148
+
4149
+
4150
+							    // get the attributes
4151
+							    foreach ( $new_args as $new_key => $new_value ) {
4152
+
4153
+
4154
+								    if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4155
+									    // do nothing
4156
+								    } else {
4157
+									    echo $this->block_element( array( $new_key => $new_value ),$save );
4158
+								    }
4159
+							    }
4160
+
4161
+							    echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4162
+
4163
+							    // get the content
4164
+							    $first_item = 0;
4165
+							    foreach ( $new_args as $new_key => $new_value ) {
4166
+								    if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4167
+
4168
+									    if ( $new_key === 'content' ) {
4169
+										    echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4170
+									    }else if ( $new_key === 'if_content' ) {
4171
+										    echo  $this->block_props_replace(  $new_value  );
4172
+									    }
4173
+
4174
+									    if ( is_array( $new_value ) ) {
4175
+
4176
+										    if ( isset( $new_value['element_require'] ) ) {
4177
+											    echo str_replace( array(
4178
+													    "'+",
4179
+													    "+'"
4180
+												    ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4181
+											    unset( $new_value['element_require'] );
4182
+										    }
4183
+
4184
+										    if ( isset( $new_value['element_repeat'] ) ) {
4185
+											    $x = 1;
4186
+											    while ( $x <= absint( $new_value['element_repeat'] ) ) {
4187
+												    $this->block_element( array( '' => $new_value ),$save );
4188
+												    $x ++;
4189
+											    }
4190
+										    } else {
4191
+											    $this->block_element( array( '' => $new_value ),$save );
4192
+										    }
4193
+									    }
4194
+									    $first_item ++;
4195
+								    }
4196
+							    }
4197
+
4198
+							    if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4199
+								    echo "))";// end content
4200
+							    }else{
4201
+								    echo ")";// end content
4202
+							    }
4203
+
4204
+
4205
+							    echo ", \n";
4206
+
4207
+						    }
4208
+					    } else {
4209
+
4210
+						    if ( substr( $element, 0, 3 ) === "if_" ) {
4211
+							    $extra = '';
4212
+							    if( strpos($new_args, '[%WrapClass%]') !== false ){
4213
+								    $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4214
+								    $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4215
+							    }
4216
+							    echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4217
+						    } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4218
+							    $new_args = str_replace('[%WrapStyle%]','',$new_args);
4219
+							    echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4220
+    //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4221
+						    } elseif ( $element == 'style' ) {
4222
+							    echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4223
+						    } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4224
+							    $new_args = str_replace('[%WrapClass%]','',$new_args);
4225
+							    echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4226
+						    } elseif ( $element == 'template' && $new_args ) {
4227
+							    echo $element . ": $new_args,";
4228
+						    } else {
4229
+							    echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4230
+						    }
4231
+
4232
+					    }
4233
+				    }
4234
+			    }
4235
+		    }
4236
+
4237
+		    /**
4238 4238
 		 * Replace block attributes placeholders with the proper naming.
4239 4239
 		 *
4240 4240
 		 * @param $string
4241 4241
 		 *
4242 4242
 		 * @return mixed
4243 4243
 		 */
4244
-		public function block_props_replace( $string, $no_wrap = false ) {
4245
-			if ( $no_wrap ) {
4246
-				$string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4247
-			} else {
4248
-				$string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4249
-			}
4244
+		    public function block_props_replace( $string, $no_wrap = false ) {
4245
+			    if ( $no_wrap ) {
4246
+				    $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4247
+			    } else {
4248
+				    $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4249
+			    }
4250 4250
 
4251
-			return $string;
4252
-		}
4251
+			    return $string;
4252
+		    }
4253 4253
 
4254
-		/**
4254
+		    /**
4255 4255
 		 * Outputs the content of the widget
4256 4256
 		 *
4257 4257
 		 * @param array $args
4258 4258
 		 * @param array $instance
4259 4259
 		 */
4260
-		public function widget( $args, $instance ) {
4261
-			if ( ! is_array( $args ) ) {
4262
-				$args = array();
4263
-			}
4264
-
4265
-			// Get the filtered values
4266
-			$argument_values = $this->argument_values( $instance );
4267
-			$argument_values = $this->string_to_bool( $argument_values );
4268
-			$output          = $this->output( $argument_values, $args );
4269
-
4270
-			$no_wrap = false;
4271
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4272
-				$no_wrap = true;
4273
-			}
4274
-
4275
-			ob_start();
4276
-			if ( $output && ! $no_wrap ) {
4277
-
4278
-				$class_original = $this->options['widget_ops']['classname'];
4279
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4280
-
4281
-				// Before widget
4282
-				$before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4283
-				$before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4284
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4285
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4286
-
4287
-				// After widget
4288
-				$after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4289
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4290
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4291
-
4292
-				echo $before_widget;
4293
-				// elementor strips the widget wrapping div so we check for and add it back if needed
4294
-				if ( $this->is_elementor_widget_output() ) {
4295
-					// Filter class & attrs for elementor widget output.
4296
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4297
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4298
-
4299
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4300
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4301
-
4302
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4303
-				}
4304
-				echo $this->output_title( $args, $instance );
4305
-				echo $output;
4306
-				if ( $this->is_elementor_widget_output() ) {
4307
-					echo "</span>";
4308
-				}
4309
-				echo $after_widget;
4310
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4311
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4312
-				echo $output;
4313
-			} elseif ( $output && $no_wrap ) {
4314
-				echo $output;
4315
-			}
4316
-			$output = ob_get_clean();
4317
-
4318
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4319
-
4320
-			echo $output;
4321
-		}
4322
-
4323
-		/**
4260
+		    public function widget( $args, $instance ) {
4261
+			    if ( ! is_array( $args ) ) {
4262
+				    $args = array();
4263
+			    }
4264
+
4265
+			    // Get the filtered values
4266
+			    $argument_values = $this->argument_values( $instance );
4267
+			    $argument_values = $this->string_to_bool( $argument_values );
4268
+			    $output          = $this->output( $argument_values, $args );
4269
+
4270
+			    $no_wrap = false;
4271
+			    if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4272
+				    $no_wrap = true;
4273
+			    }
4274
+
4275
+			    ob_start();
4276
+			    if ( $output && ! $no_wrap ) {
4277
+
4278
+				    $class_original = $this->options['widget_ops']['classname'];
4279
+				    $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4280
+
4281
+				    // Before widget
4282
+				    $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4283
+				    $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4284
+				    $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4285
+				    $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4286
+
4287
+				    // After widget
4288
+				    $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4289
+				    $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4290
+				    $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4291
+
4292
+				    echo $before_widget;
4293
+				    // elementor strips the widget wrapping div so we check for and add it back if needed
4294
+				    if ( $this->is_elementor_widget_output() ) {
4295
+					    // Filter class & attrs for elementor widget output.
4296
+					    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4297
+					    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4298
+
4299
+					    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4300
+					    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4301
+
4302
+					    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4303
+				    }
4304
+				    echo $this->output_title( $args, $instance );
4305
+				    echo $output;
4306
+				    if ( $this->is_elementor_widget_output() ) {
4307
+					    echo "</span>";
4308
+				    }
4309
+				    echo $after_widget;
4310
+			    } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4311
+				    $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4312
+				    echo $output;
4313
+			    } elseif ( $output && $no_wrap ) {
4314
+				    echo $output;
4315
+			    }
4316
+			    $output = ob_get_clean();
4317
+
4318
+			    $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4319
+
4320
+			    echo $output;
4321
+		    }
4322
+
4323
+		    /**
4324 4324
 		 * Tests if the current output is inside a elementor container.
4325 4325
 		 *
4326 4326
 		 * @return bool
4327 4327
 		 *@since 1.0.4
4328 4328
 		 */
4329
-		public function is_elementor_widget_output() {
4330
-			$result = false;
4331
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4332
-				$result = true;
4333
-			}
4329
+		    public function is_elementor_widget_output() {
4330
+			    $result = false;
4331
+			    if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4332
+				    $result = true;
4333
+			    }
4334 4334
 
4335
-			return $result;
4336
-		}
4335
+			    return $result;
4336
+		    }
4337 4337
 
4338
-		/**
4338
+		    /**
4339 4339
 		 * Tests if the current output is inside a elementor preview.
4340 4340
 		 *
4341 4341
 		 * @return bool
4342 4342
 		 *@since 1.0.4
4343 4343
 		 */
4344
-		public function is_elementor_preview() {
4345
-			$result = false;
4346
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4347
-				$result = true;
4348
-			}
4344
+		    public function is_elementor_preview() {
4345
+			    $result = false;
4346
+			    if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4347
+				    $result = true;
4348
+			    }
4349 4349
 
4350
-			return $result;
4351
-		}
4350
+			    return $result;
4351
+		    }
4352 4352
 
4353
-		/**
4353
+		    /**
4354 4354
 		 * Tests if the current output is inside a Divi preview.
4355 4355
 		 *
4356 4356
 		 * @return bool
4357 4357
 		 *@since 1.0.6
4358 4358
 		 */
4359
-		public function is_divi_preview() {
4360
-			$result = false;
4361
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4362
-				$result = true;
4363
-			}
4359
+		    public function is_divi_preview() {
4360
+			    $result = false;
4361
+			    if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4362
+				    $result = true;
4363
+			    }
4364 4364
 
4365
-			return $result;
4366
-		}
4365
+			    return $result;
4366
+		    }
4367 4367
 
4368
-		/**
4368
+		    /**
4369 4369
 		 * Tests if the current output is inside a Beaver builder preview.
4370 4370
 		 *
4371 4371
 		 * @return bool
4372 4372
 		 *@since 1.0.6
4373 4373
 		 */
4374
-		public function is_beaver_preview() {
4375
-			$result = false;
4376
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
4377
-				$result = true;
4378
-			}
4374
+		    public function is_beaver_preview() {
4375
+			    $result = false;
4376
+			    if ( isset( $_REQUEST['fl_builder'] ) ) {
4377
+				    $result = true;
4378
+			    }
4379 4379
 
4380
-			return $result;
4381
-		}
4380
+			    return $result;
4381
+		    }
4382 4382
 
4383
-		/**
4383
+		    /**
4384 4384
 		 * Tests if the current output is inside a siteorigin builder preview.
4385 4385
 		 *
4386 4386
 		 * @return bool
4387 4387
 		 *@since 1.0.6
4388 4388
 		 */
4389
-		public function is_siteorigin_preview() {
4390
-			$result = false;
4391
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4392
-				$result = true;
4393
-			}
4389
+		    public function is_siteorigin_preview() {
4390
+			    $result = false;
4391
+			    if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4392
+				    $result = true;
4393
+			    }
4394 4394
 
4395
-			return $result;
4396
-		}
4395
+			    return $result;
4396
+		    }
4397 4397
 
4398
-		/**
4398
+		    /**
4399 4399
 		 * Tests if the current output is inside a cornerstone builder preview.
4400 4400
 		 *
4401 4401
 		 * @return bool
4402 4402
 		 *@since 1.0.8
4403 4403
 		 */
4404
-		public function is_cornerstone_preview() {
4405
-			$result = false;
4406
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4407
-				$result = true;
4408
-			}
4404
+		    public function is_cornerstone_preview() {
4405
+			    $result = false;
4406
+			    if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4407
+				    $result = true;
4408
+			    }
4409 4409
 
4410
-			return $result;
4411
-		}
4410
+			    return $result;
4411
+		    }
4412 4412
 
4413
-		/**
4413
+		    /**
4414 4414
 		 * Tests if the current output is inside a fusion builder preview.
4415 4415
 		 *
4416 4416
 		 * @return bool
4417 4417
 		 *@since 1.1.0
4418 4418
 		 */
4419
-		public function is_fusion_preview() {
4420
-			$result = false;
4421
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4422
-				$result = true;
4423
-			}
4419
+		    public function is_fusion_preview() {
4420
+			    $result = false;
4421
+			    if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4422
+				    $result = true;
4423
+			    }
4424 4424
 
4425
-			return $result;
4426
-		}
4425
+			    return $result;
4426
+		    }
4427 4427
 
4428
-		/**
4428
+		    /**
4429 4429
 		 * Tests if the current output is inside a Oxygen builder preview.
4430 4430
 		 *
4431 4431
 		 * @return bool
4432 4432
 		 *@since 1.0.18
4433 4433
 		 */
4434
-		public function is_oxygen_preview() {
4435
-			$result = false;
4436
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4437
-				$result = true;
4438
-			}
4434
+		    public function is_oxygen_preview() {
4435
+			    $result = false;
4436
+			    if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4437
+				    $result = true;
4438
+			    }
4439 4439
 
4440
-			return $result;
4441
-		}
4440
+			    return $result;
4441
+		    }
4442 4442
 
4443
-		/**
4443
+		    /**
4444 4444
 		 * Check for Kallyas theme Zion builder preview.
4445 4445
 		 *
4446 4446
 		 * @since 1.1.22
4447 4447
 		 *
4448 4448
 		 * @return bool True when preview page otherwise false.
4449 4449
 		 */
4450
-		public function is_kallyas_zion_preview() {
4451
-			$result = false;
4450
+		    public function is_kallyas_zion_preview() {
4451
+			    $result = false;
4452 4452
 
4453
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4454
-				$result = true;
4455
-			}
4453
+			    if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4454
+				    $result = true;
4455
+			    }
4456 4456
 
4457
-			return $result;
4458
-		}
4457
+			    return $result;
4458
+		    }
4459 4459
 
4460
-		/**
4460
+		    /**
4461 4461
 		 * Check for Bricks theme builder preview.
4462 4462
 		 *
4463 4463
 		 * @since 1.1.31
4464 4464
 		 *
4465 4465
 		 * @return bool True when preview page otherwise false.
4466 4466
 		 */
4467
-		public function is_bricks_preview() {
4468
-			$result = false;
4467
+		    public function is_bricks_preview() {
4468
+			    $result = false;
4469 4469
 
4470
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4471
-				$result = true;
4472
-			}
4470
+			    if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4471
+				    $result = true;
4472
+			    }
4473 4473
 
4474
-			return $result;
4475
-		}
4474
+			    return $result;
4475
+		    }
4476 4476
 
4477
-		/**
4477
+		    /**
4478 4478
 		 * General function to check if we are in a preview situation.
4479 4479
 		 *
4480 4480
 		 * @return bool
4481 4481
 		 *@since 1.0.6
4482 4482
 		 */
4483
-		public function is_preview() {
4484
-			$preview = false;
4485
-			if ( $this->is_divi_preview() ) {
4486
-				$preview = true;
4487
-			} elseif ( $this->is_elementor_preview() ) {
4488
-				$preview = true;
4489
-			} elseif ( $this->is_beaver_preview() ) {
4490
-				$preview = true;
4491
-			} elseif ( $this->is_siteorigin_preview() ) {
4492
-				$preview = true;
4493
-			} elseif ( $this->is_cornerstone_preview() ) {
4494
-				$preview = true;
4495
-			} elseif ( $this->is_fusion_preview() ) {
4496
-				$preview = true;
4497
-			} elseif ( $this->is_oxygen_preview() ) {
4498
-				$preview = true;
4499
-			} elseif( $this->is_kallyas_zion_preview() ) {
4500
-				$preview = true;
4501
-			} elseif( $this->is_block_content_call() ) {
4502
-				$preview = true;
4503
-			} elseif( $this->is_bricks_preview() ) {
4504
-				$preview = true;
4505
-			}
4506
-
4507
-			return $preview;
4508
-		}
4509
-
4510
-		/**
4483
+		    public function is_preview() {
4484
+			    $preview = false;
4485
+			    if ( $this->is_divi_preview() ) {
4486
+				    $preview = true;
4487
+			    } elseif ( $this->is_elementor_preview() ) {
4488
+				    $preview = true;
4489
+			    } elseif ( $this->is_beaver_preview() ) {
4490
+				    $preview = true;
4491
+			    } elseif ( $this->is_siteorigin_preview() ) {
4492
+				    $preview = true;
4493
+			    } elseif ( $this->is_cornerstone_preview() ) {
4494
+				    $preview = true;
4495
+			    } elseif ( $this->is_fusion_preview() ) {
4496
+				    $preview = true;
4497
+			    } elseif ( $this->is_oxygen_preview() ) {
4498
+				    $preview = true;
4499
+			    } elseif( $this->is_kallyas_zion_preview() ) {
4500
+				    $preview = true;
4501
+			    } elseif( $this->is_block_content_call() ) {
4502
+				    $preview = true;
4503
+			    } elseif( $this->is_bricks_preview() ) {
4504
+				    $preview = true;
4505
+			    }
4506
+
4507
+			    return $preview;
4508
+		    }
4509
+
4510
+		    /**
4511 4511
 		 * Output the super title.
4512 4512
 		 *
4513 4513
 		 * @param $args
@@ -4515,174 +4515,174 @@  discard block
 block discarded – undo
4515 4515
 		 *
4516 4516
 		 * @return string
4517 4517
 		 */
4518
-		public function output_title( $args, $instance = array() ) {
4519
-			$output = '';
4520
-			if ( ! empty( $instance['title'] ) ) {
4521
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4522
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4523
-
4524
-				if ( empty( $instance['widget_title_tag'] ) ) {
4525
-					if ( ! isset( $args['before_title'] ) ) {
4526
-						$args['before_title'] = '';
4527
-					}
4528
-
4529
-					if ( ! isset( $args['after_title'] ) ) {
4530
-						$args['after_title'] = '';
4531
-					}
4532
-
4533
-					$output = $args['before_title'] . $title . $args['after_title'];
4534
-				} else {
4535
-					$tag 			= esc_attr( $instance['widget_title_tag'] );
4536
-					$allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4537
-					$title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4538
-
4539
-					// classes
4540
-					$title_classes = array();
4541
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4542
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4543
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4544
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4545
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4546
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4547
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4548
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4549
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4550
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4551
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4552
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4553
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4554
-
4555
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4556
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
4557
-				}
4558
-
4559
-			}
4560
-
4561
-			return $output;
4562
-		}
4563
-
4564
-		/**
4518
+		    public function output_title( $args, $instance = array() ) {
4519
+			    $output = '';
4520
+			    if ( ! empty( $instance['title'] ) ) {
4521
+				    /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4522
+				    $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4523
+
4524
+				    if ( empty( $instance['widget_title_tag'] ) ) {
4525
+					    if ( ! isset( $args['before_title'] ) ) {
4526
+						    $args['before_title'] = '';
4527
+					    }
4528
+
4529
+					    if ( ! isset( $args['after_title'] ) ) {
4530
+						    $args['after_title'] = '';
4531
+					    }
4532
+
4533
+					    $output = $args['before_title'] . $title . $args['after_title'];
4534
+				    } else {
4535
+					    $tag 			= esc_attr( $instance['widget_title_tag'] );
4536
+					    $allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4537
+					    $title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4538
+
4539
+					    // classes
4540
+					    $title_classes = array();
4541
+					    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4542
+					    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4543
+					    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4544
+					    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4545
+					    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4546
+					    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4547
+					    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4548
+					    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4549
+					    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4550
+					    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4551
+					    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4552
+					    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4553
+					    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4554
+
4555
+					    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4556
+					    $output = "<$title_tag class='$class' >$title</$title_tag>";
4557
+				    }
4558
+
4559
+			    }
4560
+
4561
+			    return $output;
4562
+		    }
4563
+
4564
+		    /**
4565 4565
 		 * Outputs the options form inputs for the widget.
4566 4566
 		 *
4567 4567
 		 * @param array $instance The widget options.
4568 4568
 		 */
4569
-		public function form( $instance ) {
4569
+		    public function form( $instance ) {
4570 4570
 
4571
-			// set widget instance
4572
-			$this->instance = $instance;
4571
+			    // set widget instance
4572
+			    $this->instance = $instance;
4573 4573
 
4574
-			// set it as a SD widget
4575
-			echo $this->widget_advanced_toggle();
4574
+			    // set it as a SD widget
4575
+			    echo $this->widget_advanced_toggle();
4576 4576
 
4577
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4578
-			$arguments_raw = $this->get_arguments();
4577
+			    echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4578
+			    $arguments_raw = $this->get_arguments();
4579 4579
 
4580
-			if ( is_array( $arguments_raw ) ) {
4580
+			    if ( is_array( $arguments_raw ) ) {
4581 4581
 
4582
-				$arguments = $this->group_arguments( $arguments_raw );
4582
+				    $arguments = $this->group_arguments( $arguments_raw );
4583 4583
 
4584
-				// Do we have sections?
4585
-				$has_sections = $arguments == $arguments_raw ? false : true;
4584
+				    // Do we have sections?
4585
+				    $has_sections = $arguments == $arguments_raw ? false : true;
4586 4586
 
4587 4587
 
4588
-				if ( $has_sections ) {
4589
-					$panel_count = 0;
4590
-					foreach ( $arguments as $key => $args ) {
4588
+				    if ( $has_sections ) {
4589
+					    $panel_count = 0;
4590
+					    foreach ( $arguments as $key => $args ) {
4591 4591
 
4592
-						?>
4592
+						    ?>
4593 4593
 						<script>
4594 4594
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
4595 4595
 						</script>
4596 4596
 						<?php
4597 4597
 
4598
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
4599
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4600
-						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>";
4601
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4598
+						    $hide       = $panel_count ? ' style="display:none;" ' : '';
4599
+						    $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4600
+						    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>";
4601
+						    echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4602 4602
 
4603
-						foreach ( $args as $k => $a ) {
4603
+						    foreach ( $args as $k => $a ) {
4604 4604
 
4605
-							$this->widget_inputs_row_start($k, $a);
4606
-							$this->widget_inputs( $a, $instance );
4607
-							$this->widget_inputs_row_end($k, $a);
4605
+							    $this->widget_inputs_row_start($k, $a);
4606
+							    $this->widget_inputs( $a, $instance );
4607
+							    $this->widget_inputs_row_end($k, $a);
4608 4608
 
4609
-						}
4609
+						    }
4610 4610
 
4611
-						echo "</div>";
4611
+						    echo "</div>";
4612 4612
 
4613
-						$panel_count ++;
4613
+						    $panel_count ++;
4614 4614
 
4615
-					}
4616
-				} else {
4617
-					foreach ( $arguments as $key => $args ) {
4618
-						$this->widget_inputs_row_start($key, $args);
4619
-						$this->widget_inputs( $args, $instance );
4620
-						$this->widget_inputs_row_end($key, $args);
4621
-					}
4622
-				}
4615
+					    }
4616
+				    } else {
4617
+					    foreach ( $arguments as $key => $args ) {
4618
+						    $this->widget_inputs_row_start($key, $args);
4619
+						    $this->widget_inputs( $args, $instance );
4620
+						    $this->widget_inputs_row_end($key, $args);
4621
+					    }
4622
+				    }
4623 4623
 
4624
-			}
4625
-		}
4624
+			    }
4625
+		    }
4626 4626
 
4627
-		public function widget_inputs_row_start( $key, $args ) {
4628
-			if ( ! empty( $args['row'] ) ) {
4629
-				// Maybe open
4630
-				if ( ! empty( $args['row']['open'] ) ) {
4631
-					?>
4632
-					<div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'>
4627
+		    public function widget_inputs_row_start( $key, $args ) {
4628
+			    if ( ! empty( $args['row'] ) ) {
4629
+				    // Maybe open
4630
+				    if ( ! empty( $args['row']['open'] ) ) {
4631
+					    ?>
4632
+    					<div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'>
4633 4633
 					<?php if ( ! empty( $args['row']['title'] ) ) { ?>
4634
-					<?php
4635
-						if ( isset( $args['row']['icon'] ) ) {
4636
-							$args['row']['icon'] = '';
4637
-						}
4638
-
4639
-						if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4640
-							$args['row']['device_type'] = $args['device_type'];
4641
-						}
4642
-					?>
4643
-					<label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4634
+    					<?php
4635
+						    if ( isset( $args['row']['icon'] ) ) {
4636
+							    $args['row']['icon'] = '';
4637
+						    }
4638
+
4639
+						    if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4640
+							    $args['row']['device_type'] = $args['device_type'];
4641
+						    }
4642
+					    ?>
4643
+    					<label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4644 4644
 					<?php } ?>
4645
-					<div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'>
4645
+    					<div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'>
4646 4646
 					<div class='col pr-2'>
4647 4647
 					<?php
4648
-				} else if ( ! empty( $args['row']['close'] ) ) {
4649
-					echo "<div class='col pl-0 ps-0'>";
4650
-				} else {
4651
-					echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4652
-				}
4653
-			}
4654
-		}
4655
-
4656
-		public function widget_inputs_row_end( $key, $args ) {
4657
-			if ( ! empty( $args['row'] ) ) {
4658
-				// Maybe close
4659
-				if ( ! empty( $args['row']['close'] ) ) {
4660
-					echo "</div></div>";
4661
-				}
4662
-				echo "</div>";
4663
-			}
4664
-		}
4665
-
4666
-		/**
4648
+				    } else if ( ! empty( $args['row']['close'] ) ) {
4649
+					    echo "<div class='col pl-0 ps-0'>";
4650
+				    } else {
4651
+					    echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4652
+				    }
4653
+			    }
4654
+		    }
4655
+
4656
+		    public function widget_inputs_row_end( $key, $args ) {
4657
+			    if ( ! empty( $args['row'] ) ) {
4658
+				    // Maybe close
4659
+				    if ( ! empty( $args['row']['close'] ) ) {
4660
+					    echo "</div></div>";
4661
+				    }
4662
+				    echo "</div>";
4663
+			    }
4664
+		    }
4665
+
4666
+		    /**
4667 4667
 		 * Get the hidden input that when added makes the advanced button show on widget settings.
4668 4668
 		 *
4669 4669
 		 * @return string
4670 4670
 		 */
4671
-		public function widget_advanced_toggle() {
4671
+		    public function widget_advanced_toggle() {
4672 4672
 
4673
-			$output = '';
4674
-			if ( $this->block_show_advanced() ) {
4675
-				$val = 1;
4676
-			} else {
4677
-				$val = 0;
4678
-			}
4673
+			    $output = '';
4674
+			    if ( $this->block_show_advanced() ) {
4675
+				    $val = 1;
4676
+			    } else {
4677
+				    $val = 0;
4678
+			    }
4679 4679
 
4680
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4680
+			    $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4681 4681
 
4682
-			return $output;
4683
-		}
4682
+			    return $output;
4683
+		    }
4684 4684
 
4685
-		/**
4685
+		    /**
4686 4686
 		 * Convert require element.
4687 4687
 		 *
4688 4688
 		 * @param string $input Input element.
@@ -4691,67 +4691,67 @@  discard block
 block discarded – undo
4691 4691
 		 *@since 1.0.0
4692 4692
 		 *
4693 4693
 		 */
4694
-		public function convert_element_require( $input ) {
4695
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4694
+		    public function convert_element_require( $input ) {
4695
+			    $input = str_replace( "'", '"', $input );// we only want double quotes
4696 4696
 
4697
-			$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4698
-				"jQuery(form).find('[data-argument=\"",
4699
-				"\"]').find('input,select,textarea').val()",
4700
-				"\"]').find('input:checked').val()"
4701
-			), $input ) );
4697
+			    $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4698
+				    "jQuery(form).find('[data-argument=\"",
4699
+				    "\"]').find('input,select,textarea').val()",
4700
+				    "\"]').find('input:checked').val()"
4701
+			    ), $input ) );
4702 4702
 
4703
-			return $output;
4704
-		}
4703
+			    return $output;
4704
+		    }
4705 4705
 
4706
-		/**
4706
+		    /**
4707 4707
 		 * Builds the inputs for the widget options.
4708 4708
 		 *
4709 4709
 		 * @param $args
4710 4710
 		 * @param $instance
4711 4711
 		 */
4712
-		public function widget_inputs( $args, $instance ) {
4713
-
4714
-			$class             = "";
4715
-			$element_require   = "";
4716
-			$custom_attributes = "";
4717
-
4718
-			// get value
4719
-			if ( isset( $instance[ $args['name'] ] ) ) {
4720
-				$value = $instance[ $args['name'] ];
4721
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4722
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4723
-			} else {
4724
-				$value = '';
4725
-			}
4726
-
4727
-			// get placeholder
4728
-			if ( ! empty( $args['placeholder'] ) ) {
4729
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4730
-			} else {
4731
-				$placeholder = '';
4732
-			}
4733
-
4734
-			// get if advanced
4735
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4736
-				$class .= " sd-advanced-setting ";
4737
-			}
4738
-
4739
-			// element_require
4740
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4741
-				$element_require = $args['element_require'];
4742
-			}
4743
-
4744
-			// custom_attributes
4745
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4746
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4747
-			}
4748
-
4749
-			// before wrapper
4750
-			?>
4751
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'>
4712
+		    public function widget_inputs( $args, $instance ) {
4713
+
4714
+			    $class             = "";
4715
+			    $element_require   = "";
4716
+			    $custom_attributes = "";
4717
+
4718
+			    // get value
4719
+			    if ( isset( $instance[ $args['name'] ] ) ) {
4720
+				    $value = $instance[ $args['name'] ];
4721
+			    } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4722
+				    $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4723
+			    } else {
4724
+				    $value = '';
4725
+			    }
4726
+
4727
+			    // get placeholder
4728
+			    if ( ! empty( $args['placeholder'] ) ) {
4729
+				    $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4730
+			    } else {
4731
+				    $placeholder = '';
4732
+			    }
4733
+
4734
+			    // get if advanced
4735
+			    if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4736
+				    $class .= " sd-advanced-setting ";
4737
+			    }
4738
+
4739
+			    // element_require
4740
+			    if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4741
+				    $element_require = $args['element_require'];
4742
+			    }
4743
+
4744
+			    // custom_attributes
4745
+			    if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4746
+				    $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4747
+			    }
4748
+
4749
+			    // before wrapper
4750
+			    ?>
4751
+    			<p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'>
4752 4752
 			<?php
4753
-			switch ( $args['type'] ) {
4754
-				//array('text','password','number','email','tel','url','color')
4753
+			    switch ( $args['type'] ) {
4754
+				    //array('text','password','number','email','tel','url','color')
4755 4755
 				case "text":
4756 4756
 				case "password":
4757 4757
 				case "number":
@@ -4815,7 +4815,7 @@  discard block
 block discarded – undo
4815 4815
 					break;
4816 4816
 				default:
4817 4817
 					echo "No input type found!"; // @todo we need to add more input types.
4818
-			}
4818
+			    }
4819 4819
 			// after wrapper
4820 4820
 			?></p><?php
4821 4821
 		}
Please login to merge, or discard this patch.