Passed
Push — master ( fd90c2...9b7fbb )
by Brian
05:32
created

sd_get_padding_input()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 56
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 41
nc 5
nop 2
dl 0
loc 56
rs 8.9528
c 1
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * A file for common functions.
4
 */
5
6
/**
7
 * Return an array of global $pagenow page names that should be used to exclude register_widgets.
8
 *
9
 * Used to block the loading of widgets on certain wp-admin pages to save on memory.
10
 *
11
 * @return mixed|void
12
 */
13
function sd_pagenow_exclude() {
14
	return apply_filters( 'sd_pagenow_exclude', array(
15
		'upload.php',
16
		'edit-comments.php',
17
		'edit-tags.php',
18
		'index.php',
19
		'media-new.php',
20
		'options-discussion.php',
21
		'options-writing.php',
22
		'edit.php',
23
		'themes.php',
24
		'users.php',
25
	) );
26
}
27
28
29
/**
30
 * Return an array of widget class names that should be excluded.
31
 *
32
 * Used to conditionally load widgets code.
33
 *
34
 * @return mixed|void
35
 */
36
function sd_widget_exclude() {
37
	return apply_filters( 'sd_widget_exclude', array() );
38
}
39
40
41
/**
42
 * A helper function for margin inputs.
43
 *
44
 * @param string $type
45
 * @param array $overwrite
46
 *
47
 * @return array
48
 */
49
function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
50
	$options = array(
51
		""     => __( 'None' ),
52
		"auto" => __( 'auto' ),
53
		"0"    => "0",
54
		"1"    => "1",
55
		"2"    => "2",
56
		"3"    => "3",
57
		"4"    => "4",
58
		"5"    => "5",
59
	);
60
61
	if ( $include_negatives ) {
62
		$options['n1'] = '-1';
63
		$options['n2'] = '-2';
64
		$options['n3'] = '-3';
65
		$options['n4'] = '-4';
66
		$options['n5'] = '-5';
67
	}
68
69
	$defaults = array(
70
		'type'     => 'select',
71
		'title'    => __( 'Margin top' ),
72
		'options'  => $options,
73
		'default'  => '',
74
		'desc_tip' => true,
75
		'group'    => __( "Wrapper Styles", "geodirectory" ),
76
//		'device_type' => 'Desktop',
77
	);
78
79
	// title
80
	if ( $type == 'mt' ) {
81
		$defaults['title'] = __( 'Margin top' );
82
		$defaults['icon']  = 'box-top';
83
		$defaults['row']   = array(
84
			'title' => __( 'Margins' ),
85
			'key'   => 'wrapper-margins',
86
			'open'  => true,
87
			'class' => 'text-center',
88
		);
89
	} elseif ( $type == 'mr' ) {
90
		$defaults['title'] = __( 'Margin right' );
91
		$defaults['icon']  = 'box-right';
92
		$defaults['row']   = array(
93
			'key' => 'wrapper-margins',
94
		);
95
	} elseif ( $type == 'mb' ) {
96
		$defaults['title'] = __( 'Margin bottom' );
97
		$defaults['icon']  = 'box-bottom';
98
		$defaults['row']   = array(
99
			'key' => 'wrapper-margins',
100
		);
101
	} elseif ( $type == 'ml' ) {
102
		$defaults['title'] = __( 'Margin left' );
103
		$defaults['icon']  = 'box-left';
104
		$defaults['row']   = array(
105
			'key'   => 'wrapper-margins',
106
			'close' => true,
107
		);
108
	}
109
110
	$input = wp_parse_args( $overwrite, $defaults );
111
112
113
	return $input;
114
}
115
116
/**
117
 * A helper function for padding inputs.
118
 *
119
 * @param string $type
120
 * @param array $overwrite
121
 *
122
 * @return array
123
 */
124
function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
125
	$options = array(
126
		""  => __( 'None' ),
127
		"0" => "0",
128
		"1" => "1",
129
		"2" => "2",
130
		"3" => "3",
131
		"4" => "4",
132
		"5" => "5",
133
	);
134
135
	$defaults = array(
136
		'type'     => 'select',
137
		'title'    => __( 'Padding top' ),
138
		'options'  => $options,
139
		'default'  => '',
140
		'desc_tip' => true,
141
		'group'    => __( "Wrapper Styles", "geodirectory" )
142
	);
143
144
	// title
145
	if ( $type == 'pt' ) {
146
		$defaults['title'] = __( 'Padding top' );
147
		$defaults['icon']  = 'box-top';
148
		$defaults['row']   = array(
149
			'title' => __( 'Padding' ),
150
			'key'   => 'wrapper-padding',
151
			'open'  => true,
152
			'class' => 'text-center',
153
		);
154
	} elseif ( $type == 'pr' ) {
155
		$defaults['title'] = __( 'Padding right' );
156
		$defaults['icon']  = 'box-right';
157
		$defaults['row']   = array(
158
			'key' => 'wrapper-padding',
159
		);
160
	} elseif ( $type == 'pb' ) {
161
		$defaults['title'] = __( 'Padding bottom' );
162
		$defaults['icon']  = 'box-bottom';
163
		$defaults['row']   = array(
164
			'key' => 'wrapper-padding',
165
		);
166
	} elseif ( $type == 'pl' ) {
167
		$defaults['title'] = __( 'Padding left' );
168
		$defaults['icon']  = 'box-left';
169
		$defaults['row']   = array(
170
			'key'   => 'wrapper-padding',
171
			'close' => true,
172
173
		);
174
	}
175
176
	$input = wp_parse_args( $overwrite, $defaults );
177
178
179
	return $input;
180
}
181
182
/**
183
 * A helper function for border inputs.
184
 *
185
 * @param string $type
186
 * @param array $overwrite
187
 *
188
 * @return array
189
 */
190
function sd_get_border_input( $type = 'border', $overwrite = array() ) {
191
192
	$defaults = array(
193
		'type'     => 'select',
194
		'title'    => __( 'Border' ),
195
		'options'  => array(),
196
		'default'  => '',
197
		'desc_tip' => true,
198
		'group'    => __( "Wrapper Styles", "geodirectory" )
199
	);
200
201
	// title
202
	if ( $type == 'rounded' ) {
203
		$defaults['title']   = __( 'Border radius type' );
204
		$defaults['options'] = array(
205
			''               => __( "Default", "geodirectory" ),
206
			'rounded'        => 'rounded',
207
			'rounded-top'    => 'rounded-top',
208
			'rounded-right'  => 'rounded-right',
209
			'rounded-bottom' => 'rounded-bottom',
210
			'rounded-left'   => 'rounded-left',
211
			'rounded-circle' => 'rounded-circle',
212
			'rounded-pill'   => 'rounded-pill',
213
			'rounded-0'      => 'rounded-0',
214
		);
215
	} elseif ( $type == 'rounded_size' ) {
216
		$defaults['title']   = __( 'Border radius size' );
217
		$defaults['options'] = array(
218
			''   => __( "Default", "geodirectory" ),
219
			'sm' => __( "Small", "geodirectory" ),
220
			'lg' => __( "Large", "geodirectory" ),
221
		);
222
	} elseif ( $type == 'type' ) {
223
		$defaults['title']   = __( 'Border type' );
224
		$defaults['options'] = array(
225
			''              => __( "None", "geodirectory" ),
226
			'border'        => __( "Full", "geodirectory" ),
227
			'border-top'    => __( "Top", "geodirectory" ),
228
			'border-bottom' => __( "Bottom", "geodirectory" ),
229
			'border-left'   => __( "Left", "geodirectory" ),
230
			'border-right'  => __( "Right", "geodirectory" ),
231
		);
232
	} else {
233
		$defaults['title']   = __( 'Border color' );
234
		$defaults['options'] = array(
235
			                       ''  => __( "Default", "geodirectory" ),
236
			                       '0' => __( "None", "geodirectory" ),
237
		                       ) + sd_aui_colors();
238
	}
239
240
	$input = wp_parse_args( $overwrite, $defaults );
241
242
243
	return $input;
244
}
245
246
/**
247
 * A helper function for shadow inputs.
248
 *
249
 * @param string $type
250
 * @param array $overwrite
251
 *
252
 * @return array
253
 */
254
function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

254
function sd_get_shadow_input( /** @scrutinizer ignore-unused */ $type = 'shadow', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
255
	$options = array(
256
		""          => __( 'None' ),
257
		"shadow-sm" => __( 'Small' ),
258
		"shadow"    => __( 'Regular' ),
259
		"shadow-lg" => __( 'Large' ),
260
	);
261
262
	$defaults = array(
263
		'type'     => 'select',
264
		'title'    => __( 'Shadow' ),
265
		'options'  => $options,
266
		'default'  => '',
267
		'desc_tip' => true,
268
		'group'    => __( "Wrapper Styles", "geodirectory" )
269
	);
270
271
272
	$input = wp_parse_args( $overwrite, $defaults );
273
274
275
	return $input;
276
}
277
278
/**
279
 * A helper function for background inputs.
280
 *
281
 * @param string $type
282
 * @param array $overwrite
283
 *
284
 * @return array
285
 */
286
function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

286
function sd_get_background_input( /** @scrutinizer ignore-unused */ $type = 'bg', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
287
	$options = array(
288
		           ''            => __( "None", "geodirectory" ),
289
		           'transparent' => __( "Transparent", "geodirectory" ),
290
	           ) + sd_aui_colors();
291
292
	$defaults = array(
293
		'type'     => 'select',
294
		'title'    => __( 'Background color' ),
295
		'options'  => $options,
296
		'default'  => '',
297
		'desc_tip' => true,
298
		'group'    => __( "Wrapper Styles", "geodirectory" )
299
	);
300
301
302
	$input = wp_parse_args( $overwrite, $defaults );
303
304
305
	return $input;
306
}
307
308
/**
309
 * A helper function for a set of background inputs.
310
 *
311
 * @param string $type
312
 * @param array $overwrite
313
 *
314
 * @return array
315
 */
316
function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
317
	$options = array(
318
		           ''            => __( "None", "geodirectory" ),
319
		           'transparent' => __( "Transparent", "geodirectory" ),
320
	           ) + sd_aui_colors()
321
	           + array(
322
		           'custom-color'    => __( "Custom Color", "geodirectory" ),
323
		           'custom-gradient' => __( "Custom Gradient", "geodirectory" ),
324
//		           'custom-image' => __("Custom Image","geodirectory"),
325
	           );
326
327
	$defaults = array(
328
		'type'     => 'select',
329
		'title'    => __( 'Background Color' ),
330
		'options'  => $options,
331
		'default'  => '',
332
		'desc_tip' => true,
333
		'group'    => __( "Background", "geodirectory" )
334
	);
335
336
337
	if ( $overwrite !== false ) {
0 ignored issues
show
introduced by
The condition $overwrite !== false is always true.
Loading history...
338
		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
0 ignored issues
show
Comprehensibility Best Practice introduced by
$input was never initialized. Although not strictly required by PHP, it is generally a good practice to add $input = array(); before regardless.
Loading history...
339
	}
340
341
342
	if ( $overwrite_color !== false ) {
343
		$input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
344
			'type'            => 'color',
345
			'title'           => __( 'Custom color' ),
346
			'placeholder'     => '',
347
			'default'         => '#0073aa',
348
			'desc_tip'        => true,
349
			'group'           => __( "Background" ),
350
			'element_require' => '[%' . $type . '%]=="custom-color"'
351
		) );
352
	}
353
354
355
	if ( $overwrite_gradient !== false ) {
356
		$input[ $type . '_gradient' ] = wp_parse_args( $overwrite_gradient, array(
357
			'type'            => 'gradient',
358
			'title'           => __( 'Custom gradient' ),
359
			'placeholder'     => '',
360
			'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
361
			'desc_tip'        => true,
362
			'group'           => __( "Background" ),
363
			'element_require' => '[%' . $type . '%]=="custom-gradient"'
364
		) );
365
	}
366
367
	if ( $overwrite_image !== false ) {
368
369
		$input[ $type . '_image_fixed' ] = array(
370
			'type'            => 'checkbox',
371
			'title'           => __( 'Fixed background' ),
372
			'default'         => '',
373
			'desc_tip'        => true,
374
			'group'           => __( "Background" ),
375
			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
376
377
		);
378
379
380
		$input[ $type . '_image' ] = wp_parse_args( $overwrite_image, array(
381
			'type'        => 'image',
382
			'title'       => __( 'Custom image' ),
383
			'placeholder' => '',
384
			'default'     => '',
385
			'desc_tip'    => true,
386
			'group'       => __( "Background" ),
387
//			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
388
		) );
389
390
		$input[ $type . '_image_id' ] = wp_parse_args( $overwrite_image, array(
391
			'type'        => 'hidden',
392
			'hidden_type' => 'number',
393
			'title'       => '',
394
			'placeholder' => '',
395
			'default'     => '',
396
			'group'       => __( "Background" ),
397
		) );
398
399
		$input[ $type . '_image_xy' ] = wp_parse_args( $overwrite_image, array(
400
			'type'        => 'image_xy',
401
			'title'       => '',
402
			'placeholder' => '',
403
			'default'     => '',
404
			'group'       => __( "Background" ),
405
		) );
406
	}
407
408
	return $input;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $input does not seem to be defined for all execution paths leading up to this point.
Loading history...
409
}
410
411
/**
412
 * A helper function for a set of inputs for the shape divider.
413
 *
414
 * @param string $type
415
 * @param array $overwrite
416
 *
417
 * @return array
418
 */
419
function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $overwrite_image is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

419
function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), /** @scrutinizer ignore-unused */ $overwrite_image = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
420
421
	$options = array(
422
		''                      => __( "None" ),
423
		'mountains'             => __( "Mountains" ),
424
		'drops'                 => __( "Drops" ),
425
		'clouds'                => __( "Clouds" ),
426
		'zigzag'                => __( "Zigzag" ),
427
		'pyramids'              => __( "Pyramids" ),
428
		'triangle'              => __( "Triangle" ),
429
		'triangle-asymmetrical' => __( "Triangle Asymmetrical" ),
430
		'tilt'                  => __( "Tilt" ),
431
		'opacity-tilt'          => __( "Opacity Tilt" ),
432
		'opacity-fan'           => __( "Opacity Fan" ),
433
		'curve'                 => __( "Curve" ),
434
		'curve-asymmetrical'    => __( "Curve Asymmetrical" ),
435
		'waves'                 => __( "Waves" ),
436
		'wave-brush'            => __( "Wave Brush" ),
437
		'waves-pattern'         => __( "Waves Pattern" ),
438
		'arrow'                 => __( "Arrow" ),
439
		'split'                 => __( "Split" ),
440
		'book'                  => __( "Book" ),
441
	);
442
443
	$defaults = array(
444
		'type'     => 'select',
445
		'title'    => __( 'Type' ),
446
		'options'  => $options,
447
		'default'  => '',
448
		'desc_tip' => true,
449
		'group'    => __( "Shape Divider" ),
450
	);
451
452
453
	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
0 ignored issues
show
Comprehensibility Best Practice introduced by
$input was never initialized. Although not strictly required by PHP, it is generally a good practice to add $input = array(); before regardless.
Loading history...
454
455
456
	$input[ $type . '_notice' ] = array(
457
		'type'            => 'notice',
458
		'desc'            => __( 'Parent element must be position `relative`' ),
459
		'status'          => 'warning',
460
		'group'           => __( "Shape Divider" ),
461
		'element_require' => '[%' . $type . '%]!=""',
462
	);
463
464
465
	$input[ $type . '_position' ] = wp_parse_args( $overwrite_color, array(
466
		'type'            => 'select',
467
		'title'           => __( 'Position' ),
468
		'options'         => array(
469
			'top'    => __( 'Top' ),
470
			'bottom' => __( 'Bottom' ),
471
			//'left'   => __('Left'),
472
			//'right'   => __('Right'),
473
		),
474
		'desc_tip'        => true,
475
		'group'           => __( "Shape Divider" ),
476
		'element_require' => '[%' . $type . '%]!=""'
477
	) );
478
479
	$options = array(
480
		           ''            => __( "None" ),
481
		           'transparent' => __( "Transparent" ),
482
	           ) + sd_aui_colors()
483
	           + array(
484
		           'custom-color' => __( "Custom Color" ),
485
	           );
486
487
	$input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
488
		'type'            => 'select',
489
		'title'           => __( 'Color' ),
490
		'options'         => $options,
491
		'desc_tip'        => true,
492
		'group'           => __( "Shape Divider" ),
493
		'element_require' => '[%' . $type . '%]!=""'
494
	) );
495
496
	$input[ $type . '_custom_color' ] = wp_parse_args( $overwrite_color, array(
497
		'type'            => 'color',
498
		'title'           => __( 'Custom color' ),
499
		'placeholder'     => '',
500
		'default'         => '#0073aa',
501
		'desc_tip'        => true,
502
		'group'           => __( "Shape Divider" ),
503
		'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""'
504
	) );
505
506
	$input[ $type . '_width' ] = wp_parse_args( $overwrite_gradient, array(
507
		'type'              => 'range',
508
		'title'             => __( 'Width' ),
509
		'placeholder'       => '',
510
		'default'           => '200',
511
		'desc_tip'          => true,
512
		'custom_attributes' => array(
513
			'min' => 100,
514
			'max' => 300,
515
		),
516
		'group'             => __( "Shape Divider" ),
517
		'element_require'   => '[%' . $type . '%]!=""'
518
	) );
519
520
	$input[ $type . '_height' ] = array(
521
		'type'              => 'range',
522
		'title'             => __( 'Height' ),
523
		'default'           => '100',
524
		'desc_tip'          => true,
525
		'custom_attributes' => array(
526
			'min' => 0,
527
			'max' => 500,
528
		),
529
		'group'             => __( "Shape Divider" ),
530
		'element_require'   => '[%' . $type . '%]!=""'
531
	);
532
533
	$requires = array(
534
		'mountains'             => array( 'flip' ),
535
		'drops'                 => array( 'flip', 'invert' ),
536
		'clouds'                => array( 'flip', 'invert' ),
537
		'zigzag'                => array(),
538
		'pyramids'              => array( 'flip', 'invert' ),
539
		'triangle'              => array( 'invert' ),
540
		'triangle-asymmetrical' => array( 'flip', 'invert' ),
541
		'tilt'                  => array( 'flip' ),
542
		'opacity-tilt'          => array( 'flip' ),
543
		'opacity-fan'           => array(),
544
		'curve'                 => array( 'invert' ),
545
		'curve-asymmetrical'    => array( 'flip', 'invert' ),
546
		'waves'                 => array( 'flip', 'invert' ),
547
		'wave-brush'            => array( 'flip' ),
548
		'waves-pattern'         => array( 'flip' ),
549
		'arrow'                 => array( 'invert' ),
550
		'split'                 => array( 'invert' ),
551
		'book'                  => array( 'invert' ),
552
	);
553
554
	$input[ $type . '_flip' ] = array(
555
		'type'            => 'checkbox',
556
		'title'           => __( 'Flip' ),
557
		'default'         => '',
558
		'desc_tip'        => true,
559
		'group'           => __( "Shape Divider" ),
560
		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' )
561
	);
562
563
	$input[ $type . '_invert' ] = array(
564
		'type'            => 'checkbox',
565
		'title'           => __( 'Invert' ),
566
		'default'         => '',
567
		'desc_tip'        => true,
568
		'group'           => __( "Shape Divider" ),
569
		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' )
570
	);
571
572
	$input[ $type . '_btf' ] = array(
573
		'type'            => 'checkbox',
574
		'title'           => __( 'Bring to front' ),
575
		'default'         => '',
576
		'desc_tip'        => true,
577
		'group'           => __( "Shape Divider" ),
578
		'element_require' => '[%' . $type . '%]!=""'
579
580
	);
581
582
583
	return $input;
584
}
585
586
/**
587
 * Get the element require sting.
588
 *
589
 * @param $args
590
 * @param $key
591
 * @param $type
592
 *
593
 * @return string
594
 */
595
function sd_get_element_require_string( $args, $key, $type ) {
596
	$output   = '';
597
	$requires = array();
598
599
	if ( ! empty( $args ) ) {
600
		foreach ( $args as $t => $k ) {
601
			if ( in_array( $key, $k ) ) {
602
				$requires[] = '[%' . $type . '%]=="' . $t . '"';
603
			}
604
		}
605
606
		if ( ! empty( $requires ) ) {
607
			$output = '(' . implode( ' || ', $requires ) . ')';
608
		}
609
	}
610
611
612
	return $output;
613
}
614
615
/**
616
 * A helper function for text color inputs.
617
 *
618
 * @param string $type
619
 * @param array $overwrite
620
 *
621
 * @return array
622
 */
623
function sd_get_text_color_input( $type = 'text_color', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

623
function sd_get_text_color_input( /** @scrutinizer ignore-unused */ $type = 'text_color', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
624
	$options = array(
625
		           '' => __( "None" ),
626
	           ) + sd_aui_colors();
627
628
	$defaults = array(
629
		'type'     => 'select',
630
		'title'    => __( 'Text color' ),
631
		'options'  => $options,
632
		'default'  => '',
633
		'desc_tip' => true,
634
		'group'    => __( "Typography" )
635
	);
636
637
638
	$input = wp_parse_args( $overwrite, $defaults );
639
640
641
	return $input;
642
}
643
644
/**
645
 * A helper function for column inputs.
646
 *
647
 * @param string $type
648
 * @param array $overwrite
649
 *
650
 * @return array
651
 */
652
function sd_get_col_input( $type = 'col', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

652
function sd_get_col_input( /** @scrutinizer ignore-unused */ $type = 'col', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
653
654
	$device_size = '';
655
	if ( ! empty( $overwrite['device_type'] ) ) {
656
		if ( $overwrite['device_type'] == 'Tablet' ) {
657
			$device_size = '-md';
0 ignored issues
show
Unused Code introduced by
The assignment to $device_size is dead and can be removed.
Loading history...
658
		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
659
			$device_size = '-lg';
660
		}
661
	}
662
	$options = array(
663
		''   => __( 'auto' ),
664
		'1'  => '1/12',
665
		'2'  => '2/12',
666
		'3'  => '3/12',
667
		'4'  => '4/12',
668
		'5'  => '5/12',
669
		'6'  => '6/12',
670
		'7'  => '7/12',
671
		'8'  => '8/12',
672
		'9'  => '9/12',
673
		'10' => '10/12',
674
		'11' => '11/12',
675
		'12' => '12/12',
676
	);
677
678
	$defaults = array(
679
		'type'            => 'select',
680
		'title'           => __( 'Column width' ),
681
		'options'         => $options,
682
		'default'         => '',
683
		'desc_tip'        => true,
684
		'group'           => __( "Container" ),
685
		'element_require' => '[%container%]=="col"',
686
	);
687
688
689
	$input = wp_parse_args( $overwrite, $defaults );
690
691
692
	return $input;
693
}
694
695
/**
696
 * A helper function for row columns inputs.
697
 *
698
 * @param string $type
699
 * @param array $overwrite
700
 *
701
 * @return array
702
 */
703
function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

703
function sd_get_row_cols_input( /** @scrutinizer ignore-unused */ $type = 'row_cols', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
704
705
	$device_size = '';
706
	if ( ! empty( $overwrite['device_type'] ) ) {
707
		if ( $overwrite['device_type'] == 'Tablet' ) {
708
			$device_size = '-md';
0 ignored issues
show
Unused Code introduced by
The assignment to $device_size is dead and can be removed.
Loading history...
709
		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
710
			$device_size = '-lg';
711
		}
712
	}
713
	$options = array(
714
		''  => __( 'auto' ),
715
		'1' => '1',
716
		'2' => '2',
717
		'3' => '3',
718
		'4' => '4',
719
		'5' => '5',
720
		'6' => '6',
721
	);
722
723
	$defaults = array(
724
		'type'            => 'select',
725
		'title'           => __( 'Row columns' ),
726
		'options'         => $options,
727
		'default'         => '',
728
		'desc_tip'        => true,
729
		'group'           => __( "Container" ),
730
		'element_require' => '[%container%]=="row"',
731
	);
732
733
734
	$input = wp_parse_args( $overwrite, $defaults );
735
736
737
	return $input;
738
}
739
740
/**
741
 * A helper function for text align inputs.
742
 *
743
 * @param string $type
744
 * @param array $overwrite
745
 *
746
 * @return array
747
 */
748
function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

748
function sd_get_text_align_input( /** @scrutinizer ignore-unused */ $type = 'text_align', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
749
750
	$device_size = '';
751
	if ( ! empty( $overwrite['device_type'] ) ) {
752
		if ( $overwrite['device_type'] == 'Tablet' ) {
753
			$device_size = '-md';
754
		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
755
			$device_size = '-lg';
756
		}
757
	}
758
	$options = array(
759
		''                                => __( "Default" ),
760
		'text' . $device_size . '-left'   => __( "Left" ),
761
		'text' . $device_size . '-right'  => __( "Right" ),
762
		'text' . $device_size . '-center' => __( "Center" ),
763
	);
764
765
	$defaults = array(
766
		'type'     => 'select',
767
		'title'    => __( 'Text align' ),
768
		'options'  => $options,
769
		'default'  => '',
770
		'desc_tip' => true,
771
		'group'    => __( "Typography" )
772
	);
773
774
775
	$input = wp_parse_args( $overwrite, $defaults );
776
777
778
	return $input;
779
}
780
781
/**
782
 * A helper function for display inputs.
783
 *
784
 * @param string $type
785
 * @param array $overwrite
786
 *
787
 * @return array
788
 */
789
function sd_get_display_input( $type = 'display', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

789
function sd_get_display_input( /** @scrutinizer ignore-unused */ $type = 'display', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
790
791
	$device_size = '';
792
	if ( ! empty( $overwrite['device_type'] ) ) {
793
		if ( $overwrite['device_type'] == 'Tablet' ) {
794
			$device_size = '-md';
795
		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
796
			$device_size = '-lg';
797
		}
798
	}
799
	$options = array(
800
		''                                   => __( "Default" ),
801
		'd' . $device_size . '-none'         => "none",
802
		'd' . $device_size . '-inline'       => "inline",
803
		'd' . $device_size . '-inline-block' => "inline-block",
804
		'd' . $device_size . '-block'        => "block",
805
		'd' . $device_size . '-table'        => "table",
806
		'd' . $device_size . '-table-cell'   => "table-cell",
807
		'd' . $device_size . '-table-row'    => "table-row",
808
		'd' . $device_size . '-flex'         => "flex",
809
		'd' . $device_size . '-inline-flex'  => "inline-flex",
810
	);
811
812
	$defaults = array(
813
		'type'     => 'select',
814
		'title'    => __( 'Display' ),
815
		'options'  => $options,
816
		'default'  => '',
817
		'desc_tip' => true,
818
		'group'    => __( "Wrapper Styles" )
819
	);
820
821
822
	$input = wp_parse_args( $overwrite, $defaults );
823
824
825
	return $input;
826
}
827
828
/**
829
 * A helper function for text justify inputs.
830
 *
831
 * @param string $type
832
 * @param array $overwrite
833
 *
834
 * @return array
835
 */
836
function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

836
function sd_get_text_justify_input( /** @scrutinizer ignore-unused */ $type = 'text_justify', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
837
838
	$defaults = array(
839
		'type'     => 'checkbox',
840
		'title'    => __( 'Text justify' ),
841
		'default'  => '',
842
		'desc_tip' => true,
843
		'group'    => __( "Typography" )
844
	);
845
846
847
	$input = wp_parse_args( $overwrite, $defaults );
848
849
850
	return $input;
851
}
852
853
/**
854
 * Get the AUI colors.
855
 *
856
 * @param $include_branding
857
 * @param $include_outlines
858
 * @param $outline_button_only_text
859
 *
860
 * @return array
861
 */
862
function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
863
	$theme_colors = array();
864
865
	$theme_colors["primary"]   = __( 'Primary' );
866
	$theme_colors["secondary"] = __( 'Secondary' );
867
	$theme_colors["success"]   = __( 'Success' );
868
	$theme_colors["danger"]    = __( 'Danger' );
869
	$theme_colors["warning"]   = __( 'Warning' );
870
	$theme_colors["info"]      = __( 'Info' );
871
	$theme_colors["light"]     = __( 'Light' );
872
	$theme_colors["dark"]      = __( 'Dark' );
873
	$theme_colors["white"]     = __( 'White' );
874
	$theme_colors["purple"]    = __( 'Purple' );
875
	$theme_colors["salmon"]    = __( 'Salmon' );
876
	$theme_colors["cyan"]      = __( 'Cyan' );
877
	$theme_colors["gray"]      = __( 'Gray' );
878
	$theme_colors["indigo"]    = __( 'Indigo' );
879
	$theme_colors["orange"]    = __( 'Orange' );
880
881
	if ( $include_outlines ) {
882
		$button_only                       = $outline_button_only_text ? " " . __( "(button only)" ) : '';
883
		$theme_colors["outline-primary"]   = __( 'Primary outline' ) . $button_only;
884
		$theme_colors["outline-secondary"] = __( 'Secondary outline' ) . $button_only;
885
		$theme_colors["outline-success"]   = __( 'Success outline' ) . $button_only;
886
		$theme_colors["outline-danger"]    = __( 'Danger outline' ) . $button_only;
887
		$theme_colors["outline-warning"]   = __( 'Warning outline' ) . $button_only;
888
		$theme_colors["outline-info"]      = __( 'Info outline' ) . $button_only;
889
		$theme_colors["outline-light"]     = __( 'Light outline' ) . $button_only;
890
		$theme_colors["outline-dark"]      = __( 'Dark outline' ) . $button_only;
891
		$theme_colors["outline-white"]     = __( 'White outline' ) . $button_only;
892
		$theme_colors["outline-purple"]    = __( 'Purple outline' ) . $button_only;
893
		$theme_colors["outline-salmon"]    = __( 'Salmon outline' ) . $button_only;
894
		$theme_colors["outline-cyan"]      = __( 'Cyan outline' ) . $button_only;
895
		$theme_colors["outline-gray"]      = __( 'Gray outline' ) . $button_only;
896
		$theme_colors["outline-indigo"]    = __( 'Indigo outline' ) . $button_only;
897
		$theme_colors["outline-orange"]    = __( 'Orange outline' ) . $button_only;
898
	}
899
900
901
	if ( $include_branding ) {
902
		$theme_colors = $theme_colors + sd_aui_branding_colors();
903
	}
904
905
	return $theme_colors;
906
}
907
908
/**
909
 * Get the AUI brangin colors.
910
 *
911
 * @return array
912
 */
913
function sd_aui_branding_colors() {
914
	return array(
915
		"facebook"  => __( 'Facebook' ),
916
		"twitter"   => __( 'Twitter' ),
917
		"instagram" => __( 'Instagram' ),
918
		"linkedin"  => __( 'Linkedin' ),
919
		"flickr"    => __( 'Flickr' ),
920
		"github"    => __( 'GitHub' ),
921
		"youtube"   => __( 'YouTube' ),
922
		"wordpress" => __( 'WordPress' ),
923
		"google"    => __( 'Google' ),
924
		"yahoo"     => __( 'Yahoo' ),
925
		"vkontakte" => __( 'Vkontakte' ),
926
	);
927
}
928
929
930
/**
931
 * A helper function for container class.
932
 *
933
 * @param string $type
934
 * @param array $overwrite
935
 *
936
 * @return array
937
 */
938
function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

938
function sd_get_container_class_input( /** @scrutinizer ignore-unused */ $type = 'container', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
939
940
941
	$options = array(
942
		"container"       => __( 'container (default)' ),
943
		"container-sm"    => 'container-sm',
944
		"container-md"    => 'container-md',
945
		"container-lg"    => 'container-lg',
946
		"container-xl"    => 'container-xl',
947
		"container-xxl"   => 'container-xxl',
948
		"container-fluid" => 'container-fluid',
949
		"row"             => 'row',
950
		"col"             => 'col',
951
		"card"            => 'card',
952
		"card-header"     => 'card-header',
953
		"card-body"       => 'card-body',
954
		"card-footer"     => 'card-footer',
955
		"list-group"      => 'list-group',
956
		"list-group-item" => 'list-group-item',
957
	);
958
959
	$defaults = array(
960
		'type'     => 'select',
961
		'title'    => __( 'Type' ),
962
		'options'  => $options,
963
		'default'  => '',
964
		'desc_tip' => true,
965
		'group'    => __( "Container" )
966
	);
967
968
969
	$input = wp_parse_args( $overwrite, $defaults );
970
971
972
	return $input;
973
}
974
975
/**
976
 * A helper function for position class.
977
 *
978
 * @param string $type
979
 * @param array $overwrite
980
 *
981
 * @return array
982
 */
983
function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

983
function sd_get_position_class_input( /** @scrutinizer ignore-unused */ $type = 'position', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
984
985
986
	$options = array(
987
		""                  => __( 'Default' ),
988
		"position-static"   => 'static',
989
		"position-relative" => 'relative',
990
		"position-absolute" => 'absolute',
991
		"position-fixed"    => 'fixed',
992
		"position-sticky"   => 'sticky',
993
		"fixed-top"         => 'fixed-top',
994
		"fixed-bottom"      => 'fixed-bottom',
995
		"sticky-top"        => 'sticky-top',
996
	);
997
998
	$defaults = array(
999
		'type'     => 'select',
1000
		'title'    => __( 'Position' ),
1001
		'options'  => $options,
1002
		'default'  => '',
1003
		'desc_tip' => true,
1004
		'group'    => __( "Wrapper Styles" )
1005
	);
1006
1007
1008
	$input = wp_parse_args( $overwrite, $defaults );
1009
1010
1011
	return $input;
1012
}
1013
1014
/**
1015
 * A helper function for sticky offset input.
1016
 *
1017
 * @param string $type
1018
 * @param array $overwrite
1019
 *
1020
 * @return array
1021
 */
1022
function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1023
1024
	$defaults = array(
1025
		'type'            => 'number',
1026
		'title'           => __( 'Sticky offset' ),
1027
		//'desc' =>  __('Sticky offset'),
1028
		'default'         => '',
1029
		'desc_tip'        => true,
1030
		'group'           => __( "Wrapper Styles" ),
1031
		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"'
1032
	);
1033
1034
	// title
1035
	if ( $type == 'top' ) {
1036
		$defaults['title'] = __( 'Top offset' );
1037
		$defaults['icon']  = 'box-top';
1038
		$defaults['row']   = array(
1039
			'title' => __( 'Sticky offset' ),
1040
			'key'   => 'sticky-offset',
1041
			'open'  => true,
1042
			'class' => 'text-center',
1043
		);
1044
	} elseif ( $type == 'bottom' ) {
1045
		$defaults['title'] = __( 'Bottom offset' );
1046
		$defaults['icon']  = 'box-bottom';
1047
		$defaults['row']   = array(
1048
			'key'   => 'sticky-offset',
1049
			'close' => true,
1050
		);
1051
	}
1052
1053
1054
	$input = wp_parse_args( $overwrite, $defaults );
1055
1056
1057
	return $input;
1058
}
1059
1060
/**
1061
 * A helper function for font size
1062
 *
1063
 * @param string $type
1064
 * @param array $overwrite
1065
 *
1066
 * @return array
1067
 */
1068
function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1068
function sd_get_font_size_input( /** @scrutinizer ignore-unused */ $type = 'font_size', $overwrite = array(), $has_custom = false ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1069
1070
1071
	$options = array(
1072
		""          => __( 'Inherit from parent' ),
1073
		"h6"        => 'h6',
1074
		"h5"        => 'h5',
1075
		"h4"        => 'h4',
1076
		"h3"        => 'h3',
1077
		"h2"        => 'h2',
1078
		"h1"        => 'h1',
1079
		"display-1" => "display-1",
1080
		"display-2" => "display-2",
1081
		"display-3" => "display-3",
1082
		"display-4" => "display-4",
1083
	);
1084
1085
	if ( $has_custom ) {
1086
		$options['custom'] = __( 'Custom size' );
1087
	}
1088
1089
	$defaults = array(
1090
		'type'     => 'select',
1091
		'title'    => __( 'Font size' ),
1092
		'options'  => $options,
1093
		'default'  => '',
1094
		'desc_tip' => true,
1095
		'group'    => __( "Typography" )
1096
	);
1097
1098
1099
	$input = wp_parse_args( $overwrite, $defaults );
1100
1101
1102
	return $input;
1103
}
1104
1105
/**
1106
 * A helper function for custom font size.
1107
 *
1108
 * @param string $type
1109
 * @param array $overwrite
1110
 *
1111
 * @return array
1112
 */
1113
function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1113
function sd_get_font_custom_size_input( /** @scrutinizer ignore-unused */ $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1114
1115
1116
	$defaults = array(
1117
		'type'              => 'number',
1118
		'title'             => __( 'Font size (rem)' ),
1119
		'default'           => '',
1120
		'placeholder'       => '1.25',
1121
		'custom_attributes' => array(
1122
			'step' => '0.1',
1123
			'min'  => '0',
1124
			'max'  => '100',
1125
		),
1126
		'desc_tip'          => true,
1127
		'group'             => __( "Typography" )
1128
	);
1129
1130
	if ( $parent_type ) {
1131
		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1132
	}
1133
1134
1135
	$input = wp_parse_args( $overwrite, $defaults );
1136
1137
1138
	return $input;
1139
}
1140
1141
/**
1142
 * A helper function for font size inputs.
1143
 *
1144
 * @param string $type
1145
 * @param array $overwrite
1146
 *
1147
 * @return array
1148
 */
1149
function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1150
1151
1152
	$inputs = array();
1153
1154
	if ( $overwrite !== false ) {
0 ignored issues
show
introduced by
The condition $overwrite !== false is always true.
Loading history...
1155
		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1156
	}
1157
1158
	if ( $overwrite_custom !== false ) {
1159
		$custom            = $type . "_custom";
1160
		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1161
	}
1162
1163
1164
	return $inputs;
1165
}
1166
1167
/**
1168
 * A helper function for font weight.
1169
 *
1170
 * @param string $type
1171
 * @param array $overwrite
1172
 *
1173
 * @return array
1174
 */
1175
function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1175
function sd_get_font_weight_input( /** @scrutinizer ignore-unused */ $type = 'font_weight', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1176
1177
1178
	$options = array(
1179
		""                                => __( 'Inherit' ),
1180
		"font-weight-bold"                => 'bold',
1181
		"font-weight-bolder"              => 'bolder',
1182
		"font-weight-normal"              => 'normal',
1183
		"font-weight-light"               => 'light',
1184
		"font-weight-lighter"             => 'lighter',
1185
		"font-italic"                     => 'italic',
1186
		"font-weight-bold font-italic"    => 'bold italic',
1187
		"font-weight-bolder font-italic"  => 'bolder italic',
1188
		"font-weight-normal font-italic"  => 'normal italic',
1189
		"font-weight-light font-italic"   => 'light italic',
1190
		"font-weight-lighter font-italic" => 'lighter italic',
1191
	);
1192
1193
	$defaults = array(
1194
		'type'     => 'select',
1195
		'title'    => __( 'Appearance' ),
1196
		'options'  => $options,
1197
		'default'  => '',
1198
		'desc_tip' => true,
1199
		'group'    => __( "Typography" )
1200
	);
1201
1202
1203
	$input = wp_parse_args( $overwrite, $defaults );
1204
1205
1206
	return $input;
1207
}
1208
1209
/**
1210
 * A helper function for font case class.
1211
 *
1212
 * @param $type
1213
 * @param $overwrite
1214
 *
1215
 * @return array
1216
 */
1217
function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1217
function sd_get_font_case_input( /** @scrutinizer ignore-unused */ $type = 'font_weight', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1218
1219
1220
	$options = array(
1221
		""                => __( 'Default' ),
1222
		"text-lowercase"  => __( 'lowercase' ),
1223
		"text-uppercase"  => __( 'UPPERCASE' ),
1224
		"text-capitalize" => __( 'Capitalize' ),
1225
	);
1226
1227
	$defaults = array(
1228
		'type'     => 'select',
1229
		'title'    => __( 'Letter case' ),
1230
		'options'  => $options,
1231
		'default'  => '',
1232
		'desc_tip' => true,
1233
		'group'    => __( "Typography" )
1234
	);
1235
1236
1237
	$input = wp_parse_args( $overwrite, $defaults );
1238
1239
1240
	return $input;
1241
}
1242
1243
/**
1244
 * @param string $type
1245
 * @param array $overwrite
1246
 *
1247
 * @return array
1248
 * @todo remove this as now included above.
1249
 * A helper function for font size
1250
 *
1251
 */
1252
function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1252
function sd_get_font_italic_input( /** @scrutinizer ignore-unused */ $type = 'font_italic', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1253
1254
1255
	$options = array(
1256
		""            => __( 'No' ),
1257
		"font-italic" => __( 'Yes' )
1258
	);
1259
1260
	$defaults = array(
1261
		'type'     => 'select',
1262
		'title'    => __( 'Font italic' ),
1263
		'options'  => $options,
1264
		'default'  => '',
1265
		'desc_tip' => true,
1266
		'group'    => __( "Typography" )
1267
	);
1268
1269
	$input = wp_parse_args( $overwrite, $defaults );
1270
1271
1272
	return $input;
1273
}
1274
1275
/**
1276
 * A helper function for the anchor input.
1277
 *
1278
 * @param $type
1279
 * @param $overwrite
1280
 *
1281
 * @return array
1282
 */
1283
function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1283
function sd_get_anchor_input( /** @scrutinizer ignore-unused */ $type = 'anchor', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1284
1285
1286
	$defaults = array(
1287
		'type'     => 'text',
1288
		'title'    => __( 'HTML anchor' ),
1289
		'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1290
		'default'  => '',
1291
		'desc_tip' => true,
1292
		'group'    => __( "Advanced" )
1293
	);
1294
1295
	$input = wp_parse_args( $overwrite, $defaults );
1296
1297
1298
	return $input;
1299
}
1300
1301
/**
1302
 * A helper function for the class input.
1303
 *
1304
 * @param $type
1305
 * @param $overwrite
1306
 *
1307
 * @return array
1308
 */
1309
function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1309
function sd_get_class_input( /** @scrutinizer ignore-unused */ $type = 'css_class', $overwrite = array() ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1310
1311
	$defaults = array(
1312
		'type'     => 'text',
1313
		'title'    => __( 'Additional CSS class(es)' ),
1314
		'desc'     => __( 'Separate multiple classes with spaces.' ),
1315
		'default'  => '',
1316
		'desc_tip' => true,
1317
		'group'    => __( "Advanced" )
1318
	);
1319
1320
	$input = wp_parse_args( $overwrite, $defaults );
1321
1322
1323
	return $input;
1324
}
1325
1326
1327
/**
1328
 * Build AUI classes from settings.
1329
 *
1330
 * @param $args
1331
 *
1332
 * @return string
1333
 * @todo find best way to use px- py- or general p-
1334
 */
1335
function sd_build_aui_class( $args ) {
1336
1337
	$classes = array();
1338
1339
	// margins.
1340
	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1341
		$classes[] = "mt-" . sanitize_html_class( $args['mt'] );
1342
		$mt        = $args['mt'];
1343
	} else {
1344
		$mt = null;
1345
	}
1346
	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1347
		$classes[] = "mr-" . sanitize_html_class( $args['mr'] );
1348
		$mr        = $args['mr'];
1349
	} else {
1350
		$mr = null;
1351
	}
1352
	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1353
		$classes[] = "mb-" . sanitize_html_class( $args['mb'] );
1354
		$mb        = $args['mb'];
1355
	} else {
1356
		$mb = null;
1357
	}
1358
	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1359
		$classes[] = "ml-" . sanitize_html_class( $args['ml'] );
1360
		$ml        = $args['ml'];
1361
	} else {
1362
		$ml = null;
1363
	}
1364
1365
	// margins tablet.
1366
	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1367
		$classes[] = "mt-md-" . sanitize_html_class( $args['mt_md'] );
1368
		$mt_md     = $args['mt_md'];
1369
	} else {
1370
		$mt_md = null;
1371
	}
1372
	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1373
		$classes[] = "mr-md-" . sanitize_html_class( $args['mr_md'] );
1374
		$mt_md     = $args['mr_md'];
1375
	} else {
1376
		$mr_md = null;
1377
	}
1378
	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1379
		$classes[] = "mb-md-" . sanitize_html_class( $args['mb_md'] );
1380
		$mt_md     = $args['mb_md'];
1381
	} else {
1382
		$mb_md = null;
1383
	}
1384
	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1385
		$classes[] = "ml-md-" . sanitize_html_class( $args['ml_md'] );
1386
		$mt_md     = $args['ml_md'];
1387
	} else {
1388
		$ml_md = null;
1389
	}
1390
1391
	// margins desktop.
1392
	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1393
		if ( $mt == null && $mt_md == null ) {
1394
			$classes[] = "mt-" . sanitize_html_class( $args['mt_lg'] );
1395
		} else {
1396
			$classes[] = "mt-lg-" . sanitize_html_class( $args['mt_lg'] );
1397
		}
1398
	}
1399
	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1400
		if ( $mr == null && $mr_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $mr_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1401
			$classes[] = "mr-" . sanitize_html_class( $args['mr_lg'] );
1402
		} else {
1403
			$classes[] = "mr-lg-" . sanitize_html_class( $args['mr_lg'] );
1404
		}
1405
	}
1406
	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1407
		if ( $mb == null && $mb_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $mb_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1408
			$classes[] = "mb-" . sanitize_html_class( $args['mb_lg'] );
1409
		} else {
1410
			$classes[] = "mb-lg-" . sanitize_html_class( $args['mb_lg'] );
1411
		}
1412
	}
1413
	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1414
		if ( $ml == null && $ml_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ml_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1415
			$classes[] = "ml-" . sanitize_html_class( $args['ml_lg'] );
1416
		} else {
1417
			$classes[] = "ml-lg-" . sanitize_html_class( $args['ml_lg'] );
1418
		}
1419
	}
1420
1421
1422
	// padding.
1423
	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1424
		$classes[] = "pt-" . sanitize_html_class( $args['pt'] );
1425
		$pt        = $args['pt'];
1426
	} else {
1427
		$pt = null;
1428
	}
1429
	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1430
		$classes[] = "pr-" . sanitize_html_class( $args['pr'] );
1431
		$pr        = $args['pr'];
1432
	} else {
1433
		$pr = null;
1434
	}
1435
	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1436
		$classes[] = "pb-" . sanitize_html_class( $args['pb'] );
1437
		$pb        = $args['pb'];
1438
	} else {
1439
		$pb = null;
1440
	}
1441
	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1442
		$classes[] = "pl-" . sanitize_html_class( $args['pl'] );
1443
		$pl        = $args['pl'];
1444
	} else {
1445
		$pl = null;
1446
	}
1447
1448
	// padding tablet.
1449
	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1450
		$classes[] = "pt-md-" . sanitize_html_class( $args['pt_md'] );
1451
		$pt_md     = $args['pt_md'];
1452
	} else {
1453
		$pt_md = null;
1454
	}
1455
	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1456
		$classes[] = "pr-md-" . sanitize_html_class( $args['pr_md'] );
1457
		$pt_md     = $args['pr_md'];
1458
	} else {
1459
		$pr_md = null;
1460
	}
1461
	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1462
		$classes[] = "pb-md-" . sanitize_html_class( $args['pb_md'] );
1463
		$pt_md     = $args['pb_md'];
1464
	} else {
1465
		$pb_md = null;
1466
	}
1467
	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1468
		$classes[] = "pl-md-" . sanitize_html_class( $args['pl_md'] );
1469
		$pt_md     = $args['pl_md'];
1470
	} else {
1471
		$pl_md = null;
1472
	}
1473
1474
	// padding desktop.
1475
	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1476
		if ( $pt == null && $pt_md == null ) {
1477
			$classes[] = "pt-" . sanitize_html_class( $args['pt_lg'] );
1478
		} else {
1479
			$classes[] = "pt-lg-" . sanitize_html_class( $args['pt_lg'] );
1480
		}
1481
	}
1482
	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1483
		if ( $pr == null && $pr_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $pr_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1484
			$classes[] = "pr-" . sanitize_html_class( $args['pr_lg'] );
1485
		} else {
1486
			$classes[] = "pr-lg-" . sanitize_html_class( $args['pr_lg'] );
1487
		}
1488
	}
1489
	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1490
		if ( $pb == null && $pb_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $pb_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1491
			$classes[] = "pb-" . sanitize_html_class( $args['pb_lg'] );
1492
		} else {
1493
			$classes[] = "pb-lg-" . sanitize_html_class( $args['pb_lg'] );
1494
		}
1495
	}
1496
	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1497
		if ( $pl == null && $pl_md == null ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $pl_md does not seem to be defined for all execution paths leading up to this point.
Loading history...
1498
			$classes[] = "pl-" . sanitize_html_class( $args['pl_lg'] );
1499
		} else {
1500
			$classes[] = "pl-lg-" . sanitize_html_class( $args['pl_lg'] );
1501
		}
1502
	}
1503
1504
	// row cols, mobile, tablet, desktop
1505
	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1506
		$classes[] = sanitize_html_class( "row-cols-" . $args['row_cols'] );
1507
		$row_cols  = $args['row_cols'];
1508
	} else {
1509
		$row_cols = null;
1510
	}
1511
	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1512
		$classes[]   = sanitize_html_class( "row-cols-md-" . $args['row_cols_md'] );
1513
		$row_cols_md = $args['row_cols_md'];
1514
	} else {
1515
		$row_cols_md = null;
1516
	}
1517
	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1518
		if ( $row_cols == null && $row_cols_md == null ) {
1519
			$classes[] = sanitize_html_class( "row-cols-" . $args['row_cols_lg'] );
1520
		} else {
1521
			$classes[] = sanitize_html_class( "row-cols-lg-" . $args['row_cols_lg'] );
1522
		}
1523
	}
1524
1525
	// columns , mobile, tablet, desktop
1526
	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1527
		$classes[] = sanitize_html_class( "col-" . $args['col'] );
1528
		$col       = $args['col'];
1529
	} else {
1530
		$col = null;
1531
	}
1532
	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1533
		$classes[] = sanitize_html_class( "col-md-" . $args['col_md'] );
1534
		$col_md    = $args['col_md'];
1535
	} else {
1536
		$col_md = null;
1537
	}
1538
	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1539
		if ( $col == null && $col_md == null ) {
1540
			$classes[] = sanitize_html_class( "col-" . $args['col_lg'] );
1541
		} else {
1542
			$classes[] = sanitize_html_class( "col-lg-" . $args['col_lg'] );
1543
		}
1544
	}
1545
1546
1547
	// border
1548
	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1549
		$classes[] = "border-0";
1550
	} elseif ( ! empty( $args['border'] ) ) {
1551
		$classes[] = "border border-" . sanitize_html_class( $args['border'] );
1552
	}
1553
1554
	// border radius type
1555
	if ( ! empty( $args['rounded'] ) ) {
1556
		$classes[] = sanitize_html_class( $args['rounded'] );
1557
	}
1558
1559
	// border radius size
1560
	if ( ! empty( $args['rounded_size'] ) ) {
1561
		$classes[] = "rounded-" . sanitize_html_class( $args['rounded_size'] );
1562
		// if we set a size then we need to remove "rounded" if set
1563
		if ( ( $key = array_search( "rounded", $classes ) ) !== false ) {
1564
			unset( $classes[ $key ] );
1565
		}
1566
	}
1567
1568
	// shadow
1569
	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1570
1571
	// background
1572
	if ( ! empty( $args['bg'] ) ) {
1573
		$classes[] = "bg-" . sanitize_html_class( $args['bg'] );
1574
	}
1575
1576
	// text_color
1577
	if ( ! empty( $args['text_color'] ) ) {
1578
		$classes[] = "text-" . sanitize_html_class( $args['text_color'] );
1579
	}
1580
1581
	// text_align
1582
	if ( ! empty( $args['text_justify'] ) ) {
1583
		$classes[] = 'text-justify';
1584
	} else {
1585
		if ( ! empty( $args['text_align'] ) ) {
1586
			$classes[]  = sanitize_html_class( $args['text_align'] );
1587
			$text_align = $args['text_align'];
1588
		} else {
1589
			$text_align = null;
1590
		}
1591
		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1592
			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1593
			$text_align_md = $args['text_align_md'];
1594
		} else {
1595
			$text_align_md = null;
1596
		}
1597
		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1598
			if ( $text_align == null && $text_align_md == null ) {
1599
				$classes[] = sanitize_html_class( str_replace( "-lg", "", $args['text_align_lg'] ) );
1600
			} else {
1601
				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1602
			}
1603
		}
1604
	}
1605
1606
	// display
1607
	if ( ! empty( $args['display'] ) ) {
1608
		$classes[] = sanitize_html_class( $args['display'] );
1609
		$display   = $args['display'];
1610
	} else {
1611
		$display = null;
1612
	}
1613
	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1614
		$classes[]  = sanitize_html_class( $args['display_md'] );
1615
		$display_md = $args['display_md'];
1616
	} else {
1617
		$display_md = null;
1618
	}
1619
	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1620
		if ( $display == null && $display_md == null ) {
1621
			$classes[] = sanitize_html_class( str_replace( "-lg", "", $args['display_lg'] ) );
1622
		} else {
1623
			$classes[] = sanitize_html_class( $args['display_lg'] );
1624
		}
1625
	}
1626
1627
1628
	// bgtus - background transparent until scroll
1629
	if ( ! empty( $args['bgtus'] ) ) {
1630
		$classes[] = sanitize_html_class( "bg-transparent-until-scroll" );
1631
	}
1632
1633
1634
	// build classes from build keys
1635
	$build_keys = sd_get_class_build_keys();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $build_keys is correct as sd_get_class_build_keys() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
1636
	if ( ! empty( $build_keys ) ) {
1637
		foreach ( $build_keys as $key ) {
0 ignored issues
show
Bug introduced by
The expression $build_keys of type void is not traversable.
Loading history...
1638
			if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1639
				continue;
1640
			}
1641
			if ( ! empty( $args[ $key ] ) ) {
1642
				$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1643
			}
1644
		}
1645
	}
1646
1647
1648
	return implode( " ", $classes );
1649
}
1650
1651
/**
1652
 * Build Style output from arguments.
1653
 *
1654
 * @param $args
1655
 *
1656
 * @return array
1657
 */
1658
function sd_build_aui_styles( $args ) {
1659
1660
	$styles = array();
1661
1662
	// background color
1663
	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
1664
		if ( $args['bg'] == 'custom-color' ) {
1665
			$styles['background-color'] = $args['bg_color'];
1666
		} else if ( $args['bg'] == 'custom-gradient' ) {
1667
			$styles['background-image'] = $args['bg_gradient'];
1668
1669
			// use background on text.
1670
			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
1671
				$styles['background-clip']         = "text";
1672
				$styles['-webkit-background-clip'] = "text";
1673
				$styles['text-fill-color']         = "transparent";
1674
				$styles['-webkit-text-fill-color'] = "transparent";
1675
			}
1676
		}
1677
	}
1678
1679
	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
1680
		$hasImage = true;
1681
		if ( $styles['background-color'] !== undefined && $args['bg'] == 'custom-color' ) {
0 ignored issues
show
Bug introduced by
The constant undefined was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
1682
			$styles['background-image']      = "url(" . $args['bg_image'] . ")";
1683
			$styles['background-blend-mode'] = "overlay";
1684
		} else if ( $styles['background-image'] !== undefined && $args['bg'] == 'custom-gradient' ) {
1685
			$styles['background-image'] .= ",url(" . $args['bg_image'] . ")";
1686
		} else if ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
1687
			// do nothing as we alreay have a preset
1688
			$hasImage = false;
1689
		} else {
1690
			$styles['background-image'] = "url(" . $args['bg_image'] . ")";
1691
		}
1692
1693
		if ( $hasImage ) {
1694
			$styles['background-size'] = "cover";
1695
1696
			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
1697
				$styles['background-attachment'] = "fixed";
1698
			}
1699
		}
1700
1701
		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && $args['bg_image_xy'] . x . length ) {
0 ignored issues
show
Bug introduced by
The constant length was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant x was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
1702
			$styles['background-position'] = ( $args['bg_image_xy'] . x * 100 ) . "% " . ( $args['bg_image_xy'] . y * 100 ) . "%";
0 ignored issues
show
Bug introduced by
The constant y was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
1703
		}
1704
	}
1705
1706
	// sticky offset top
1707
	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
1708
		$styles['top'] = absint( $args['sticky_offset_top'] );
1709
	}
1710
1711
	// sticky offset bottom
1712
	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
1713
		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
1714
	}
1715
1716
	// font size
1717
	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
1718
		$styles['font-size'] = (float) $args['font_size_custom'] . "rem";
1719
1720
	}
1721
1722
	$style_string = '';
1723
	if ( ! empty( $styles ) ) {
1724
		foreach ( $styles as $key => $val ) {
1725
			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
1726
		}
1727
	}
1728
1729
	return $style_string;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $style_string returns the type string which is incompatible with the documented return type array.
Loading history...
1730
1731
}
1732
1733
/**
1734
 * Sanitize single or multiple HTML classes.
1735
 *
1736
 * @param $classes
1737
 * @param $sep
1738
 *
1739
 * @return string
1740
 */
1741
function sd_sanitize_html_classes( $classes, $sep = " " ) {
1742
	$return = "";
1743
1744
	if ( ! is_array( $classes ) ) {
1745
		$classes = explode( $sep, $classes );
1746
	}
1747
1748
	if ( ! empty( $classes ) ) {
1749
		foreach ( $classes as $class ) {
1750
			$return .= sanitize_html_class( $class ) . " ";
1751
		}
1752
	}
1753
1754
	return $return;
1755
}
1756
1757
1758
/**
1759
 * Keys that are used for the class builder.
1760
 *
1761
 * @return void
1762
 */
1763
function sd_get_class_build_keys() {
1764
	$keys = array(
1765
		'container',
1766
		'position',
1767
		'flex_direction',
1768
		'shadow',
1769
		'rounded',
1770
		'nav_style',
1771
		'horizontal_alignment',
1772
		'nav_fill',
1773
		'width',
1774
		'font_weight',
1775
		'font_size',
1776
		'font_case',
1777
		'css_class',
1778
	);
1779
1780
	return apply_filters( "sd_class_build_keys", $keys );
0 ignored issues
show
Bug Best Practice introduced by
The expression return apply_filters('sd...ass_build_keys', $keys) also could return the type array<integer,string> which is incompatible with the documented return type void.
Loading history...
1781
}
1782