Passed
Push — master ( 23c074...2114e2 )
by Brian
05:15
created
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 1 patch
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function input($args = array()){
21
+	public static function input($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'text',
24 24
 			'name'       => '',
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 		/**
53 53
 		 * Parse incoming $args into an array and merge it with $defaults
54 54
 		 */
55
-		$args   = wp_parse_args( $args, $defaults );
55
+		$args   = wp_parse_args($args, $defaults);
56 56
 		$output = '';
57
-		if ( ! empty( $args['type'] ) ) {
57
+		if (!empty($args['type'])) {
58 58
 			// hidden label option needs to be empty
59 59
 			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
60 60
 
61
-			$type = sanitize_html_class( $args['type'] );
61
+			$type = sanitize_html_class($args['type']);
62 62
 
63 63
 			$help_text = '';
64 64
 			$label = '';
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 			$label_args = array(
67 67
 				'title'=> $args['label'],
68 68
 				'for'=> $args['id'],
69
-				'class' => $args['label_class']." ",
69
+				'class' => $args['label_class'] . " ",
70 70
 				'label_type' => $args['label_type']
71 71
 			);
72 72
 
73 73
 			// floating labels need label after
74
-			if( $args['label_type'] == 'floating' && $type != 'checkbox' ){
74
+			if ($args['label_type'] == 'floating' && $type != 'checkbox') {
75 75
 				$label_after = true;
76 76
 				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
77 77
 			}
78 78
 
79 79
 			// Some special sauce for files
80
-			if($type=='file' ){
80
+			if ($type == 'file') {
81 81
 				$label_after = true; // if type file we need the label after
82 82
 				$args['class'] .= ' custom-file-input ';
83
-			}elseif($type=='checkbox'){
83
+			}elseif ($type == 'checkbox') {
84 84
 				$label_after = true; // if type file we need the label after
85 85
 				$args['class'] .= ' custom-control-input ';
86
-			}elseif($type=='datepicker' || $type=='timepicker'){
86
+			}elseif ($type == 'datepicker' || $type == 'timepicker') {
87 87
 				$type = 'text';
88 88
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
89 89
 				$args['class'] .= ' bg-initial ';
@@ -99,65 +99,65 @@  discard block
 block discarded – undo
99 99
 			$output .= '<input type="' . $type . '" ';
100 100
 
101 101
 			// name
102
-			if(!empty($args['name'])){
103
-				$output .= ' name="'.esc_attr($args['name']).'" ';
102
+			if (!empty($args['name'])) {
103
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
104 104
 			}
105 105
 
106 106
 			// id
107
-			if(!empty($args['id'])){
108
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
107
+			if (!empty($args['id'])) {
108
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
109 109
 			}
110 110
 
111 111
 			// placeholder
112
-			if(!empty($args['placeholder'])){
113
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
112
+			if (!empty($args['placeholder'])) {
113
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
114 114
 			}
115 115
 
116 116
 			// title
117
-			if(!empty($args['title'])){
118
-				$output .= ' title="'.esc_attr($args['title']).'" ';
117
+			if (!empty($args['title'])) {
118
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
119 119
 			}
120 120
 
121 121
 			// value
122
-			if(!empty($args['value'])){
123
-				$output .= ' value="'.sanitize_text_field($args['value']).'" ';
122
+			if (!empty($args['value'])) {
123
+				$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
124 124
 			}
125 125
 
126 126
 			// checked, for radio and checkboxes
127
-			if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
127
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
128 128
 				$output .= ' checked ';
129 129
 			}
130 130
 
131 131
 			// validation text
132
-			if(!empty($args['validation_text'])){
133
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
132
+			if (!empty($args['validation_text'])) {
133
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
134 134
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
135 135
 			}
136 136
 
137 137
 			// validation_pattern
138
-			if(!empty($args['validation_pattern'])){
139
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
138
+			if (!empty($args['validation_pattern'])) {
139
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
140 140
 			}
141 141
 
142 142
 			// step (for numbers)
143
-			if(!empty($args['step'])){
144
-				$output .= ' step="'.$args['step'].'" ';
143
+			if (!empty($args['step'])) {
144
+				$output .= ' step="' . $args['step'] . '" ';
145 145
 			}
146 146
 
147 147
 			// required
148
-			if(!empty($args['required'])){
148
+			if (!empty($args['required'])) {
149 149
 				$output .= ' required ';
150 150
 			}
151 151
 
152 152
 			// class
153
-			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
154
-			$output .= ' class="form-control '.$class.'" ';
153
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
154
+			$output .= ' class="form-control ' . $class . '" ';
155 155
 
156 156
 			// data-attributes
157 157
 			$output .= AUI_Component_Helper::data_attributes($args);
158 158
 
159 159
 			// extra attributes
160
-			if(!empty($args['extra_attributes'])){
160
+			if (!empty($args['extra_attributes'])) {
161 161
 				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
162 162
 			}
163 163
 
@@ -166,40 +166,40 @@  discard block
 block discarded – undo
166 166
 
167 167
 
168 168
 			// label
169
-			if(!empty($args['label'])){
170
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
171
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
172
-				$label = self::label( $label_args, $type );
169
+			if (!empty($args['label'])) {
170
+				if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; }
171
+				elseif ($type == 'checkbox') {$label_args['class'] .= 'custom-control-label'; }
172
+				$label = self::label($label_args, $type);
173 173
 			}
174 174
 
175 175
 			// help text
176
-			if(!empty($args['help_text'])){
176
+			if (!empty($args['help_text'])) {
177 177
 				$help_text = AUI_Component_Helper::help_text($args['help_text']);
178 178
 			}
179 179
 
180 180
 
181 181
 			// set help text in the correct possition
182
-			if($label_after){
182
+			if ($label_after) {
183 183
 				$output .= $label . $help_text;
184 184
 			}
185 185
 
186 186
 			// some input types need a separate wrap
187
-			if($type == 'file') {
188
-				$output = self::wrap( array(
187
+			if ($type == 'file') {
188
+				$output = self::wrap(array(
189 189
 					'content' => $output,
190 190
 					'class'   => 'form-group custom-file'
191
-				) );
192
-			}elseif($type == 'checkbox'){
191
+				));
192
+			}elseif ($type == 'checkbox') {
193 193
 				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
194
-				$output = self::wrap( array(
194
+				$output = self::wrap(array(
195 195
 					'content' => $output,
196
-					'class'   => 'custom-control '.$wrap_class
197
-				) );
196
+					'class'   => 'custom-control ' . $wrap_class
197
+				));
198 198
 
199
-				if($args['label_type']=='horizontal'){
199
+				if ($args['label_type'] == 'horizontal') {
200 200
 					$output = '<div class="col-sm-2 col-form-label"></div><div class="col-sm-10">' . $output . '</div>';
201 201
 				}
202
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
202
+			}elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
203 203
 
204 204
 
205 205
 				// allow password field to toggle view
@@ -213,49 +213,49 @@  discard block
 block discarded – undo
213 213
 			}
214 214
 
215 215
 			// input group wraps
216
-			if($args['input_group_left'] || $args['input_group_right']){
216
+			if ($args['input_group_left'] || $args['input_group_right']) {
217 217
 				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
218
-				if($args['input_group_left']){
219
-					$output = self::wrap( array(
218
+				if ($args['input_group_left']) {
219
+					$output = self::wrap(array(
220 220
 						'content' => $output,
221
-						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative'.$w100  : 'input-group',
221
+						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
222 222
 						'input_group_left' => $args['input_group_left'],
223 223
 						'input_group_left_inside'    => $args['input_group_left_inside']
224
-					) );
224
+					));
225 225
 				}
226
-				if($args['input_group_right']){
227
-					$output = self::wrap( array(
226
+				if ($args['input_group_right']) {
227
+					$output = self::wrap(array(
228 228
 						'content' => $output,
229
-						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative'.$w100 : 'input-group',
229
+						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
230 230
 						'input_group_right' => $args['input_group_right'],
231 231
 						'input_group_right_inside'    => $args['input_group_right_inside']
232
-					) );
232
+					));
233 233
 				}
234 234
 
235 235
 			}
236 236
 
237
-			if(!$label_after){
237
+			if (!$label_after) {
238 238
 				$output .= $help_text;
239 239
 			}
240 240
 
241 241
 
242
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
243
-				$output = self::wrap( array(
242
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
243
+				$output = self::wrap(array(
244 244
 					'content' => $output,
245 245
 					'class'   => 'col-sm-10',
246
-				) );
246
+				));
247 247
 			}
248 248
 
249
-			if(!$label_after){
249
+			if (!$label_after) {
250 250
 				$output = $label . $output;
251 251
 			}
252 252
 
253 253
 			// wrap
254
-			if(!$args['no_wrap']){
254
+			if (!$args['no_wrap']) {
255 255
 
256
-				$form_group_class = $args['label_type']=='floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
257
-				$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
258
-				$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
256
+				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
257
+				$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
258
+				$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
259 259
 				$output = self::wrap(array(
260 260
 					'content' => $output,
261 261
 					'class'   => $wrap_class,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @return string The rendered component.
280 280
 	 */
281
-	public static function textarea($args = array()){
281
+	public static function textarea($args = array()) {
282 282
 		$defaults = array(
283 283
 			'name'       => '',
284 284
 			'class'      => '',
@@ -304,43 +304,43 @@  discard block
 block discarded – undo
304 304
 		/**
305 305
 		 * Parse incoming $args into an array and merge it with $defaults
306 306
 		 */
307
-		$args   = wp_parse_args( $args, $defaults );
307
+		$args   = wp_parse_args($args, $defaults);
308 308
 		$output = '';
309 309
 
310 310
 		// hidden label option needs to be empty
311 311
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
312 312
 
313 313
 		// floating labels don't work with wysiwyg so set it as top
314
-		if($args['label_type'] == 'floating' && !empty($args['wysiwyg'])){
314
+		if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) {
315 315
 			$args['label_type'] = 'top';
316 316
 		}
317 317
 
318 318
 		$label_after = $args['label_after'];
319 319
 
320 320
 		// floating labels need label after
321
-		if( $args['label_type'] == 'floating' && empty($args['wysiwyg']) ){
321
+		if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) {
322 322
 			$label_after = true;
323 323
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
324 324
 		}
325 325
 
326 326
 		// label
327
-		if(!empty($args['label']) && is_array($args['label'])){
328
-		}elseif(!empty($args['label']) && !$label_after){
327
+		if (!empty($args['label']) && is_array($args['label'])) {
328
+		}elseif (!empty($args['label']) && !$label_after) {
329 329
 			$label_args = array(
330 330
 				'title'=> $args['label'],
331 331
 				'for'=> $args['id'],
332
-				'class' => $args['label_class']." ",
332
+				'class' => $args['label_class'] . " ",
333 333
 				'label_type' => $args['label_type']
334 334
 			);
335
-			$output .= self::label( $label_args );
335
+			$output .= self::label($label_args);
336 336
 		}
337 337
 
338 338
 		// maybe horizontal label
339
-		if($args['label_type']=='horizontal'){
339
+		if ($args['label_type'] == 'horizontal') {
340 340
 			$output .= '<div class="col-sm-10">';
341 341
 		}
342 342
 
343
-		if(!empty($args['wysiwyg'])){
343
+		if (!empty($args['wysiwyg'])) {
344 344
 			ob_start();
345 345
 			$content = $args['value'];
346 346
 			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
@@ -354,69 +354,69 @@  discard block
 block discarded – undo
354 354
 			);
355 355
 
356 356
 			// maybe set settings if array
357
-			if(is_array($args['wysiwyg'])){
358
-				$settings  = wp_parse_args( $args['wysiwyg'], $settings );
357
+			if (is_array($args['wysiwyg'])) {
358
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
359 359
 			}
360 360
 
361
-			wp_editor( $content, $editor_id, $settings );
361
+			wp_editor($content, $editor_id, $settings);
362 362
 			$output .= ob_get_clean();
363
-		}else{
363
+		} else {
364 364
 
365 365
 			// open
366 366
 			$output .= '<textarea ';
367 367
 
368 368
 			// name
369
-			if(!empty($args['name'])){
370
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
369
+			if (!empty($args['name'])) {
370
+				$output .= ' name="' . sanitize_html_class($args['name']) . '" ';
371 371
 			}
372 372
 
373 373
 			// id
374
-			if(!empty($args['id'])){
375
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
374
+			if (!empty($args['id'])) {
375
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
376 376
 			}
377 377
 
378 378
 			// placeholder
379
-			if(!empty($args['placeholder'])){
380
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
379
+			if (!empty($args['placeholder'])) {
380
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
381 381
 			}
382 382
 
383 383
 			// title
384
-			if(!empty($args['title'])){
385
-				$output .= ' title="'.esc_attr($args['title']).'" ';
384
+			if (!empty($args['title'])) {
385
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
386 386
 			}
387 387
 
388 388
 			// validation text
389
-			if(!empty($args['validation_text'])){
390
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
389
+			if (!empty($args['validation_text'])) {
390
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
391 391
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
392 392
 			}
393 393
 
394 394
 			// validation_pattern
395
-			if(!empty($args['validation_pattern'])){
396
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
395
+			if (!empty($args['validation_pattern'])) {
396
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
397 397
 			}
398 398
 
399 399
 			// required
400
-			if(!empty($args['required'])){
400
+			if (!empty($args['required'])) {
401 401
 				$output .= ' required ';
402 402
 			}
403 403
 
404 404
 			// rows
405
-			if(!empty($args['rows'])){
406
-				$output .= ' rows="'.absint($args['rows']).'" ';
405
+			if (!empty($args['rows'])) {
406
+				$output .= ' rows="' . absint($args['rows']) . '" ';
407 407
 			}
408 408
 
409 409
 
410 410
 			// class
411 411
 			$class = !empty($args['class']) ? $args['class'] : '';
412
-			$output .= ' class="form-control '.$class.'" ';
412
+			$output .= ' class="form-control ' . $class . '" ';
413 413
 
414 414
 
415 415
 			// close tag
416 416
 			$output .= ' >';
417 417
 
418 418
 			// value
419
-			if(!empty($args['value'])){
419
+			if (!empty($args['value'])) {
420 420
 				$output .= sanitize_textarea_field($args['value']);
421 421
 			}
422 422
 
@@ -425,32 +425,32 @@  discard block
 block discarded – undo
425 425
 
426 426
 		}
427 427
 
428
-		if(!empty($args['label']) && $label_after){
428
+		if (!empty($args['label']) && $label_after) {
429 429
 			$label_args = array(
430 430
 				'title'=> $args['label'],
431 431
 				'for'=> $args['id'],
432
-				'class' => $args['label_class']." ",
432
+				'class' => $args['label_class'] . " ",
433 433
 				'label_type' => $args['label_type']
434 434
 			);
435
-			$output .= self::label( $label_args );
435
+			$output .= self::label($label_args);
436 436
 		}
437 437
 
438 438
 		// help text
439
-		if(!empty($args['help_text'])){
439
+		if (!empty($args['help_text'])) {
440 440
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
441 441
 		}
442 442
 
443 443
 		// maybe horizontal label
444
-		if($args['label_type']=='horizontal'){
444
+		if ($args['label_type'] == 'horizontal') {
445 445
 			$output .= '</div>';
446 446
 		}
447 447
 
448 448
 
449 449
 		// wrap
450
-		if(!$args['no_wrap']){
451
-			$form_group_class = $args['label_type']=='floating' ? 'form-label-group' : 'form-group';
452
-			$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
453
-			$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
450
+		if (!$args['no_wrap']) {
451
+			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
452
+			$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
453
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
454 454
 			$output = self::wrap(array(
455 455
 				'content' => $output,
456 456
 				'class'   => $wrap_class,
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		return $output;
464 464
 	}
465 465
 
466
-	public static function label($args = array(), $type = ''){
466
+	public static function label($args = array(), $type = '') {
467 467
 		//<label for="exampleInputEmail1">Email address</label>
468 468
 		$defaults = array(
469 469
 			'title'       => 'div',
@@ -475,20 +475,20 @@  discard block
 block discarded – undo
475 475
 		/**
476 476
 		 * Parse incoming $args into an array and merge it with $defaults
477 477
 		 */
478
-		$args   = wp_parse_args( $args, $defaults );
478
+		$args   = wp_parse_args($args, $defaults);
479 479
 		$output = '';
480 480
 
481
-		if($args['title']){
481
+		if ($args['title']) {
482 482
 
483 483
 			// maybe hide labels //@todo set a global option for visibility class
484
-			if($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type']) ){
484
+			if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) {
485 485
 				$class = $args['class'];
486
-			}else{
487
-				$class = 'sr-only '.$args['class'];
486
+			} else {
487
+				$class = 'sr-only ' . $args['class'];
488 488
 			}
489 489
 
490 490
 			// maybe horizontal
491
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
491
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
492 492
 				$class .= ' col-sm-2 col-form-label';
493 493
 			}
494 494
 
@@ -496,20 +496,20 @@  discard block
 block discarded – undo
496 496
 			$output .= '<label ';
497 497
 
498 498
 			// for
499
-			if(!empty($args['for'])){
500
-				$output .= ' for="'.sanitize_text_field($args['for']).'" ';
499
+			if (!empty($args['for'])) {
500
+				$output .= ' for="' . sanitize_text_field($args['for']) . '" ';
501 501
 			}
502 502
 
503 503
 			// class
504
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
505
-			$output .= ' class="'.$class.'" ';
504
+			$class = $class ? AUI_Component_Helper::esc_classes($class) : '';
505
+			$output .= ' class="' . $class . '" ';
506 506
 
507 507
 			// close
508 508
 			$output .= '>';
509 509
 
510 510
 
511 511
 			// title, don't escape fully as can contain html
512
-			if(!empty($args['title'])){
512
+			if (!empty($args['title'])) {
513 513
 				$output .= wp_kses_post($args['title']);
514 514
 			}
515 515
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 *
531 531
 	 * @return string
532 532
 	 */
533
-	public static function wrap($args = array()){
533
+	public static function wrap($args = array()) {
534 534
 		$defaults = array(
535 535
 			'type'       => 'div',
536 536
 			'class'      => 'form-group',
@@ -546,55 +546,55 @@  discard block
 block discarded – undo
546 546
 		/**
547 547
 		 * Parse incoming $args into an array and merge it with $defaults
548 548
 		 */
549
-		$args   = wp_parse_args( $args, $defaults );
549
+		$args   = wp_parse_args($args, $defaults);
550 550
 		$output = '';
551
-		if($args['type']){
551
+		if ($args['type']) {
552 552
 
553 553
 			// open
554
-			$output .= '<'.sanitize_html_class($args['type']);
554
+			$output .= '<' . sanitize_html_class($args['type']);
555 555
 
556 556
 			// element require
557
-			if(!empty($args['element_require'])){
557
+			if (!empty($args['element_require'])) {
558 558
 				$output .= AUI_Component_Helper::element_require($args['element_require']);
559 559
 				$args['class'] .= " aui-conditional-field";
560 560
 			}
561 561
 
562 562
 			// argument_id
563
-			if( !empty($args['argument_id']) ){
564
-				$output .= ' data-argument="'.esc_attr($args['argument_id']).'"';
563
+			if (!empty($args['argument_id'])) {
564
+				$output .= ' data-argument="' . esc_attr($args['argument_id']) . '"';
565 565
 			}
566 566
 
567 567
 			// class
568
-			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
569
-			$output .= ' class="'.$class.'" ';
568
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
569
+			$output .= ' class="' . $class . '" ';
570 570
 
571 571
 			// close wrap
572 572
 			$output .= ' >';
573 573
 
574 574
 
575 575
 			// Input group left
576
-			if(!empty($args['input_group_left'])){
576
+			if (!empty($args['input_group_left'])) {
577 577
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
578
-				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
579
-				$output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
578
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
579
+				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
580 580
 			}
581 581
 
582 582
 			// content
583 583
 			$output .= $args['content'];
584 584
 
585 585
 			// Input group right
586
-			if(!empty($args['input_group_right'])){
586
+			if (!empty($args['input_group_right'])) {
587 587
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
588
-				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
589
-				$output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
588
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
589
+				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
590 590
 			}
591 591
 
592 592
 
593 593
 			// close wrap
594
-			$output .= '</'.sanitize_html_class($args['type']).'>';
594
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
595 595
 
596 596
 
597
-		}else{
597
+		} else {
598 598
 			$output = $args['content'];
599 599
 		}
600 600
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 *
609 609
 	 * @return string The rendered component.
610 610
 	 */
611
-	public static function select($args = array()){
611
+	public static function select($args = array()) {
612 612
 		$defaults = array(
613 613
 			'class'      => '',
614 614
 			'wrap_class' => '',
@@ -634,11 +634,11 @@  discard block
 block discarded – undo
634 634
 		/**
635 635
 		 * Parse incoming $args into an array and merge it with $defaults
636 636
 		 */
637
-		$args   = wp_parse_args( $args, $defaults );
637
+		$args   = wp_parse_args($args, $defaults);
638 638
 		$output = '';
639 639
 
640 640
 		// for now lets hide floating labels
641
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'hidden';}
641
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'hidden'; }
642 642
 
643 643
 		// hidden label option needs to be empty
644 644
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
@@ -647,47 +647,47 @@  discard block
 block discarded – undo
647 647
 		$label_after = $args['label_after'];
648 648
 
649 649
 		// floating labels need label after
650
-		if( $args['label_type'] == 'floating' ){
650
+		if ($args['label_type'] == 'floating') {
651 651
 			$label_after = true;
652 652
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
653 653
 		}
654 654
 
655 655
 		// Maybe setup select2
656 656
 		$is_select2 = false;
657
-		if(!empty($args['select2'])){
657
+		if (!empty($args['select2'])) {
658 658
 			$args['class'] .= ' aui-select2';
659 659
 			$is_select2 = true;
660
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
660
+		}elseif (strpos($args['class'], 'aui-select2') !== false) {
661 661
 			$is_select2 = true;
662 662
 		}
663 663
 
664 664
 		// select2 tags
665
-		if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equals needed here for some reason
665
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason
666 666
 			$args['data-tags'] = 'true';
667 667
 			$args['data-token-separators'] = "[',']";
668 668
 			$args['multiple'] = true;
669 669
 		}
670 670
 
671 671
 		// select2 placeholder
672
-		if($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])){
672
+		if ($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])) {
673 673
 			$args['data-placeholder'] = esc_attr($args['placeholder']);
674 674
 			$args['data-allow-clear'] = empty($args['data-allow-clear']) ? true : esc_attr($args['data-allow-clear']);
675 675
 		}
676 676
 
677 677
 		// label
678
-		if(!empty($args['label']) && is_array($args['label'])){
679
-		}elseif(!empty($args['label']) && !$label_after){
678
+		if (!empty($args['label']) && is_array($args['label'])) {
679
+		}elseif (!empty($args['label']) && !$label_after) {
680 680
 			$label_args = array(
681 681
 				'title'=> $args['label'],
682 682
 				'for'=> $args['id'],
683
-				'class' => $args['label_class']." ",
683
+				'class' => $args['label_class'] . " ",
684 684
 				'label_type' => $args['label_type']
685 685
 			);
686 686
 			$output .= self::label($label_args);
687 687
 		}
688 688
 
689 689
 		// maybe horizontal label
690
-		if($args['label_type']=='horizontal'){
690
+		if ($args['label_type'] == 'horizontal') {
691 691
 			$output .= '<div class="col-sm-10">';
692 692
 		}
693 693
 
@@ -695,32 +695,32 @@  discard block
 block discarded – undo
695 695
 		$output .= '<select ';
696 696
 
697 697
 		// style
698
-		if($is_select2){
698
+		if ($is_select2) {
699 699
 			$output .= " style='width:100%;' ";
700 700
 		}
701 701
 
702 702
 		// element require
703
-		if(!empty($args['element_require'])){
703
+		if (!empty($args['element_require'])) {
704 704
 			$output .= AUI_Component_Helper::element_require($args['element_require']);
705 705
 			$args['class'] .= " aui-conditional-field";
706 706
 		}
707 707
 
708 708
 		// class
709 709
 		$class = !empty($args['class']) ? $args['class'] : '';
710
-		$output .= AUI_Component_Helper::class_attr('custom-select '.$class);
710
+		$output .= AUI_Component_Helper::class_attr('custom-select ' . $class);
711 711
 
712 712
 		// name
713
-		if(!empty($args['name'])){
714
-			$output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
713
+		if (!empty($args['name'])) {
714
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
715 715
 		}
716 716
 
717 717
 		// id
718
-		if(!empty($args['id'])){
718
+		if (!empty($args['id'])) {
719 719
 			$output .= AUI_Component_Helper::id($args['id']);
720 720
 		}
721 721
 
722 722
 		// title
723
-		if(!empty($args['title'])){
723
+		if (!empty($args['title'])) {
724 724
 			$output .= AUI_Component_Helper::title($args['title']);
725 725
 		}
726 726
 
@@ -731,17 +731,17 @@  discard block
 block discarded – undo
731 731
 		$output .= AUI_Component_Helper::aria_attributes($args);
732 732
 
733 733
 		// extra attributes
734
-		if(!empty($args['extra_attributes'])){
734
+		if (!empty($args['extra_attributes'])) {
735 735
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
736 736
 		}
737 737
 
738 738
 		// required
739
-		if(!empty($args['required'])){
739
+		if (!empty($args['required'])) {
740 740
 			$output .= ' required ';
741 741
 		}
742 742
 
743 743
 		// multiple
744
-		if(!empty($args['multiple'])){
744
+		if (!empty($args['multiple'])) {
745 745
 			$output .= ' multiple ';
746 746
 		}
747 747
 
@@ -749,21 +749,21 @@  discard block
 block discarded – undo
749 749
 		$output .= ' >';
750 750
 
751 751
 		// placeholder
752
-		if(!empty($args['placeholder']) && !$is_select2){
753
-			$output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
754
-		}elseif($is_select2 && !empty($args['placeholder'])){
752
+		if (!empty($args['placeholder']) && !$is_select2) {
753
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
754
+		}elseif ($is_select2 && !empty($args['placeholder'])) {
755 755
 			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
756 756
 		}
757 757
 
758 758
 		// Options
759
-		if(!empty($args['options'])){
759
+		if (!empty($args['options'])) {
760 760
 
761
-			if(!is_array($args['options'])){
761
+			if (!is_array($args['options'])) {
762 762
 				$output .= $args['options']; // not the preferred way but an option
763
-			}else{
764
-				foreach($args['options'] as $val => $name){
763
+			} else {
764
+				foreach ($args['options'] as $val => $name) {
765 765
 					$selected = '';
766
-					if(is_array($name)){
766
+					if (is_array($name)) {
767 767
 						if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
768 768
 							$option_label = isset($name['label']) ? $name['label'] : '';
769 769
 
@@ -771,23 +771,23 @@  discard block
 block discarded – undo
771 771
 						} else {
772 772
 							$option_label = isset($name['label']) ? $name['label'] : '';
773 773
 							$option_value = isset($name['value']) ? $name['value'] : '';
774
-							if(!empty($args['multiple']) && !empty($args['value']) && is_array($args['value']) ){
774
+							if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) {
775 775
 								$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
776
-							} elseif(!empty($args['value'])) {
777
-								$selected = selected($option_value,stripslashes_deep($args['value']), false);
776
+							} elseif (!empty($args['value'])) {
777
+								$selected = selected($option_value, stripslashes_deep($args['value']), false);
778 778
 							}
779 779
 
780 780
 							$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
781 781
 						}
782
-					}else{
783
-						if(!empty($args['value'])){
784
-							if(is_array($args['value'])){
785
-								$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
786
-							} elseif(!empty($args['value'])) {
787
-								$selected = selected( $args['value'], $val, false);
782
+					} else {
783
+						if (!empty($args['value'])) {
784
+							if (is_array($args['value'])) {
785
+								$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
786
+							} elseif (!empty($args['value'])) {
787
+								$selected = selected($args['value'], $val, false);
788 788
 							}
789 789
 						}
790
-						$output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';
790
+						$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';
791 791
 					}
792 792
 				}
793 793
 			}
@@ -797,31 +797,31 @@  discard block
 block discarded – undo
797 797
 		// closing tag
798 798
 		$output .= '</select>';
799 799
 
800
-		if(!empty($args['label']) && $label_after){
800
+		if (!empty($args['label']) && $label_after) {
801 801
 			$label_args = array(
802 802
 				'title'=> $args['label'],
803 803
 				'for'=> $args['id'],
804
-				'class' => $args['label_class']." ",
804
+				'class' => $args['label_class'] . " ",
805 805
 				'label_type' => $args['label_type']
806 806
 			);
807 807
 			$output .= self::label($label_args);
808 808
 		}
809 809
 
810 810
 		// help text
811
-		if(!empty($args['help_text'])){
811
+		if (!empty($args['help_text'])) {
812 812
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
813 813
 		}
814 814
 
815 815
 		// maybe horizontal label
816
-		if($args['label_type']=='horizontal'){
816
+		if ($args['label_type'] == 'horizontal') {
817 817
 			$output .= '</div>';
818 818
 		}
819 819
 
820 820
 
821 821
 		// wrap
822
-		if(!$args['no_wrap']){
823
-			$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
824
-			$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
822
+		if (!$args['no_wrap']) {
823
+			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
824
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
825 825
 			$output = self::wrap(array(
826 826
 				'content' => $output,
827 827
 				'class'   => $wrap_class,
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 *
842 842
 	 * @return string The rendered component.
843 843
 	 */
844
-	public static function radio($args = array()){
844
+	public static function radio($args = array()) {
845 845
 		$defaults = array(
846 846
 			'class'      => '',
847 847
 			'wrap_class' => '',
@@ -864,14 +864,14 @@  discard block
 block discarded – undo
864 864
 		/**
865 865
 		 * Parse incoming $args into an array and merge it with $defaults
866 866
 		 */
867
-		$args   = wp_parse_args( $args, $defaults );
867
+		$args = wp_parse_args($args, $defaults);
868 868
 
869 869
 		// for now lets use horizontal for floating
870
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'horizontal';}
870
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'horizontal'; }
871 871
 
872 872
 		$label_args = array(
873 873
 			'title'=> $args['label'],
874
-			'class' => $args['label_class']." pt-0 ",
874
+			'class' => $args['label_class'] . " pt-0 ",
875 875
 			'label_type' => $args['label_type']
876 876
 		);
877 877
 
@@ -880,36 +880,36 @@  discard block
 block discarded – undo
880 880
 
881 881
 
882 882
 		// label before
883
-		if(!empty($args['label'])){
884
-			$output .= self::label( $label_args, 'radio' );
883
+		if (!empty($args['label'])) {
884
+			$output .= self::label($label_args, 'radio');
885 885
 		}
886 886
 
887 887
 		// maybe horizontal label
888
-		if($args['label_type']=='horizontal'){
888
+		if ($args['label_type'] == 'horizontal') {
889 889
 			$output .= '<div class="col-sm-10">';
890 890
 		}
891 891
 
892
-		if(!empty($args['options'])){
892
+		if (!empty($args['options'])) {
893 893
 			$count = 0;
894
-			foreach($args['options'] as $value => $label){
894
+			foreach ($args['options'] as $value => $label) {
895 895
 				$option_args = $args;
896 896
 				$option_args['value'] = $value;
897 897
 				$option_args['label'] = $label;
898 898
 				$option_args['checked'] = $value == $args['value'] ? true : false;
899
-				$output .= self::radio_option($option_args,$count);
899
+				$output .= self::radio_option($option_args, $count);
900 900
 				$count++;
901 901
 			}
902 902
 		}
903 903
 
904 904
 		// maybe horizontal label
905
-		if($args['label_type']=='horizontal'){
905
+		if ($args['label_type'] == 'horizontal') {
906 906
 			$output .= '</div>';
907 907
 		}
908 908
 
909 909
 
910 910
 		// wrap
911
-		$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
912
-		$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
911
+		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
912
+		$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
913 913
 		$output = self::wrap(array(
914 914
 			'content' => $output,
915 915
 			'class'   => $wrap_class,
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	 *
929 929
 	 * @return string The rendered component.
930 930
 	 */
931
-	public static function radio_option($args = array(),$count = ''){
931
+	public static function radio_option($args = array(), $count = '') {
932 932
 		$defaults = array(
933 933
 			'class'      => '',
934 934
 			'id'         => '',
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 		/**
947 947
 		 * Parse incoming $args into an array and merge it with $defaults
948 948
 		 */
949
-		$args   = wp_parse_args( $args, $defaults );
949
+		$args   = wp_parse_args($args, $defaults);
950 950
 
951 951
 		$output = '';
952 952
 
@@ -957,27 +957,27 @@  discard block
 block discarded – undo
957 957
 		$output .= ' class="form-check-input" ';
958 958
 
959 959
 		// name
960
-		if(!empty($args['name'])){
960
+		if (!empty($args['name'])) {
961 961
 			$output .= AUI_Component_Helper::name($args['name']);
962 962
 		}
963 963
 
964 964
 		// id
965
-		if(!empty($args['id'])){
966
-			$output .= AUI_Component_Helper::id($args['id'].$count);
965
+		if (!empty($args['id'])) {
966
+			$output .= AUI_Component_Helper::id($args['id'] . $count);
967 967
 		}
968 968
 
969 969
 		// title
970
-		if(!empty($args['title'])){
970
+		if (!empty($args['title'])) {
971 971
 			$output .= AUI_Component_Helper::title($args['title']);
972 972
 		}
973 973
 
974 974
 		// value
975
-		if(isset($args['value'])){
976
-			$output .= ' value="'.sanitize_text_field($args['value']).'" ';
975
+		if (isset($args['value'])) {
976
+			$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
977 977
 		}
978 978
 
979 979
 		// checked, for radio and checkboxes
980
-		if( $args['checked'] ){
980
+		if ($args['checked']) {
981 981
 			$output .= ' checked ';
982 982
 		}
983 983
 
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
 		$output .= AUI_Component_Helper::aria_attributes($args);
989 989
 
990 990
 		// extra attributes
991
-		if(!empty($args['extra_attributes'])){
991
+		if (!empty($args['extra_attributes'])) {
992 992
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
993 993
 		}
994 994
 
995 995
 		// required
996
-		if(!empty($args['required'])){
996
+		if (!empty($args['required'])) {
997 997
 			$output .= ' required ';
998 998
 		}
999 999
 
@@ -1001,13 +1001,13 @@  discard block
 block discarded – undo
1001 1001
 		$output .= ' >';
1002 1002
 
1003 1003
 		// label
1004
-		if(!empty($args['label']) && is_array($args['label'])){
1005
-		}elseif(!empty($args['label'])){
1006
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id'].$count,'class'=>'form-check-label'),'radio');
1004
+		if (!empty($args['label']) && is_array($args['label'])) {
1005
+		}elseif (!empty($args['label'])) {
1006
+			$output .= self::label(array('title'=>$args['label'], 'for'=>$args['id'] . $count, 'class'=>'form-check-label'), 'radio');
1007 1007
 		}
1008 1008
 
1009 1009
 		// wrap
1010
-		if(!$args['no_wrap']){
1010
+		if (!$args['no_wrap']) {
1011 1011
 			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1012 1012
 			$output = self::wrap(array(
1013 1013
 				'content' => $output,
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 		 * @return AyeCode_UI_Settings - Main instance.
99 99
 		 */
100 100
 		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
101
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
102 102
 
103 103
 				self::$instance = new AyeCode_UI_Settings;
104 104
 
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+				add_action('init', array(self::$instance, 'init')); // set settings
106 106
 
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
107
+				if (is_admin()) {
108
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
109
+					add_action('admin_init', array(self::$instance, 'register_settings'));
110 110
 
111 111
 					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
113 113
 				}
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
117
+				do_action('ayecode_ui_settings_loaded');
118 118
 			}
119 119
 
120 120
 			return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		/**
124 124
 		 * Setup some constants.
125 125
 		 */
126
-		public function constants(){
126
+		public function constants() {
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129 129
 			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
@@ -143,24 +143,24 @@  discard block
 block discarded – undo
143 143
 			 *
144 144
 			 * We load super early in case there is a theme version that might change the colors
145 145
 			 */
146
-			if ( $this->settings['css'] ) {
147
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
146
+			if ($this->settings['css']) {
147
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1);
148 148
 			}
149
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
149
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
150
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
151 151
 			}
152 152
 
153 153
 			// maybe load JS
154
-			if ( $this->settings['js'] ) {
155
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
154
+			if ($this->settings['js']) {
155
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
156 156
 			}
157
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
158
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
157
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
158
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
159 159
 			}
160 160
 
161 161
 			// Maybe set the HTML font size
162
-			if ( $this->settings['html_font_size'] ) {
163
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
162
+			if ($this->settings['html_font_size']) {
163
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
164 164
 			}
165 165
 
166 166
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		 *
172 172
 		 * @return bool
173 173
 		 */
174
-		public function load_admin_scripts(){
174
+		public function load_admin_scripts() {
175 175
 			$result = true;
176 176
 
177
-			if(!empty($this->settings['disable_admin'])){
178
-				$url_parts = explode("\n",$this->settings['disable_admin']);
179
-				foreach($url_parts as $part){
180
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
177
+			if (!empty($this->settings['disable_admin'])) {
178
+				$url_parts = explode("\n", $this->settings['disable_admin']);
179
+				foreach ($url_parts as $part) {
180
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
181 181
 						return false; // return early, no point checking further
182 182
 					}
183 183
 				}
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 		/**
190 190
 		 * Add a html font size to the footer.
191 191
 		 */
192
-		public function html_font_size(){
192
+		public function html_font_size() {
193 193
 			$this->settings = $this->get_settings();
194
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
194
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
195 195
 		}
196 196
 
197 197
 		/**
@@ -201,18 +201,18 @@  discard block
 block discarded – undo
201 201
 
202 202
 			$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
203 203
 
204
-			if($this->settings[$css_setting]){
205
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
206
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
207
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
208
-				wp_enqueue_style( 'ayecode-ui' );
204
+			if ($this->settings[$css_setting]) {
205
+				$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
206
+				$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui.css' : $this->url . 'assets/css/ayecode-ui-compatibility.css';
207
+				wp_register_style('ayecode-ui', $url, array(), $this->latest);
208
+				wp_enqueue_style('ayecode-ui');
209 209
 
210 210
 				// flatpickr
211
-				wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
211
+				wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest);
212 212
 
213 213
 
214 214
 				// fix some wp-admin issues
215
-				if(is_admin()){
215
+				if (is_admin()) {
216 216
 					$custom_css = "
217 217
                 body{
218 218
                     background-color: #f1f1f1;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 						    padding: 0;
256 256
 						}
257 257
 					";
258
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
258
+					wp_add_inline_style('ayecode-ui', $custom_css);
259 259
 				}
260 260
 
261 261
 				// custom changes
262
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
262
+				wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
263 263
 
264 264
 			}
265 265
 		}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * If this remains small then its best to use this than to add another JS file.
271 271
 		 */
272
-		public function inline_script(){
272
+		public function inline_script() {
273 273
 			ob_start();
274 274
 			?>
275 275
 			<script>
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 			/*
764 764
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
765 765
 			 */
766
-			return str_replace( array(
766
+			return str_replace(array(
767 767
 				'<script>',
768 768
 				'</script>'
769
-			), '', $output );
769
+			), '', $output);
770 770
 		}
771 771
 
772 772
 		/**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 		 *
775 775
 		 * If this remains small then its best to use this than to add another JS file.
776 776
 		 */
777
-		public function inline_script_file_browser(){
777
+		public function inline_script_file_browser() {
778 778
 			ob_start();
779 779
 			?>
780 780
 			<script>
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
 			/*
790 790
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
791 791
 			 */
792
-			return str_replace( array(
792
+			return str_replace(array(
793 793
 				'<script>',
794 794
 				'</script>'
795
-			), '', $output );
795
+			), '', $output);
796 796
 		}
797 797
 
798 798
 		/**
@@ -803,40 +803,40 @@  discard block
 block discarded – undo
803 803
 			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
804 804
 
805 805
 			// select2
806
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
806
+			wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
807 807
 
808 808
 			// flatpickr
809
-			wp_register_script( 'flatpickr', $this->url.'assets/js/flatpickr.min.js', array(), $this->latest );
809
+			wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest);
810 810
 
811 811
 			// Bootstrap file browser
812
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
813
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
812
+			wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
813
+			wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
814 814
 
815 815
 			$load_inline = false;
816 816
 
817
-			if($this->settings[$js_setting]=='core-popper'){
817
+			if ($this->settings[$js_setting] == 'core-popper') {
818 818
 				// Bootstrap bundle
819
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
820
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
819
+				$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
820
+				wp_register_script('bootstrap-js-bundle', $url, array('select2', 'jquery'), $this->latest);
821 821
 				// if in admin then add to footer for compatibility.
822
-				is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle');
822
+				is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
823 823
 				$script = $this->inline_script();
824
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
825
-			}elseif($this->settings[$js_setting]=='popper'){
826
-				$url = $this->url.'assets/js/popper.min.js';
827
-				wp_register_script( 'bootstrap-js-popper', $url, array('select2','jquery'), $this->latest );
828
-				wp_enqueue_script( 'bootstrap-js-popper' );
824
+				wp_add_inline_script('bootstrap-js-bundle', $script);
825
+			}elseif ($this->settings[$js_setting] == 'popper') {
826
+				$url = $this->url . 'assets/js/popper.min.js';
827
+				wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->latest);
828
+				wp_enqueue_script('bootstrap-js-popper');
829 829
 				$load_inline = true;
830
-			}else{
830
+			} else {
831 831
 				$load_inline = true;
832 832
 			}
833 833
 
834 834
 			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
835
-			if($load_inline){
836
-				wp_register_script( 'bootstrap-dummy', '',array('select2','jquery') );
837
-				wp_enqueue_script( 'bootstrap-dummy' );
835
+			if ($load_inline) {
836
+				wp_register_script('bootstrap-dummy', '', array('select2', 'jquery'));
837
+				wp_enqueue_script('bootstrap-dummy');
838 838
 				$script = $this->inline_script();
839
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
839
+				wp_add_inline_script('bootstrap-dummy', $script);
840 840
 			}
841 841
 
842 842
 		}
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 		/**
845 845
 		 * Enqueue flatpickr if called.
846 846
 		 */
847
-		public function enqueue_flatpickr(){
848
-			wp_enqueue_style( 'flatpickr' );
849
-			wp_enqueue_script( 'flatpickr' );
847
+		public function enqueue_flatpickr() {
848
+			wp_enqueue_style('flatpickr');
849
+			wp_enqueue_script('flatpickr');
850 850
 		}
851 851
 
852 852
 		/**
@@ -858,15 +858,15 @@  discard block
 block discarded – undo
858 858
 
859 859
 			$url = '';
860 860
 			// check if we are inside a plugin
861
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
861
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
862 862
 
863 863
 			// add check in-case user has changed wp-content dir name.
864 864
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
865
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
866
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
865
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
866
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
867 867
 
868
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
869
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
868
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
869
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
870 870
 			}
871 871
 
872 872
 			return $url;
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		 * Register the database settings with WordPress.
877 877
 		 */
878 878
 		public function register_settings() {
879
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
879
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
880 880
 		}
881 881
 
882 882
 		/**
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 		 */
886 886
 		public function menu_item() {
887 887
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
888
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
888
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
889 889
 				$this,
890 890
 				'settings_page'
891
-			) );
891
+			));
892 892
 		}
893 893
 
894 894
 		/**
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 		 *
897 897
 		 * @return array
898 898
 		 */
899
-		public function theme_js_settings(){
899
+		public function theme_js_settings() {
900 900
 			return array(
901 901
 				'ayetheme' => 'popper',
902 902
 				'listimia' => 'required',
@@ -912,17 +912,17 @@  discard block
 block discarded – undo
912 912
 		 */
913 913
 		public function get_settings() {
914 914
 
915
-			$db_settings = get_option( 'ayecode-ui-settings' );
915
+			$db_settings = get_option('ayecode-ui-settings');
916 916
 			$js_default = 'core-popper';
917 917
 			$js_default_backend = $js_default;
918 918
 
919 919
 			// maybe set defaults (if no settings set)
920
-			if(empty($db_settings)){
921
-				$active_theme = strtolower( get_template() ); // active parent theme.
920
+			if (empty($db_settings)) {
921
+				$active_theme = strtolower(get_template()); // active parent theme.
922 922
 				$theme_js_settings = self::theme_js_settings();
923
-				if(isset($theme_js_settings[$active_theme])){
923
+				if (isset($theme_js_settings[$active_theme])) {
924 924
 					$js_default = $theme_js_settings[$active_theme];
925
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
925
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
926 926
 				}
927 927
 			}
928 928
 
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 				'disable_admin'     =>  '', // URL snippets to disable loading on admin
936 936
 			);
937 937
 
938
-			$settings = wp_parse_args( $db_settings, $defaults );
938
+			$settings = wp_parse_args($db_settings, $defaults);
939 939
 
940 940
 			/**
941 941
 			 * Filter the Bootstrap settings.
942 942
 			 *
943 943
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
944 944
 			 */
945
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
945
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
946 946
 		}
947 947
 
948 948
 
@@ -950,90 +950,90 @@  discard block
 block discarded – undo
950 950
 		 * The settings page html output.
951 951
 		 */
952 952
 		public function settings_page() {
953
-			if ( ! current_user_can( 'manage_options' ) ) {
954
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
953
+			if (!current_user_can('manage_options')) {
954
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
955 955
 			}
956 956
 			?>
957 957
 			<div class="wrap">
958 958
 				<h1><?php echo $this->name; ?></h1>
959
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
959
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", "aui"); ?></p>
960 960
 				<form method="post" action="options.php">
961 961
 					<?php
962
-					settings_fields( 'ayecode-ui-settings' );
963
-					do_settings_sections( 'ayecode-ui-settings' );
962
+					settings_fields('ayecode-ui-settings');
963
+					do_settings_sections('ayecode-ui-settings');
964 964
 					?>
965 965
 
966
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
966
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
967 967
 					<table class="form-table wpbs-table-settings">
968 968
 						<tr valign="top">
969 969
 							<th scope="row"><label
970
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
970
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
971 971
 							<td>
972 972
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
973
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
974
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
975
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
973
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
974
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
975
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
976 976
 								</select>
977 977
 							</td>
978 978
 						</tr>
979 979
 
980 980
 						<tr valign="top">
981 981
 							<th scope="row"><label
982
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
982
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
983 983
 							<td>
984 984
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
985
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
986
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
987
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
988
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
985
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
986
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
987
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
988
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
989 989
 								</select>
990 990
 							</td>
991 991
 						</tr>
992 992
 
993 993
 						<tr valign="top">
994 994
 							<th scope="row"><label
995
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
995
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
996 996
 							<td>
997
-								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" />
998
-								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.","aui");?></p>
997
+								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" />
998
+								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", "aui"); ?></p>
999 999
 							</td>
1000 1000
 						</tr>
1001 1001
 
1002 1002
 					</table>
1003 1003
 
1004
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1004
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1005 1005
 					<table class="form-table wpbs-table-settings">
1006 1006
 						<tr valign="top">
1007 1007
 							<th scope="row"><label
1008
-									for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1008
+									for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1009 1009
 							<td>
1010 1010
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1011
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
1012
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1013
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1011
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
1012
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1013
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1014 1014
 								</select>
1015 1015
 							</td>
1016 1016
 						</tr>
1017 1017
 
1018 1018
 						<tr valign="top">
1019 1019
 							<th scope="row"><label
1020
-									for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1020
+									for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1021 1021
 							<td>
1022 1022
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1023
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1024
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1025
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1026
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1023
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1024
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1025
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1026
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1027 1027
 								</select>
1028 1028
 							</td>
1029 1029
 						</tr>
1030 1030
 
1031 1031
 						<tr valign="top">
1032 1032
 							<th scope="row"><label
1033
-									for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1033
+									for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1034 1034
 							<td>
1035
-								<p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p>
1036
-								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin'];?></textarea>
1035
+								<p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p>
1036
+								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin']; ?></textarea>
1037 1037
 
1038 1038
 							</td>
1039 1039
 						</tr>
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 			<?php
1052 1052
 		}
1053 1053
 
1054
-		public function customizer_settings($wp_customize){
1054
+		public function customizer_settings($wp_customize) {
1055 1055
 			$wp_customize->add_section('aui_settings', array(
1056
-				'title'    => __('AyeCode UI','aui'),
1056
+				'title'    => __('AyeCode UI', 'aui'),
1057 1057
 				'priority' => 120,
1058 1058
 			));
1059 1059
 
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
 				'type'              => 'option',
1068 1068
 				'transport'         => 'refresh',
1069 1069
 			));
1070
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1071
-				'label'    => __('Primary Color','aui'),
1070
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1071
+				'label'    => __('Primary Color', 'aui'),
1072 1072
 				'section'  => 'aui_settings',
1073 1073
 				'settings' => 'aui_options[color_primary]',
1074 1074
 			)));
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 				'type'              => 'option',
1081 1081
 				'transport'         => 'refresh',
1082 1082
 			));
1083
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1084
-				'label'    => __('Secondary Color','aui'),
1083
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1084
+				'label'    => __('Secondary Color', 'aui'),
1085 1085
 				'section'  => 'aui_settings',
1086 1086
 				'settings' => 'aui_options[color_secondary]',
1087 1087
 			)));
@@ -1099,12 +1099,12 @@  discard block
 block discarded – undo
1099 1099
 			?>
1100 1100
 			<style>
1101 1101
 				<?php
1102
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1103
-						echo self::css_primary($primary_color,$compatibility);
1102
+					if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) {
1103
+						echo self::css_primary($primary_color, $compatibility);
1104 1104
 					}
1105 1105
 
1106
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1107
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1106
+					if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) {
1107
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
1108 1108
 					}
1109 1109
                 ?>
1110 1110
 			</style>
@@ -1114,50 +1114,50 @@  discard block
 block discarded – undo
1114 1114
 			/*
1115 1115
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1116 1116
 			 */
1117
-			return str_replace( array(
1117
+			return str_replace(array(
1118 1118
 				'<style>',
1119 1119
 				'</style>'
1120 1120
 			), '', ob_get_clean());
1121 1121
 		}
1122 1122
 
1123
-		public static function css_primary($color_code,$compatibility){;
1123
+		public static function css_primary($color_code, $compatibility) {;
1124 1124
 			$color_code = sanitize_hex_color($color_code);
1125
-			if(!$color_code){return '';}
1125
+			if (!$color_code) {return ''; }
1126 1126
 			/**
1127 1127
 			 * c = color, b = background color, o = border-color, f = fill
1128 1128
 			 */
1129 1129
 			$selectors = array(
1130 1130
 				'a' => array('c'),
1131
-				'.btn-primary' => array('b','o'),
1132
-				'.btn-primary.disabled' => array('b','o'),
1133
-				'.btn-primary:disabled' => array('b','o'),
1134
-				'.btn-outline-primary' => array('c','o'),
1135
-				'.btn-outline-primary:hover' => array('b','o'),
1136
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1137
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1138
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1131
+				'.btn-primary' => array('b', 'o'),
1132
+				'.btn-primary.disabled' => array('b', 'o'),
1133
+				'.btn-primary:disabled' => array('b', 'o'),
1134
+				'.btn-outline-primary' => array('c', 'o'),
1135
+				'.btn-outline-primary:hover' => array('b', 'o'),
1136
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1137
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1138
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1139 1139
 				'.btn-link' => array('c'),
1140 1140
 				'.dropdown-item.active' => array('b'),
1141
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1142
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1141
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1142
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1143 1143
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1144 1144
 //				'.custom-range::-moz-range-thumb' => array('b'),
1145 1145
 //				'.custom-range::-ms-thumb' => array('b'),
1146 1146
 				'.nav-pills .nav-link.active' => array('b'),
1147 1147
 				'.nav-pills .show>.nav-link' => array('b'),
1148 1148
 				'.page-link' => array('c'),
1149
-				'.page-item.active .page-link' => array('b','o'),
1149
+				'.page-item.active .page-link' => array('b', 'o'),
1150 1150
 				'.badge-primary' => array('b'),
1151
-				'.alert-primary' => array('b','o'),
1151
+				'.alert-primary' => array('b', 'o'),
1152 1152
 				'.progress-bar' => array('b'),
1153
-				'.list-group-item.active' => array('b','o'),
1154
-				'.bg-primary' => array('b','f'),
1153
+				'.list-group-item.active' => array('b', 'o'),
1154
+				'.bg-primary' => array('b', 'f'),
1155 1155
 				'.btn-link.btn-primary' => array('c'),
1156 1156
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1157 1157
 			);
1158 1158
 
1159 1159
 			$important_selectors = array(
1160
-				'.bg-primary' => array('b','f'),
1160
+				'.bg-primary' => array('b', 'f'),
1161 1161
 				'.border-primary' => array('o'),
1162 1162
 				'.text-primary' => array('c'),
1163 1163
 			);
@@ -1174,116 +1174,116 @@  discard block
 block discarded – undo
1174 1174
 			$output = '';
1175 1175
 
1176 1176
 			// build rules into each type
1177
-			foreach($selectors as $selector => $types){
1178
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1179
-				$types = array_combine($types,$types);
1180
-				if(isset($types['c'])){$color[] = $selector;}
1181
-				if(isset($types['b'])){$background[] = $selector;}
1182
-				if(isset($types['o'])){$border[] = $selector;}
1183
-				if(isset($types['f'])){$fill[] = $selector;}
1177
+			foreach ($selectors as $selector => $types) {
1178
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1179
+				$types = array_combine($types, $types);
1180
+				if (isset($types['c'])) {$color[] = $selector; }
1181
+				if (isset($types['b'])) {$background[] = $selector; }
1182
+				if (isset($types['o'])) {$border[] = $selector; }
1183
+				if (isset($types['f'])) {$fill[] = $selector; }
1184 1184
 			}
1185 1185
 
1186 1186
 			// build rules into each type
1187
-			foreach($important_selectors as $selector => $types){
1188
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1189
-				$types = array_combine($types,$types);
1190
-				if(isset($types['c'])){$color_i[] = $selector;}
1191
-				if(isset($types['b'])){$background_i[] = $selector;}
1192
-				if(isset($types['o'])){$border_i[] = $selector;}
1193
-				if(isset($types['f'])){$fill_i[] = $selector;}
1187
+			foreach ($important_selectors as $selector => $types) {
1188
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1189
+				$types = array_combine($types, $types);
1190
+				if (isset($types['c'])) {$color_i[] = $selector; }
1191
+				if (isset($types['b'])) {$background_i[] = $selector; }
1192
+				if (isset($types['o'])) {$border_i[] = $selector; }
1193
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1194 1194
 			}
1195 1195
 
1196 1196
 			// add any color rules
1197
-			if(!empty($color)){
1198
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1197
+			if (!empty($color)) {
1198
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1199 1199
 			}
1200
-			if(!empty($color_i)){
1201
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1200
+			if (!empty($color_i)) {
1201
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1202 1202
 			}
1203 1203
 
1204 1204
 			// add any background color rules
1205
-			if(!empty($background)){
1206
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1205
+			if (!empty($background)) {
1206
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1207 1207
 			}
1208
-			if(!empty($background_i)){
1209
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1208
+			if (!empty($background_i)) {
1209
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1210 1210
 			}
1211 1211
 
1212 1212
 			// add any border color rules
1213
-			if(!empty($border)){
1214
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1213
+			if (!empty($border)) {
1214
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1215 1215
 			}
1216
-			if(!empty($border_i)){
1217
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1216
+			if (!empty($border_i)) {
1217
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1218 1218
 			}
1219 1219
 
1220 1220
 			// add any fill color rules
1221
-			if(!empty($fill)){
1222
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1221
+			if (!empty($fill)) {
1222
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1223 1223
 			}
1224
-			if(!empty($fill_i)){
1225
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1224
+			if (!empty($fill_i)) {
1225
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1226 1226
 			}
1227 1227
 
1228 1228
 
1229 1229
 			$prefix = $compatibility ? ".bsui " : "";
1230 1230
 
1231 1231
 			// darken
1232
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1233
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1234
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1232
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1233
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1234
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1235 1235
 
1236 1236
 			// lighten
1237
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1237
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1238 1238
 
1239 1239
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1240
-			$op_25 = $color_code."40"; // 25% opacity
1240
+			$op_25 = $color_code . "40"; // 25% opacity
1241 1241
 
1242 1242
 
1243 1243
 			// button states
1244
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1245
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1246
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1247
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1244
+			$output .= $prefix . " .btn-primary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1245
+			$output .= $prefix . " .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1246
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1247
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1248 1248
 
1249 1249
 
1250 1250
 			// dropdown's
1251
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1251
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1252 1252
 
1253 1253
 
1254 1254
 			// input states
1255
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1255
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1256 1256
 
1257 1257
 			// page link
1258
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1258
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1259 1259
 
1260 1260
 			return $output;
1261 1261
 		}
1262 1262
 
1263
-		public static function css_secondary($color_code,$compatibility){;
1263
+		public static function css_secondary($color_code, $compatibility) {;
1264 1264
 			$color_code = sanitize_hex_color($color_code);
1265
-			if(!$color_code){return '';}
1265
+			if (!$color_code) {return ''; }
1266 1266
 			/**
1267 1267
 			 * c = color, b = background color, o = border-color, f = fill
1268 1268
 			 */
1269 1269
 			$selectors = array(
1270
-				'.btn-secondary' => array('b','o'),
1271
-				'.btn-secondary.disabled' => array('b','o'),
1272
-				'.btn-secondary:disabled' => array('b','o'),
1273
-				'.btn-outline-secondary' => array('c','o'),
1274
-				'.btn-outline-secondary:hover' => array('b','o'),
1270
+				'.btn-secondary' => array('b', 'o'),
1271
+				'.btn-secondary.disabled' => array('b', 'o'),
1272
+				'.btn-secondary:disabled' => array('b', 'o'),
1273
+				'.btn-outline-secondary' => array('c', 'o'),
1274
+				'.btn-outline-secondary:hover' => array('b', 'o'),
1275 1275
 				'.btn-outline-secondary.disabled' => array('c'),
1276 1276
 				'.btn-outline-secondary:disabled' => array('c'),
1277
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1278
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1279
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1277
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1278
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1279
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
1280 1280
 				'.badge-secondary' => array('b'),
1281
-				'.alert-secondary' => array('b','o'),
1281
+				'.alert-secondary' => array('b', 'o'),
1282 1282
 				'.btn-link.btn-secondary' => array('c'),
1283 1283
 			);
1284 1284
 
1285 1285
 			$important_selectors = array(
1286
-				'.bg-secondary' => array('b','f'),
1286
+				'.bg-secondary' => array('b', 'f'),
1287 1287
 				'.border-secondary' => array('o'),
1288 1288
 				'.text-secondary' => array('c'),
1289 1289
 			);
@@ -1300,77 +1300,77 @@  discard block
 block discarded – undo
1300 1300
 			$output = '';
1301 1301
 
1302 1302
 			// build rules into each type
1303
-			foreach($selectors as $selector => $types){
1304
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1305
-				$types = array_combine($types,$types);
1306
-				if(isset($types['c'])){$color[] = $selector;}
1307
-				if(isset($types['b'])){$background[] = $selector;}
1308
-				if(isset($types['o'])){$border[] = $selector;}
1309
-				if(isset($types['f'])){$fill[] = $selector;}
1303
+			foreach ($selectors as $selector => $types) {
1304
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1305
+				$types = array_combine($types, $types);
1306
+				if (isset($types['c'])) {$color[] = $selector; }
1307
+				if (isset($types['b'])) {$background[] = $selector; }
1308
+				if (isset($types['o'])) {$border[] = $selector; }
1309
+				if (isset($types['f'])) {$fill[] = $selector; }
1310 1310
 			}
1311 1311
 
1312 1312
 			// build rules into each type
1313
-			foreach($important_selectors as $selector => $types){
1314
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1315
-				$types = array_combine($types,$types);
1316
-				if(isset($types['c'])){$color_i[] = $selector;}
1317
-				if(isset($types['b'])){$background_i[] = $selector;}
1318
-				if(isset($types['o'])){$border_i[] = $selector;}
1319
-				if(isset($types['f'])){$fill_i[] = $selector;}
1313
+			foreach ($important_selectors as $selector => $types) {
1314
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1315
+				$types = array_combine($types, $types);
1316
+				if (isset($types['c'])) {$color_i[] = $selector; }
1317
+				if (isset($types['b'])) {$background_i[] = $selector; }
1318
+				if (isset($types['o'])) {$border_i[] = $selector; }
1319
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1320 1320
 			}
1321 1321
 
1322 1322
 			// add any color rules
1323
-			if(!empty($color)){
1324
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1323
+			if (!empty($color)) {
1324
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1325 1325
 			}
1326
-			if(!empty($color_i)){
1327
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1326
+			if (!empty($color_i)) {
1327
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1328 1328
 			}
1329 1329
 
1330 1330
 			// add any background color rules
1331
-			if(!empty($background)){
1332
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1331
+			if (!empty($background)) {
1332
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1333 1333
 			}
1334
-			if(!empty($background_i)){
1335
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1334
+			if (!empty($background_i)) {
1335
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1336 1336
 			}
1337 1337
 
1338 1338
 			// add any border color rules
1339
-			if(!empty($border)){
1340
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1339
+			if (!empty($border)) {
1340
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1341 1341
 			}
1342
-			if(!empty($border_i)){
1343
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1342
+			if (!empty($border_i)) {
1343
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1344 1344
 			}
1345 1345
 
1346 1346
 			// add any fill color rules
1347
-			if(!empty($fill)){
1348
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1347
+			if (!empty($fill)) {
1348
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1349 1349
 			}
1350
-			if(!empty($fill_i)){
1351
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1350
+			if (!empty($fill_i)) {
1351
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1352 1352
 			}
1353 1353
 
1354 1354
 
1355 1355
 			$prefix = $compatibility ? ".bsui " : "";
1356 1356
 
1357 1357
 			// darken
1358
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1359
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1360
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1358
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1359
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1360
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1361 1361
 
1362 1362
 			// lighten
1363
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1363
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1364 1364
 
1365 1365
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1366
-			$op_25 = $color_code."40"; // 25% opacity
1366
+			$op_25 = $color_code . "40"; // 25% opacity
1367 1367
 
1368 1368
 
1369 1369
 			// button states
1370
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1371
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1372
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1373
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1370
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1371
+			$output .= $prefix . " .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1372
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1373
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1374 1374
 
1375 1375
 
1376 1376
 			return $output;
@@ -1406,8 +1406,8 @@  discard block
 block discarded – undo
1406 1406
 		/**
1407 1407
 		 * Check if we should display examples.
1408 1408
 		 */
1409
-		public function maybe_show_examples(){
1410
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1409
+		public function maybe_show_examples() {
1410
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1411 1411
 				echo "<head>";
1412 1412
 				wp_head();
1413 1413
 				echo "</head>";
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 		 *
1424 1424
 		 * @return string
1425 1425
 		 */
1426
-		public function get_examples(){
1426
+		public function get_examples() {
1427 1427
 			$output = '';
1428 1428
 
1429 1429
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.33";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
templates/wpinv-payment-processing.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 global $wpi_invoice;
3 3
 
4 4
 // Backwards compatibility.
5
-if ( empty( $invoice ) ) {
5
+if (empty($invoice)) {
6 6
     $invoice = $wpi_invoice;
7 7
 }
8 8
 
9 9
 $success_page_uri = wpinv_get_success_page_uri();
10
-if ( ! empty( $invoice ) ) {
10
+if (!empty($invoice)) {
11 11
     $success_page_uri = $invoice->get_receipt_url();
12 12
 }
13 13
 ?>
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
         <?php 
18 18
             echo
19 19
             wp_sprintf(
20
-                __( 'Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing' ),
21
-                esc_url( $success_page_uri )
20
+                __('Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing'),
21
+                esc_url($success_page_uri)
22 22
             );
23 23
         ?>
24 24
         <i class="fa fa-spin fa-refresh"></i>
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     <script type="text/javascript">
28 28
         setTimeout(
29 29
             function(){
30
-                window.location = '<?php echo esc_url( $success_page_uri ); ?>';
30
+                window.location = '<?php echo esc_url($success_page_uri); ?>';
31 31
             },
32 32
             10000
33 33
         );
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/items.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
     <label class='form-group'>
17 17
         <input v-model='active_form_element.hide_cart' type='checkbox' />
18
-        <span class='form-check-label'><?php esc_html_e( 'Hide cart details', 'invoicing' ); ?></span>
18
+        <span class='form-check-label'><?php esc_html_e('Hide cart details', 'invoicing'); ?></span>
19 19
     </label>
20 20
 
21 21
     <div class="mb-1">
22
-        <?php esc_html_e( 'Form Items', 'invoicing' ); ?>
22
+        <?php esc_html_e('Form Items', 'invoicing'); ?>
23 23
     </div>
24 24
 
25 25
     <draggable v-model='form_items' group='selectable_form_items'>
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
                 <div class='p-3'>
39 39
 
40 40
                     <span class='form-text'>
41
-                        <a target="_blank" :href="'<?php echo esc_url( admin_url( '/post.php?action=edit&post' ) ) ?>=' + item.id">
42
-                            <?php _e( 'Edit the item name, price and other details', 'invoicing' ); ?>
41
+                        <a target="_blank" :href="'<?php echo esc_url(admin_url('/post.php?action=edit&post')) ?>=' + item.id">
42
+                            <?php _e('Edit the item name, price and other details', 'invoicing'); ?>
43 43
                         </a>
44 44
                     </span>
45 45
 
46 46
                     <label class='form-group d-block'>
47 47
                         <input v-model='item.allow_quantities' type='checkbox' />
48
-                        <span><?php _e( 'Allow users to buy several quantities', 'invoicing' ); ?></span>
48
+                        <span><?php _e('Allow users to buy several quantities', 'invoicing'); ?></span>
49 49
                     </label>
50 50
 
51 51
                     <label class='form-group d-block'>
52 52
                         <input v-model='item.required' type='checkbox' />
53
-                        <span><?php _e( 'This item is required', 'invoicing' ); ?></span>
53
+                        <span><?php _e('This item is required', 'invoicing'); ?></span>
54 54
                     </label>
55 55
 
56
-                    <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e( 'Delete Item', 'invoicing' ); ?></button>
56
+                    <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e('Delete Item', 'invoicing'); ?></button>
57 57
 
58 58
                 </div>
59 59
             </div>
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
         </div>
62 62
     </draggable>
63 63
 
64
-    <small v-if='! form_items.length' class='form-text text-danger'><?php _e( 'You have not set up any items. Please select an item below or create a new item.', 'invoicing' ); ?></small>
64
+    <small v-if='! form_items.length' class='form-text text-danger'><?php _e('You have not set up any items. Please select an item below or create a new item.', 'invoicing'); ?></small>
65 65
 
66 66
     <div class="mt-4 mb-4">
67 67
 
68 68
         <div class="mb-2">
69 69
             <select class='w-100' v-init-item-search>
70
-                <option value="" selected="selected"><?php _e( 'Select an item to add...', 'invoicing' ) ?></option>
70
+                <option value="" selected="selected"><?php _e('Select an item to add...', 'invoicing') ?></option>
71 71
             </select>
72 72
 
73 73
         </div>
74 74
 
75
-        <button type="button" @click.prevent='addSelectedItem' class="button button-primary"><?php _e( 'Add Selected Item', 'invoicing' ) ?></button>
76
-        <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item.', 'invoicing' ) ?></a>
75
+        <button type="button" @click.prevent='addSelectedItem' class="button button-primary"><?php _e('Add Selected Item', 'invoicing') ?></button>
76
+        <a href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item.', 'invoicing') ?></a>
77 77
 
78 78
     </div>
79 79
 </div>
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 
83 83
     <label class="w-100 d-block">
84 84
 
85
-        <span><?php esc_html_e( 'Let customers...', 'invoicing' ) ?></span>
85
+        <span><?php esc_html_e('Let customers...', 'invoicing') ?></span>
86 86
 
87 87
         <select class='w-100' style="padding: 6px 24px 6px 8px; border-color: #e0e0e0;" v-model='active_form_element.items_type'>
88
-            <option value='total'><?php _e( 'Buy all items on the list', 'invoicing' ); ?></option>
89
-            <option value='radio'><?php _e( 'Select a single item from the list', 'invoicing' ); ?></option>
90
-            <option value='checkbox'><?php _e( 'Select one or more items on the list', 'invoicing' ) ;?></option>
91
-            <option value='select'><?php _e( 'Select a single item from a dropdown', 'invoicing' ); ?></option>
88
+            <option value='total'><?php _e('Buy all items on the list', 'invoicing'); ?></option>
89
+            <option value='radio'><?php _e('Select a single item from the list', 'invoicing'); ?></option>
90
+            <option value='checkbox'><?php _e('Select one or more items on the list', 'invoicing'); ?></option>
91
+            <option value='select'><?php _e('Select a single item from a dropdown', 'invoicing'); ?></option>
92 92
         </select>
93 93
 
94 94
     </label>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 <div class='form-group'>
99 99
     <label class="d-block">
100
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
101
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
100
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
101
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
102 102
     </label>
103 103
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/previews/items.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div v-if='!is_default'>
15
-    <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here. Click to set items.', 'invoicing' ) ?></div>
15
+    <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here. Click to set items.', 'invoicing') ?></div>
16 16
 </div>
17 17
 
18 18
 <div v-if='is_default'>
19
-    <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here.', 'invoicing' ) ?></div>
19
+    <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here.', 'invoicing') ?></div>
20 20
 </div>
Please login to merge, or discard this patch.
includes/class-wpinv-ajax.php 1 patch
Spacing   +213 added lines, -213 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
  * WPInv_Ajax class.
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	 * Hook in ajax handlers.
18 18
 	 */
19 19
 	public static function init() {
20
-		add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
21
-		add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 );
20
+		add_action('init', array(__CLASS__, 'define_ajax'), 0);
21
+		add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0);
22 22
 		self::add_ajax_events();
23 23
     }
24 24
 
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function define_ajax() {
29 29
 
30
-		if ( ! empty( $_GET['wpinv-ajax'] ) ) {
31
-			getpaid_maybe_define_constant( 'DOING_AJAX', true );
32
-			getpaid_maybe_define_constant( 'WPInv_DOING_AJAX', true );
33
-			if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
34
-				/** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 );
30
+		if (!empty($_GET['wpinv-ajax'])) {
31
+			getpaid_maybe_define_constant('DOING_AJAX', true);
32
+			getpaid_maybe_define_constant('WPInv_DOING_AJAX', true);
33
+			if (!WP_DEBUG || (WP_DEBUG && !WP_DEBUG_DISPLAY)) {
34
+				/** @scrutinizer ignore-unhandled */ @ini_set('display_errors', 0);
35 35
 			}
36 36
 			$GLOBALS['wpdb']->hide_errors();
37 37
 		}
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	 * @since 1.0.18
45 45
 	 */
46 46
 	private static function wpinv_ajax_headers() {
47
-		if ( ! headers_sent() ) {
47
+		if (!headers_sent()) {
48 48
 			send_origin_headers();
49 49
 			send_nosniff_header();
50 50
 			nocache_headers();
51
-			header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
52
-			header( 'X-Robots-Tag: noindex' );
53
-			status_header( 200 );
51
+			header('Content-Type: text/html; charset=' . get_option('blog_charset'));
52
+			header('X-Robots-Tag: noindex');
53
+			status_header(200);
54 54
 		}
55 55
     }
56 56
     
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	public static function do_wpinv_ajax() {
61 61
 		global $wp_query;
62 62
 
63
-		if ( ! empty( $_GET['wpinv-ajax'] ) ) {
64
-			$wp_query->set( 'wpinv-ajax', sanitize_text_field( wp_unslash( $_GET['wpinv-ajax'] ) ) );
63
+		if (!empty($_GET['wpinv-ajax'])) {
64
+			$wp_query->set('wpinv-ajax', sanitize_text_field(wp_unslash($_GET['wpinv-ajax'])));
65 65
 		}
66 66
 
67
-		$action = $wp_query->get( 'wpinv-ajax' );
67
+		$action = $wp_query->get('wpinv-ajax');
68 68
 
69
-		if ( $action ) {
69
+		if ($action) {
70 70
 			self::wpinv_ajax_headers();
71
-			$action = sanitize_text_field( $action );
72
-			do_action( 'wpinv_ajax_' . $action );
71
+			$action = sanitize_text_field($action);
72
+			do_action('wpinv_ajax_' . $action);
73 73
 			wp_die();
74 74
 		}
75 75
 
@@ -102,36 +102,36 @@  discard block
 block discarded – undo
102 102
             'ip_geolocation'              => true,
103 103
         );
104 104
 
105
-        foreach ( $ajax_events as $ajax_event => $nopriv ) {
106
-            add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
107
-            add_action( 'wp_ajax_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
105
+        foreach ($ajax_events as $ajax_event => $nopriv) {
106
+            add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
107
+            add_action('wp_ajax_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
108 108
 
109
-            if ( $nopriv ) {
110
-                add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
111
-                add_action( 'wp_ajax_nopriv_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
112
-                add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
109
+            if ($nopriv) {
110
+                add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
111
+                add_action('wp_ajax_nopriv_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
112
+                add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event));
113 113
             }
114 114
         }
115 115
     }
116 116
     
117 117
     public static function add_note() {
118
-        check_ajax_referer( 'add-invoice-note', '_nonce' );
118
+        check_ajax_referer('add-invoice-note', '_nonce');
119 119
 
120
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
120
+        if (!wpinv_current_user_can_manage_invoicing()) {
121 121
             die(-1);
122 122
         }
123 123
 
124
-        $post_id   = absint( $_POST['post_id'] );
125
-        $note      = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );
126
-        $note_type = sanitize_text_field( $_POST['note_type'] );
124
+        $post_id   = absint($_POST['post_id']);
125
+        $note      = wp_kses_post(trim(stripslashes($_POST['note'])));
126
+        $note_type = sanitize_text_field($_POST['note_type']);
127 127
 
128 128
         $is_customer_note = $note_type == 'customer' ? 1 : 0;
129 129
 
130
-        if ( $post_id > 0 ) {
131
-            $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note );
130
+        if ($post_id > 0) {
131
+            $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note);
132 132
 
133
-            if ( $note_id > 0 && !is_wp_error( $note_id ) ) {
134
-                wpinv_get_invoice_note_line_item( $note_id );
133
+            if ($note_id > 0 && !is_wp_error($note_id)) {
134
+                wpinv_get_invoice_note_line_item($note_id);
135 135
             }
136 136
         }
137 137
 
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
     }
140 140
 
141 141
     public static function delete_note() {
142
-        check_ajax_referer( 'delete-invoice-note', '_nonce' );
142
+        check_ajax_referer('delete-invoice-note', '_nonce');
143 143
 
144
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
144
+        if (!wpinv_current_user_can_manage_invoicing()) {
145 145
             die(-1);
146 146
         }
147 147
 
148
-        $note_id = (int)$_POST['note_id'];
148
+        $note_id = (int) $_POST['note_id'];
149 149
 
150
-        if ( $note_id > 0 ) {
151
-            wp_delete_comment( $note_id, true );
150
+        if ($note_id > 0) {
151
+            wp_delete_comment($note_id, true);
152 152
         }
153 153
 
154 154
         die();
@@ -166,34 +166,34 @@  discard block
 block discarded – undo
166 166
     public static function get_billing_details() {
167 167
 
168 168
         // Verify nonce.
169
-        check_ajax_referer( 'wpinv-nonce' );
169
+        check_ajax_referer('wpinv-nonce');
170 170
 
171 171
         // Can the user manage the plugin?
172
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
172
+        if (!wpinv_current_user_can_manage_invoicing()) {
173 173
             die(-1);
174 174
         }
175 175
 
176 176
         // Do we have a user id?
177 177
         $user_id = $_GET['user_id'];
178 178
 
179
-        if ( empty( $user_id ) || ! is_numeric( $user_id ) ) {
179
+        if (empty($user_id) || !is_numeric($user_id)) {
180 180
             die(-1);
181 181
         }
182 182
 
183 183
         // Fetch the billing details.
184
-        $billing_details    = wpinv_get_user_address( $user_id );
185
-        $billing_details    = apply_filters( 'wpinv_ajax_billing_details', $billing_details, $user_id );
184
+        $billing_details    = wpinv_get_user_address($user_id);
185
+        $billing_details    = apply_filters('wpinv_ajax_billing_details', $billing_details, $user_id);
186 186
 
187 187
         // unset the user id and email.
188
-        $to_ignore = array( 'user_id', 'email' );
188
+        $to_ignore = array('user_id', 'email');
189 189
 
190
-        foreach ( $to_ignore as $key ) {
191
-            if ( isset( $billing_details[ $key ] ) ) {
192
-                unset( $billing_details[ $key ] );
190
+        foreach ($to_ignore as $key) {
191
+            if (isset($billing_details[$key])) {
192
+                unset($billing_details[$key]);
193 193
             }
194 194
         }
195 195
 
196
-        wp_send_json_success( $billing_details );
196
+        wp_send_json_success($billing_details);
197 197
 
198 198
     }
199 199
 
@@ -203,47 +203,47 @@  discard block
 block discarded – undo
203 203
     public static function check_new_user_email() {
204 204
 
205 205
         // Verify nonce.
206
-        check_ajax_referer( 'wpinv-nonce' );
206
+        check_ajax_referer('wpinv-nonce');
207 207
 
208 208
         // Can the user manage the plugin?
209
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
209
+        if (!wpinv_current_user_can_manage_invoicing()) {
210 210
             die(-1);
211 211
         }
212 212
 
213 213
         // We need an email address.
214
-        if ( empty( $_GET['email'] ) ) {
215
-            _e( "Provide the new user's email address", 'invoicing' );
214
+        if (empty($_GET['email'])) {
215
+            _e("Provide the new user's email address", 'invoicing');
216 216
             exit;
217 217
         }
218 218
 
219 219
         // Ensure the email is valid.
220
-        $email = sanitize_text_field( $_GET['email'] );
221
-        if ( ! is_email( $email ) ) {
222
-            _e( 'Invalid email address', 'invoicing' );
220
+        $email = sanitize_text_field($_GET['email']);
221
+        if (!is_email($email)) {
222
+            _e('Invalid email address', 'invoicing');
223 223
             exit;
224 224
         }
225 225
 
226 226
         // And it does not exist.
227
-        if ( email_exists( $email ) ) {
228
-            _e( 'A user with this email address already exists', 'invoicing' );
227
+        if (email_exists($email)) {
228
+            _e('A user with this email address already exists', 'invoicing');
229 229
             exit;
230 230
         }
231 231
 
232
-        wp_send_json_success( true );
232
+        wp_send_json_success(true);
233 233
     }
234 234
     
235 235
     public static function run_tool() {
236
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
237
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
236
+        check_ajax_referer('wpinv-nonce', '_nonce');
237
+        if (!wpinv_current_user_can_manage_invoicing()) {
238 238
             die(-1);
239 239
         }
240 240
         
241
-        $tool = sanitize_text_field( $_POST['tool'] );
241
+        $tool = sanitize_text_field($_POST['tool']);
242 242
         
243
-        do_action( 'wpinv_run_tool' );
243
+        do_action('wpinv_run_tool');
244 244
         
245
-        if ( !empty( $tool ) ) {
246
-            do_action( 'wpinv_tool_' . $tool );
245
+        if (!empty($tool)) {
246
+            do_action('wpinv_tool_' . $tool);
247 247
         }
248 248
     }
249 249
 
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
     public static function get_payment_form() {
254 254
 
255 255
         // Check nonce.
256
-        if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'getpaid_ajax_form' ) ) {
257
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
256
+        if (!isset($_GET['nonce']) || !wp_verify_nonce($_GET['nonce'], 'getpaid_ajax_form')) {
257
+            _e('Error: Reload the page and try again.', 'invoicing');
258 258
             exit;
259 259
         }
260 260
 
261 261
         // Is the request set up correctly?
262
-		if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) {
262
+		if (empty($_GET['form']) && empty($_GET['item'])) {
263 263
 			echo aui()->alert(
264 264
 				array(
265 265
 					'type'    => 'warning',
266
-					'content' => __( 'No payment form or item provided', 'invoicing' ),
266
+					'content' => __('No payment form or item provided', 'invoicing'),
267 267
 				)
268 268
             );
269 269
             exit;
270 270
         }
271 271
 
272 272
         // Payment form or button?
273
-		if ( ! empty( $_GET['form'] ) ) {
274
-            getpaid_display_payment_form( $_GET['form'] );
275
-		} else if( ! empty( $_GET['invoice'] ) ) {
276
-		    getpaid_display_invoice_payment_form( $_GET['invoice'] );
273
+		if (!empty($_GET['form'])) {
274
+            getpaid_display_payment_form($_GET['form']);
275
+		} else if (!empty($_GET['invoice'])) {
276
+		    getpaid_display_invoice_payment_form($_GET['invoice']);
277 277
         } else {
278
-			$items = getpaid_convert_items_to_array( $_GET['item'] );
279
-		    getpaid_display_item_payment_form( $items );
278
+			$items = getpaid_convert_items_to_array($_GET['item']);
279
+		    getpaid_display_item_payment_form($items);
280 280
         }
281 281
 
282 282
         exit;
@@ -291,17 +291,17 @@  discard block
 block discarded – undo
291 291
     public static function payment_form() {
292 292
 
293 293
         // Check nonce.
294
-        check_ajax_referer( 'getpaid_form_nonce' );
294
+        check_ajax_referer('getpaid_form_nonce');
295 295
 
296 296
         // ... form fields...
297
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
298
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
297
+        if (empty($_POST['getpaid_payment_form_submission'])) {
298
+            _e('Error: Reload the page and try again.', 'invoicing');
299 299
             exit;
300 300
         }
301 301
 
302 302
         // Process the payment form.
303
-        $checkout_class = apply_filters( 'getpaid_checkout_class', 'GetPaid_Checkout' );
304
-        $checkout       = new $checkout_class( new GetPaid_Payment_Form_Submission() );
303
+        $checkout_class = apply_filters('getpaid_checkout_class', 'GetPaid_Checkout');
304
+        $checkout       = new $checkout_class(new GetPaid_Payment_Form_Submission());
305 305
         $checkout->process_checkout();
306 306
 
307 307
         exit;
@@ -314,51 +314,51 @@  discard block
 block discarded – undo
314 314
      */
315 315
     public static function get_payment_form_states_field() {
316 316
 
317
-        if ( empty( $_GET['country'] ) || empty( $_GET['form'] ) ) {
317
+        if (empty($_GET['country']) || empty($_GET['form'])) {
318 318
             exit;
319 319
         }
320 320
 
321
-        $elements = getpaid_get_payment_form_elements( $_GET['form'] );
321
+        $elements = getpaid_get_payment_form_elements($_GET['form']);
322 322
 
323
-        if ( empty( $elements ) ) {
323
+        if (empty($elements)) {
324 324
             exit;
325 325
         }
326 326
 
327 327
         $address_fields = array();
328
-        foreach ( $elements as $element ) {
329
-            if ( 'address' === $element['type'] ) {
328
+        foreach ($elements as $element) {
329
+            if ('address' === $element['type']) {
330 330
                 $address_fields = $element;
331 331
                 break;
332 332
             }
333 333
         }
334 334
 
335
-        if ( empty( $address_fields ) ) {
335
+        if (empty($address_fields)) {
336 336
             exit;
337 337
         }
338 338
 
339
-        foreach( $address_fields['fields'] as $address_field ) {
339
+        foreach ($address_fields['fields'] as $address_field) {
340 340
 
341
-            if ( 'wpinv_state' == $address_field['name'] ) {
341
+            if ('wpinv_state' == $address_field['name']) {
342 342
 
343 343
                 $label = $address_field['label'];
344 344
 
345
-                if ( ! empty( $address_field['required'] ) ) {
345
+                if (!empty($address_field['required'])) {
346 346
                     $label .= "<span class='text-danger'> *</span>";
347 347
                 }
348 348
 
349
-                $states = wpinv_get_country_states( $_GET['country'] );
349
+                $states = wpinv_get_country_states($_GET['country']);
350 350
 
351
-                if ( ! empty( $states ) ) {
351
+                if (!empty($states)) {
352 352
 
353 353
                     $html = aui()->select(
354 354
                             array(
355 355
                                 'options'          => $states,
356
-                                'name'             => esc_attr( $address_field['name'] ),
357
-                                'id'               => esc_attr( $address_field['name'] ),
358
-                                'placeholder'      => esc_attr( $address_field['placeholder'] ),
356
+                                'name'             => esc_attr($address_field['name']),
357
+                                'id'               => esc_attr($address_field['name']),
358
+                                'placeholder'      => esc_attr($address_field['placeholder']),
359 359
                                 'required'         => (bool) $address_field['required'],
360 360
                                 'no_wrap'          => true,
361
-                                'label'            => wp_kses_post( $label ),
361
+                                'label'            => wp_kses_post($label),
362 362
                                 'select2'          => false,
363 363
                             )
364 364
                         );
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
 
368 368
                     $html = aui()->input(
369 369
                             array(
370
-                                'name'       => esc_attr( $address_field['name'] ),
371
-                                'id'         => esc_attr( $address_field['name'] ),
370
+                                'name'       => esc_attr($address_field['name']),
371
+                                'id'         => esc_attr($address_field['name']),
372 372
                                 'required'   => (bool) $address_field['required'],
373
-                                'label'      => wp_kses_post( $label ),
373
+                                'label'      => wp_kses_post($label),
374 374
                                 'no_wrap'    => true,
375 375
                                 'type'       => 'text',
376 376
                             )
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
                 }
380 380
 
381
-                wp_send_json_success( str_replace( 'sr-only', '', $html ) );
381
+                wp_send_json_success(str_replace('sr-only', '', $html));
382 382
                 exit;
383 383
 
384 384
             }
@@ -394,56 +394,56 @@  discard block
 block discarded – undo
394 394
     public static function recalculate_invoice_totals() {
395 395
 
396 396
         // Verify nonce.
397
-        check_ajax_referer( 'wpinv-nonce' );
397
+        check_ajax_referer('wpinv-nonce');
398 398
 
399
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
399
+        if (!wpinv_current_user_can_manage_invoicing()) {
400 400
             exit;
401 401
         }
402 402
 
403 403
         // We need an invoice.
404
-        if ( empty( $_POST['post_id'] ) ) {
404
+        if (empty($_POST['post_id'])) {
405 405
             exit;
406 406
         }
407 407
 
408 408
         // Fetch the invoice.
409
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
409
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
410 410
 
411 411
         // Ensure it exists.
412
-        if ( ! $invoice->get_id() ) {
412
+        if (!$invoice->get_id()) {
413 413
             exit;
414 414
         }
415 415
 
416 416
         // Maybe set the country, state, currency.
417
-        foreach ( array( 'country', 'state', 'currency' ) as $key ) {
418
-            if ( isset( $_POST[ $key ] ) ) {
417
+        foreach (array('country', 'state', 'currency') as $key) {
418
+            if (isset($_POST[$key])) {
419 419
                 $method = "set_$key";
420
-                $invoice->$method( $_POST[ $key ] );
420
+                $invoice->$method($_POST[$key]);
421 421
             }
422 422
         }
423 423
 
424 424
         // Maybe disable taxes.
425
-        $invoice->set_disable_taxes( ! empty( $_POST['taxes'] ) );
425
+        $invoice->set_disable_taxes(!empty($_POST['taxes']));
426 426
 
427 427
         // Recalculate totals.
428 428
         $invoice->recalculate_total();
429 429
 
430
-        $total = wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() );
430
+        $total = wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency());
431 431
 
432
-        if ( $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total() ) {
433
-            $recurring_total = wpinv_price( wpinv_format_amount( $invoice->get_recurring_total() ), $invoice->get_currency() );
434
-            $total          .= '<small class="form-text text-muted">' . sprintf( __( 'Recurring Price: %s', 'invoicing' ), $recurring_total ) . '</small>';
432
+        if ($invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total()) {
433
+            $recurring_total = wpinv_price(wpinv_format_amount($invoice->get_recurring_total()), $invoice->get_currency());
434
+            $total          .= '<small class="form-text text-muted">' . sprintf(__('Recurring Price: %s', 'invoicing'), $recurring_total) . '</small>';
435 435
         }
436 436
 
437 437
         $totals = array(
438
-            'subtotal' => wpinv_price( wpinv_format_amount( $invoice->get_subtotal() ), $invoice->get_currency() ),
439
-            'discount' => wpinv_price( wpinv_format_amount( $invoice->get_total_discount() ), $invoice->get_currency() ),
440
-            'tax'      => wpinv_price( wpinv_format_amount( $invoice->get_total_tax() ), $invoice->get_currency() ),
438
+            'subtotal' => wpinv_price(wpinv_format_amount($invoice->get_subtotal()), $invoice->get_currency()),
439
+            'discount' => wpinv_price(wpinv_format_amount($invoice->get_total_discount()), $invoice->get_currency()),
440
+            'tax'      => wpinv_price(wpinv_format_amount($invoice->get_total_tax()), $invoice->get_currency()),
441 441
             'total'    => $total,
442 442
         );
443 443
 
444
-        $totals = apply_filters( 'getpaid_invoice_totals', $totals, $invoice );
444
+        $totals = apply_filters('getpaid_invoice_totals', $totals, $invoice);
445 445
 
446
-        wp_send_json_success( compact( 'totals' ) );
446
+        wp_send_json_success(compact('totals'));
447 447
     }
448 448
 
449 449
     /**
@@ -452,33 +452,33 @@  discard block
 block discarded – undo
452 452
     public static function get_invoice_items() {
453 453
 
454 454
         // Verify nonce.
455
-        check_ajax_referer( 'wpinv-nonce' );
455
+        check_ajax_referer('wpinv-nonce');
456 456
 
457
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
457
+        if (!wpinv_current_user_can_manage_invoicing()) {
458 458
             exit;
459 459
         }
460 460
 
461 461
         // We need an invoice and items.
462
-        if ( empty( $_POST['post_id'] ) ) {
462
+        if (empty($_POST['post_id'])) {
463 463
             exit;
464 464
         }
465 465
 
466 466
         // Fetch the invoice.
467
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
467
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
468 468
 
469 469
         // Ensure it exists.
470
-        if ( ! $invoice->get_id() ) {
470
+        if (!$invoice->get_id()) {
471 471
             exit;
472 472
         }
473 473
 
474 474
         // Return an array of invoice items.
475 475
         $items = array();
476 476
 
477
-        foreach ( $invoice->get_items() as $item_id => $item ) {
478
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency()  );
477
+        foreach ($invoice->get_items() as $item_id => $item) {
478
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
479 479
         }
480 480
 
481
-        wp_send_json_success( compact( 'items' ) );
481
+        wp_send_json_success(compact('items'));
482 482
     }
483 483
 
484 484
     /**
@@ -487,50 +487,50 @@  discard block
 block discarded – undo
487 487
     public static function edit_invoice_item() {
488 488
 
489 489
         // Verify nonce.
490
-        check_ajax_referer( 'wpinv-nonce' );
490
+        check_ajax_referer('wpinv-nonce');
491 491
 
492
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
492
+        if (!wpinv_current_user_can_manage_invoicing()) {
493 493
             exit;
494 494
         }
495 495
 
496 496
         // We need an invoice and item details.
497
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) {
497
+        if (empty($_POST['post_id']) || empty($_POST['data'])) {
498 498
             exit;
499 499
         }
500 500
 
501 501
         // Fetch the invoice.
502
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
502
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
503 503
 
504 504
         // Ensure it exists and its not been paid for.
505
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
505
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
506 506
             exit;
507 507
         }
508 508
 
509 509
         // Format the data.
510
-        $data = wp_list_pluck( $_POST['data'], 'value', 'field' );
510
+        $data = wp_list_pluck($_POST['data'], 'value', 'field');
511 511
 
512 512
         // Ensure that we have an item id.
513
-        if ( empty( $data['id'] ) ) {
513
+        if (empty($data['id'])) {
514 514
             exit;
515 515
         }
516 516
 
517 517
         // Abort if the invoice does not have the specified item.
518
-        $item = $invoice->get_item( (int) $data['id'] );
518
+        $item = $invoice->get_item((int) $data['id']);
519 519
 
520
-        if ( empty( $item ) ) {
520
+        if (empty($item)) {
521 521
             exit;
522 522
         }
523 523
 
524 524
         // Update the item.
525
-        $item->set_price( $data['price'] );
526
-        $item->set_name( $data['name'] );
527
-        $item->set_description( $data['description'] );
528
-        $item->set_quantity( $data['quantity'] );
525
+        $item->set_price($data['price']);
526
+        $item->set_name($data['name']);
527
+        $item->set_description($data['description']);
528
+        $item->set_quantity($data['quantity']);
529 529
 
530 530
         // Add it to the invoice.
531
-        $error = $invoice->add_item( $item );
531
+        $error = $invoice->add_item($item);
532 532
         $alert = false;
533
-        if ( is_wp_error( $error ) ) {
533
+        if (is_wp_error($error)) {
534 534
             $alert = $error->get_error_message();
535 535
         }
536 536
 
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
         // Return an array of invoice items.
544 544
         $items = array();
545 545
 
546
-        foreach ( $invoice->get_items() as $item_id => $item ) {
547
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency()  );
546
+        foreach ($invoice->get_items() as $item_id => $item) {
547
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
548 548
         }
549 549
 
550
-        wp_send_json_success( compact( 'items', 'alert' ) );
550
+        wp_send_json_success(compact('items', 'alert'));
551 551
     }
552 552
 
553 553
     /**
@@ -556,33 +556,33 @@  discard block
 block discarded – undo
556 556
     public static function remove_invoice_item() {
557 557
 
558 558
         // Verify nonce.
559
-        check_ajax_referer( 'wpinv-nonce' );
559
+        check_ajax_referer('wpinv-nonce');
560 560
 
561
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
561
+        if (!wpinv_current_user_can_manage_invoicing()) {
562 562
             exit;
563 563
         }
564 564
 
565 565
         // We need an invoice and an item.
566
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['item_id'] ) ) {
566
+        if (empty($_POST['post_id']) || empty($_POST['item_id'])) {
567 567
             exit;
568 568
         }
569 569
 
570 570
         // Fetch the invoice.
571
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
571
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
572 572
 
573 573
         // Ensure it exists and its not been paid for.
574
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
574
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
575 575
             exit;
576 576
         }
577 577
 
578 578
         // Abort if the invoice does not have the specified item.
579
-        $item = $invoice->get_item( (int) $_POST['item_id'] );
579
+        $item = $invoice->get_item((int) $_POST['item_id']);
580 580
 
581
-        if ( empty( $item ) ) {
581
+        if (empty($item)) {
582 582
             exit;
583 583
         }
584 584
 
585
-        $invoice->remove_item( (int) $_POST['item_id'] );
585
+        $invoice->remove_item((int) $_POST['item_id']);
586 586
 
587 587
         // Update totals.
588 588
         $invoice->recalculate_total();
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
         // Return an array of invoice items.
594 594
         $items = array();
595 595
 
596
-        foreach ( $invoice->get_items() as $item_id => $item ) {
597
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency()  );
596
+        foreach ($invoice->get_items() as $item_id => $item) {
597
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
598 598
         }
599 599
 
600
-        wp_send_json_success( compact( 'items' ) );
600
+        wp_send_json_success(compact('items'));
601 601
     }
602 602
 
603 603
     /**
@@ -606,39 +606,39 @@  discard block
 block discarded – undo
606 606
     public static function add_invoice_items() {
607 607
 
608 608
         // Verify nonce.
609
-        check_ajax_referer( 'wpinv-nonce' );
609
+        check_ajax_referer('wpinv-nonce');
610 610
 
611
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
611
+        if (!wpinv_current_user_can_manage_invoicing()) {
612 612
             exit;
613 613
         }
614 614
 
615 615
         // We need an invoice and items.
616
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['items'] ) ) {
616
+        if (empty($_POST['post_id']) || empty($_POST['items'])) {
617 617
             exit;
618 618
         }
619 619
 
620 620
         // Fetch the invoice.
621
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
621
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
622 622
         $alert   = false;
623 623
 
624 624
         // Ensure it exists and its not been paid for.
625
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
625
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
626 626
             exit;
627 627
         }
628 628
 
629 629
         // Add the items.
630
-        foreach ( $_POST['items'] as $data ) {
630
+        foreach ($_POST['items'] as $data) {
631 631
 
632
-            $item = new GetPaid_Form_Item( $data[ 'id' ] );
632
+            $item = new GetPaid_Form_Item($data['id']);
633 633
 
634
-            if ( is_numeric( $data[ 'qty' ] ) && (int) $data[ 'qty' ] > 0 ) {
635
-                $item->set_quantity( $data[ 'qty' ] );
634
+            if (is_numeric($data['qty']) && (int) $data['qty'] > 0) {
635
+                $item->set_quantity($data['qty']);
636 636
             }
637 637
 
638
-            if ( $item->get_id() > 0 ) {
639
-                $error = $invoice->add_item( $item );
638
+            if ($item->get_id() > 0) {
639
+                $error = $invoice->add_item($item);
640 640
 
641
-                if ( is_wp_error( $error ) ) {
641
+                if (is_wp_error($error)) {
642 642
                     $alert = $error->get_error_message();
643 643
                 }
644 644
 
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
         // Return an array of invoice items.
654 654
         $items = array();
655 655
 
656
-        foreach ( $invoice->get_items() as $item_id => $item ) {
657
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() );
656
+        foreach ($invoice->get_items() as $item_id => $item) {
657
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
658 658
         }
659 659
 
660
-        wp_send_json_success( compact( 'items', 'alert' ) );
660
+        wp_send_json_success(compact('items', 'alert'));
661 661
     }
662 662
 
663 663
     /**
@@ -666,15 +666,15 @@  discard block
 block discarded – undo
666 666
     public static function get_invoicing_items() {
667 667
 
668 668
         // Verify nonce.
669
-        check_ajax_referer( 'wpinv-nonce' );
669
+        check_ajax_referer('wpinv-nonce');
670 670
 
671
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
671
+        if (!wpinv_current_user_can_manage_invoicing()) {
672 672
             exit;
673 673
         }
674 674
 
675 675
         // We need a search term.
676
-        if ( empty( $_GET['search'] ) ) {
677
-            wp_send_json_success( array() );
676
+        if (empty($_GET['search'])) {
677
+            wp_send_json_success(array());
678 678
         }
679 679
 
680 680
         // Retrieve items.
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
             'orderby'        => 'title',
684 684
             'order'          => 'ASC',
685 685
             'posts_per_page' => -1,
686
-            'post_status'    => array( 'publish' ),
687
-            's'              => trim( $_GET['search'] ),
686
+            'post_status'    => array('publish'),
687
+            's'              => trim($_GET['search']),
688 688
             'meta_query'     => array(
689 689
                 array(
690 690
                     'key'       => '_wpinv_type',
@@ -694,22 +694,22 @@  discard block
 block discarded – undo
694 694
             )
695 695
         );
696 696
 
697
-        $items = get_posts( apply_filters( 'getpaid_ajax_invoice_items_query_args', $item_args ) );
697
+        $items = get_posts(apply_filters('getpaid_ajax_invoice_items_query_args', $item_args));
698 698
         $data  = array();
699 699
 
700 700
 
701
-        $is_payment_form = ( ! empty( $_GET['post_id'] ) && 'wpi_payment_form' == get_post_type( $_GET['post_id'] ) );
701
+        $is_payment_form = (!empty($_GET['post_id']) && 'wpi_payment_form' == get_post_type($_GET['post_id']));
702 702
 
703
-        foreach ( $items as $item ) {
704
-            $item      = new GetPaid_Form_Item( $item );
703
+        foreach ($items as $item) {
704
+            $item = new GetPaid_Form_Item($item);
705 705
             $data[] = array(
706 706
                 'id'        => (int) $item->get_id(),
707
-                'text'      => strip_tags( $item->get_name() ),
708
-                'form_data' => $is_payment_form ? $item->prepare_data_for_use( false ) : '',
707
+                'text'      => strip_tags($item->get_name()),
708
+                'form_data' => $is_payment_form ? $item->prepare_data_for_use(false) : '',
709 709
             );
710 710
         }
711 711
 
712
-        wp_send_json_success( $data );
712
+        wp_send_json_success($data);
713 713
 
714 714
     }
715 715
 
@@ -719,24 +719,24 @@  discard block
 block discarded – undo
719 719
     public static function get_aui_states_field() {
720 720
 
721 721
         // Verify nonce.
722
-        check_ajax_referer( 'wpinv-nonce' );
722
+        check_ajax_referer('wpinv-nonce');
723 723
 
724 724
         // We need a country.
725
-        if ( empty( $_GET['country'] ) ) {
725
+        if (empty($_GET['country'])) {
726 726
             exit;
727 727
         }
728 728
 
729
-        $states = wpinv_get_country_states( trim( $_GET['country'] ) );
730
-        $state  = isset( $_GET['state'] ) ? trim( $_GET['state'] ) : wpinv_get_default_state();
729
+        $states = wpinv_get_country_states(trim($_GET['country']));
730
+        $state  = isset($_GET['state']) ? trim($_GET['state']) : wpinv_get_default_state();
731 731
 
732
-        if ( empty( $states ) ) {
732
+        if (empty($states)) {
733 733
 
734 734
             $html = aui()->input(
735 735
                 array(
736 736
                     'type'        => 'text',
737 737
                     'id'          => 'wpinv_state',
738 738
                     'name'        => 'wpinv_state',
739
-                    'label'       => __( 'State', 'invoicing' ),
739
+                    'label'       => __('State', 'invoicing'),
740 740
                     'label_type'  => 'vertical',
741 741
                     'placeholder' => 'Liège',
742 742
                     'class'       => 'form-control-sm',
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
                 array(
751 751
                     'id'          => 'wpinv_state',
752 752
                     'name'        => 'wpinv_state',
753
-                    'label'       => __( 'State', 'invoicing' ),
753
+                    'label'       => __('State', 'invoicing'),
754 754
                     'label_type'  => 'vertical',
755
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
755
+                    'placeholder' => __('Select a state', 'invoicing'),
756 756
                     'class'       => 'form-control-sm',
757 757
                     'value'       => $state,
758 758
                     'options'     => $states,
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         wp_send_json_success(
767 767
             array(
768 768
                 'html'   => $html,
769
-                'select' => ! empty ( $states )
769
+                'select' => !empty ($states)
770 770
             )
771 771
         );
772 772
 
@@ -780,46 +780,46 @@  discard block
 block discarded – undo
780 780
     public static function ip_geolocation() {
781 781
 
782 782
         // Check nonce.
783
-        check_ajax_referer( 'getpaid-ip-location' );
783
+        check_ajax_referer('getpaid-ip-location');
784 784
 
785 785
         // IP address.
786
-        if ( empty( $_GET['ip'] ) || ! rest_is_ip_address( $_GET['ip'] ) ) {
787
-            _e( 'Invalid IP Address.', 'invoicing' );
786
+        if (empty($_GET['ip']) || !rest_is_ip_address($_GET['ip'])) {
787
+            _e('Invalid IP Address.', 'invoicing');
788 788
             exit;
789 789
         }
790 790
 
791 791
         // Retrieve location info.
792
-        $location = getpaid_geolocate_ip_address( $_GET['ip'] );
792
+        $location = getpaid_geolocate_ip_address($_GET['ip']);
793 793
 
794
-        if ( empty( $location ) ) {
795
-            _e( 'Unable to find geolocation for the IP Address.', 'invoicing' );
794
+        if (empty($location)) {
795
+            _e('Unable to find geolocation for the IP Address.', 'invoicing');
796 796
             exit;
797 797
         }
798 798
 
799 799
         // Sorry.
800
-        extract( $location );
800
+        extract($location);
801 801
 
802 802
         // Prepare the address.
803 803
         $content = '';
804 804
 
805
-        if ( ! empty( $location['city'] ) ) {
806
-            $content .=  $location['city']  . ', ';
805
+        if (!empty($location['city'])) {
806
+            $content .= $location['city'] . ', ';
807 807
         }
808 808
         
809
-        if ( ! empty( $location['region'] ) ) {
810
-            $content .=  $location['region']  . ', ';
809
+        if (!empty($location['region'])) {
810
+            $content .= $location['region'] . ', ';
811 811
         }
812 812
         
813
-        $content .=  $location['country'] . ' (' . $location['iso'] . ')';
813
+        $content .= $location['country'] . ' (' . $location['iso'] . ')';
814 814
 
815 815
         $location['address'] = $content;
816 816
 
817
-        $content  = '<p>'. sprintf( __( '<b>Address:</b> %s', 'invoicing' ), $content ) . '</p>';
818
-        $content .= '<p>'. $location['credit'] . '</p>';
817
+        $content  = '<p>' . sprintf(__('<b>Address:</b> %s', 'invoicing'), $content) . '</p>';
818
+        $content .= '<p>' . $location['credit'] . '</p>';
819 819
 
820 820
         $location['content'] = $content;
821 821
 
822
-        wpinv_get_template( 'geolocation.php', $location );
822
+        wpinv_get_template('geolocation.php', $location);
823 823
 
824 824
         exit;
825 825
     }
@@ -832,11 +832,11 @@  discard block
 block discarded – undo
832 832
     public static function payment_form_refresh_prices() {
833 833
 
834 834
         // Check nonce.
835
-        check_ajax_referer( 'getpaid_form_nonce' );
835
+        check_ajax_referer('getpaid_form_nonce');
836 836
 
837 837
         // ... form fields...
838
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
839
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
838
+        if (empty($_POST['getpaid_payment_form_submission'])) {
839
+            _e('Error: Reload the page and try again.', 'invoicing');
840 840
             exit;
841 841
         }
842 842
 
@@ -844,18 +844,18 @@  discard block
 block discarded – undo
844 844
         $submission = new GetPaid_Payment_Form_Submission();
845 845
 
846 846
         // Do we have an error?
847
-        if ( ! empty( $submission->last_error ) ) {
847
+        if (!empty($submission->last_error)) {
848 848
             echo $submission->last_error;
849 849
             exit;
850 850
         }
851 851
 
852 852
         // Prepare the response.
853
-        $response = new GetPaid_Payment_Form_Submission_Refresh_Prices( $submission );
853
+        $response = new GetPaid_Payment_Form_Submission_Refresh_Prices($submission);
854 854
         
855 855
         // Filter the response.
856
-        $response = apply_filters( 'getpaid_payment_form_ajax_refresh_prices', $response->response, $submission );
856
+        $response = apply_filters('getpaid_payment_form_ajax_refresh_prices', $response->response, $submission);
857 857
 
858
-        wp_send_json_success( $response );
858
+        wp_send_json_success($response);
859 859
     }
860 860
 
861 861
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-payment-form.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit; // Exit if accessed directly
11 11
 }
12 12
 
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param WP_Post $post
22 22
 	 */
23
-    public static function output( $post ) {
23
+    public static function output($post) {
24 24
         ?>
25 25
         <div id="wpinv-form-builder" class="bsui">
26 26
             <div class="row">
27 27
                 <div class="col-sm-4">
28 28
 
29 29
                     <!-- Builder tabs -->
30
-                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php _e( 'Go Back', 'invoicing' ); ?></button>
30
+                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php _e('Go Back', 'invoicing'); ?></button>
31 31
 
32 32
                     <!-- Builder tab content -->
33 33
                     <div class="mt-4">
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                         <!-- Available builder elements -->
36 36
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
37 37
                             <div class="wpinv-form-builder-add-field-types">
38
-                                <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
38
+                                <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
39 39
                                 <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable">
40 40
                                     <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }">
41 41
                                         <button class="button btn">
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
                         <!-- Edit an element -->
51 51
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='edit_item'" style="font-size: 14px;">
52 52
                             <div class="wpinv-form-builder-edit-field-wrapper">
53
-                                <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
54
-                                <?php do_action( 'getpaid_payment_form_edit_element_template', $post ); ?>
53
+                                <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
54
+                                <?php do_action('getpaid_payment_form_edit_element_template', $post); ?>
55 55
                                 <div>
56
-                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e( 'Delete Element', 'invoicing' ); ?></button>
56
+                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e('Delete Element', 'invoicing'); ?></button>
57 57
                                 </div>
58 58
                             </div>
59 59
                         </div>
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 
63 63
                 </div>
64 64
                 <div class="col-sm-8 border-left">
65
-                    <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
66
-                    <p class='form-text text-muted' v-if='! form_elements.length'><?php _e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p>
65
+                    <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
66
+                    <p class='form-text text-muted' v-if='! form_elements.length'><?php _e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p>
67 67
 
68 68
                     <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 14px;">
69 69
                         <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="[{ active: active_form_element==form_element &&  active_tab=='edit_item' }, form_element.type]" @click="active_tab = 'edit_item'; active_form_element = form_element">
70 70
                             <div class="wpinv-form-builder-element-preview-inner">
71 71
                                 <div class="wpinv-payment-form-field-preview-overlay"></div>
72
-                                <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
72
+                                <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
73 73
                             </div>
74 74
                         </div>
75 75
                     </draggable>
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         </div>
83 83
         <?php
84 84
 
85
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
85
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
86 86
     }
87 87
 
88 88
     /**
@@ -90,33 +90,33 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $post_id
92 92
 	 */
93
-	public static function save( $post_id ) {
93
+	public static function save($post_id) {
94 94
 
95 95
         // Prepare the form.
96
-        $form = new GetPaid_Payment_Form( $post_id );
96
+        $form = new GetPaid_Payment_Form($post_id);
97 97
 
98 98
         // Fetch form items.
99
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
99
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
100 100
 
101 101
         // Ensure that we have an array...
102
-        if ( empty( $form_items ) ) {
102
+        if (empty($form_items)) {
103 103
             $form_items = array();
104 104
         }
105 105
 
106 106
         // Add it to the form.
107
-        $form->set_items( self::item_to_objects( $form_items ) );
107
+        $form->set_items(self::item_to_objects($form_items));
108 108
 
109 109
         // Save form elements.
110
-        $form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
111
-        if ( empty( $form_elements ) ) {
110
+        $form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
111
+        if (empty($form_elements)) {
112 112
             $form_elements = array();
113 113
         }
114 114
 
115
-        $form->set_elements( $form_elements );
115
+        $form->set_elements($form_elements);
116 116
 
117 117
         // Persist data to the datastore.
118 118
         $form->save();
119
-        do_action( 'getpaid_payment_form_metabox_save', $post_id, $form );
119
+        do_action('getpaid_payment_form_metabox_save', $post_id, $form);
120 120
 
121 121
     }
122 122
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @param array $items
127 127
 	 */
128
-	public static function item_to_objects( $items ) {
128
+	public static function item_to_objects($items) {
129 129
 
130 130
         $objects = array();
131 131
 
132
-        foreach ( $items as $item ) {
133
-            $_item = new GetPaid_Form_Item( $item['id'] );
134
-            $_item->set_allow_quantities( (bool) $item['allow_quantities'] );
135
-            $_item->set_is_required( (bool) $item['required'] );
132
+        foreach ($items as $item) {
133
+            $_item = new GetPaid_Form_Item($item['id']);
134
+            $_item->set_allow_quantities((bool) $item['allow_quantities']);
135
+            $_item->set_is_required((bool) $item['required']);
136 136
             $objects[] = $_item;
137 137
         }
138 138
 
Please login to merge, or discard this patch.
includes/payments/class-getpaid-form-item.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param  string $context View or edit context.
88 88
 	 * @return string
89 89
 	 */
90
-	public function get_name( $context = 'view' ) {
91
-		$name = parent::get_name( $context );
92
-		return $name . wpinv_get_item_suffix( $this );
90
+	public function get_name($context = 'view') {
91
+		$name = parent::get_name($context);
92
+		return $name . wpinv_get_item_suffix($this);
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param  string $context View or edit context.
100 100
 	 * @return string
101 101
 	 */
102
-	public function get_raw_name( $context = 'view' ) {
103
-		return parent::get_name( $context );
102
+	public function get_raw_name($context = 'view') {
103
+		return parent::get_name($context);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $context View or edit context.
111 111
 	 * @return string
112 112
 	 */
113
-	public function get_description( $context = 'view' ) {
113
+	public function get_description($context = 'view') {
114 114
 
115
-		if ( isset( $this->custom_description ) ) {
115
+		if (isset($this->custom_description)) {
116 116
 			return $this->custom_description;
117 117
 		}
118 118
 
119
-		return parent::get_description( $context );
119
+		return parent::get_description($context);
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $context View or edit context.
127 127
 	 * @return int
128 128
 	 */
129
-	public function get_sub_total( $context = 'view' ) {
130
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
129
+	public function get_sub_total($context = 'view') {
130
+		return $this->get_quantity($context) * $this->get_initial_price($context);
131 131
 	}
132 132
 
133 133
 	/**
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $context View or edit context.
138 138
 	 * @return int
139 139
 	 */
140
-	public function get_recurring_sub_total( $context = 'view' ) {
141
-		return $this->get_quantity( $context ) * $this->get_price( $context );
140
+	public function get_recurring_sub_total($context = 'view') {
141
+		return $this->get_quantity($context) * $this->get_price($context);
142 142
 	}
143 143
 
144 144
 	/**
145 145
 	 * @deprecated
146 146
 	 */
147
-	public function get_qantity( $context = 'view' ) {
148
-		return $this->get_quantity( $context );
147
+	public function get_qantity($context = 'view') {
148
+		return $this->get_quantity($context);
149 149
 	}
150 150
 
151 151
 	/**
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 	 * @param  string $context View or edit context.
156 156
 	 * @return int
157 157
 	 */
158
-	public function get_quantity( $context = 'view' ) {
158
+	public function get_quantity($context = 'view') {
159 159
 		$quantity = (int) $this->quantity;
160 160
 
161
-		if ( empty( $quantity ) || 1 > $quantity ) {
161
+		if (empty($quantity) || 1 > $quantity) {
162 162
 			$quantity = 1;
163 163
 		}
164 164
 
165
-		if ( 'view' == $context ) {
166
-			return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this );
165
+		if ('view' == $context) {
166
+			return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this);
167 167
 		}
168 168
 
169 169
 		return $quantity;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param  string $context View or edit context.
178 178
 	 * @return meta
179 179
 	 */
180
-	public function get_item_meta( $context = 'view' ) {
180
+	public function get_item_meta($context = 'view') {
181 181
 		$meta = $this->meta;
182 182
 
183
-		if ( 'view' == $context ) {
184
-			return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this );
183
+		if ('view' == $context) {
184
+			return apply_filters('getpaid_payment_form_item_meta', $meta, $this);
185 185
 		}
186 186
 
187 187
 		return $meta;
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 	 * @param  string $context View or edit context.
196 196
 	 * @return bool
197 197
 	 */
198
-	public function get_allow_quantities( $context = 'view' ) {
198
+	public function get_allow_quantities($context = 'view') {
199 199
 		$allow_quantities = (bool) $this->allow_quantities;
200 200
 
201
-		if ( 'view' == $context ) {
202
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
201
+		if ('view' == $context) {
202
+			return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this);
203 203
 		}
204 204
 
205 205
 		return $allow_quantities;
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	 * @param  string $context View or edit context.
214 214
 	 * @return bool
215 215
 	 */
216
-	public function get_is_required( $context = 'view' ) {
216
+	public function get_is_required($context = 'view') {
217 217
 		$is_required = (bool) $this->is_required;
218 218
 
219
-		if ( 'view' == $context ) {
220
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
219
+		if ('view' == $context) {
220
+			return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this);
221 221
 		}
222 222
 
223 223
 		return $is_required;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 * @since 1.0.19
231 231
 	 * @return array
232 232
 	 */
233
-	public function prepare_data_for_use( $required = null ) {
233
+	public function prepare_data_for_use($required = null) {
234 234
 
235
-		$required = is_null( $required ) ? $this->is_required() : $required;
235
+		$required = is_null($required) ? $this->is_required() : $required;
236 236
 		return array(
237
-			'title'            => strip_tags( $this->get_name() ),
237
+			'title'            => strip_tags($this->get_name()),
238 238
 			'id'               => $this->get_id(),
239 239
 			'price'            => $this->get_price(),
240 240
 			'recurring'        => $this->is_recurring(),
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
 	 * @since 1.0.19
252 252
 	 * @return array
253 253
 	 */
254
-	public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
254
+	public function prepare_data_for_invoice_edit_ajax($currency = '') {
255 255
 
256
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
256
+		$description = getpaid_item_recurring_price_help_text($this, $currency);
257 257
 
258
-		if ( $description ) {
258
+		if ($description) {
259 259
 			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
260 260
 		}
261 261
 
262 262
 		return array(
263 263
 			'id'     => $this->get_id(),
264 264
 			'texts'  => array(
265
-				'item-name'        => sanitize_text_field( $this->get_name() ),
266
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
267
-				'item-quantity'    => absint( $this->get_quantity() ),
268
-				'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
269
-				'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
265
+				'item-name'        => sanitize_text_field($this->get_name()),
266
+				'item-description' => wp_kses_post($this->get_description()) . $description,
267
+				'item-quantity'    => absint($this->get_quantity()),
268
+				'item-price'       => wpinv_price(wpinv_format_amount($this->get_price()), $currency),
269
+				'item-total'       => wpinv_price(wpinv_format_amount($this->get_sub_total()), $currency),
270 270
 			),
271 271
 			'inputs' => array(
272 272
 				'item-id'          => $this->get_id(),
273
-				'item-name'        => sanitize_text_field( $this->get_name() ),
274
-				'item-description' => wp_kses_post( $this->get_description() ),
275
-				'item-quantity'    => absint( $this->get_quantity() ),
273
+				'item-name'        => sanitize_text_field($this->get_name()),
274
+				'item-description' => wp_kses_post($this->get_description()),
275
+				'item-quantity'    => absint($this->get_quantity()),
276 276
 				'item-price'       => $this->get_price(),
277 277
 			)
278 278
 		);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		return array(
291 291
 			'post_id'           => $this->invoice_id,
292 292
 			'item_id'           => $this->get_id(),
293
-			'item_name'         => sanitize_text_field( $this->get_raw_name() ),
293
+			'item_name'         => sanitize_text_field($this->get_raw_name()),
294 294
 			'item_description'  => $this->get_description(),
295 295
 			'tax'               => $this->item_tax,
296 296
 			'item_price'        => $this->get_price(),
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 * @since 1.0.19
320 320
 	 * @param  int $quantity The item quantity.
321 321
 	 */
322
-	public function set_quantity( $quantity ) {
322
+	public function set_quantity($quantity) {
323 323
 
324
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
324
+		if (empty($quantity) || !is_numeric($quantity)) {
325 325
 			$quantity = 1;
326 326
 		}
327 327
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 	 * @since 1.0.19
336 336
 	 * @param  array $meta The item meta data.
337 337
 	 */
338
-	public function set_item_meta( $meta ) {
339
-		$this->meta = maybe_unserialize( $meta );
338
+	public function set_item_meta($meta) {
339
+		$this->meta = maybe_unserialize($meta);
340 340
 	}
341 341
 
342 342
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 * @since 1.0.19
346 346
 	 * @param  bool $allow_quantities
347 347
 	 */
348
-	public function set_allow_quantities( $allow_quantities ) {
348
+	public function set_allow_quantities($allow_quantities) {
349 349
 		$this->allow_quantities = (bool) $allow_quantities;
350 350
 	}
351 351
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @since 1.0.19
356 356
 	 * @param  bool $is_required
357 357
 	 */
358
-	public function set_is_required( $is_required ) {
358
+	public function set_is_required($is_required) {
359 359
 		$this->is_required = (bool) $is_required;
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @since 1.0.19
366 366
 	 * @param  string $description
367 367
 	 */
368
-	public function set_custom_description( $description ) {
368
+	public function set_custom_description($description) {
369 369
 		$this->custom_description = $description;
370 370
 	}
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      * 
375 375
 	 * @return int item id
376 376
      */
377
-    public function save( $data = array() ) {
377
+    public function save($data = array()) {
378 378
         return $this->get_id();
379 379
 	}
380 380
 
Please login to merge, or discard this patch.