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( |
15
|
|
|
'sd_pagenow_exclude', |
16
|
|
|
array( |
17
|
|
|
'upload.php', |
18
|
|
|
'edit-comments.php', |
19
|
|
|
'edit-tags.php', |
20
|
|
|
'index.php', |
21
|
|
|
'media-new.php', |
22
|
|
|
'options-discussion.php', |
23
|
|
|
'options-writing.php', |
24
|
|
|
'edit.php', |
25
|
|
|
'themes.php', |
26
|
|
|
'users.php', |
27
|
|
|
) |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Return an array of widget class names that should be excluded. |
34
|
|
|
* |
35
|
|
|
* Used to conditionally load widgets code. |
36
|
|
|
* |
37
|
|
|
* @return mixed|void |
38
|
|
|
*/ |
39
|
|
|
function sd_widget_exclude() { |
40
|
|
|
return apply_filters( 'sd_widget_exclude', array() ); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* A helper function for margin inputs. |
46
|
|
|
* |
47
|
|
|
* @param string $type |
48
|
|
|
* @param array $overwrite |
49
|
|
|
* |
50
|
|
|
* @return array |
51
|
|
|
*/ |
52
|
|
|
function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) { |
53
|
|
|
$options = array( |
54
|
|
|
'' => __( 'None', 'super-duper' ), |
55
|
|
|
'auto' => __( 'auto', 'super-duper' ), |
56
|
|
|
'0' => '0', |
57
|
|
|
'1' => '1', |
58
|
|
|
'2' => '2', |
59
|
|
|
'3' => '3', |
60
|
|
|
'4' => '4', |
61
|
|
|
'5' => '5', |
62
|
|
|
); |
63
|
|
|
|
64
|
|
|
if ( $include_negatives ) { |
65
|
|
|
$options['n1'] = '-1'; |
66
|
|
|
$options['n2'] = '-2'; |
67
|
|
|
$options['n3'] = '-3'; |
68
|
|
|
$options['n4'] = '-4'; |
69
|
|
|
$options['n5'] = '-5'; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
$defaults = array( |
73
|
|
|
'type' => 'select', |
74
|
|
|
'title' => __( 'Margin top', 'super-duper' ), |
75
|
|
|
'options' => $options, |
76
|
|
|
'default' => '', |
77
|
|
|
'desc_tip' => true, |
78
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
79
|
|
|
); |
80
|
|
|
|
81
|
|
|
// title |
82
|
|
|
if ( $type == 'mt' ) { |
83
|
|
|
$defaults['title'] = __( 'Margin top', 'super-duper' ); |
84
|
|
|
$defaults['icon'] = 'box-top'; |
85
|
|
|
$defaults['row'] = array( |
86
|
|
|
'title' => __( 'Margins', 'super-duper' ), |
87
|
|
|
'key' => 'wrapper-margins', |
88
|
|
|
'open' => true, |
89
|
|
|
'class' => 'text-center', |
90
|
|
|
); |
91
|
|
|
} elseif ( $type == 'mr' ) { |
92
|
|
|
$defaults['title'] = __( 'Margin right', 'super-duper' ); |
93
|
|
|
$defaults['icon'] = 'box-right'; |
94
|
|
|
$defaults['row'] = array( |
95
|
|
|
'key' => 'wrapper-margins', |
96
|
|
|
); |
97
|
|
|
} elseif ( $type == 'mb' ) { |
98
|
|
|
$defaults['title'] = __( 'Margin bottom', 'super-duper' ); |
99
|
|
|
$defaults['icon'] = 'box-bottom'; |
100
|
|
|
$defaults['row'] = array( |
101
|
|
|
'key' => 'wrapper-margins', |
102
|
|
|
); |
103
|
|
|
} elseif ( $type == 'ml' ) { |
104
|
|
|
$defaults['title'] = __( 'Margin left', 'super-duper' ); |
105
|
|
|
$defaults['icon'] = 'box-left'; |
106
|
|
|
$defaults['row'] = array( |
107
|
|
|
'key' => 'wrapper-margins', |
108
|
|
|
'close' => true, |
109
|
|
|
); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
113
|
|
|
|
114
|
|
|
return $input; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* A helper function for padding inputs. |
119
|
|
|
* |
120
|
|
|
* @param string $type |
121
|
|
|
* @param array $overwrite |
122
|
|
|
* |
123
|
|
|
* @return array |
124
|
|
|
*/ |
125
|
|
|
function sd_get_padding_input( $type = 'pt', $overwrite = array() ) { |
126
|
|
|
$options = array( |
127
|
|
|
'' => __( 'None', 'super-duper' ), |
128
|
|
|
'0' => '0', |
129
|
|
|
'1' => '1', |
130
|
|
|
'2' => '2', |
131
|
|
|
'3' => '3', |
132
|
|
|
'4' => '4', |
133
|
|
|
'5' => '5', |
134
|
|
|
); |
135
|
|
|
|
136
|
|
|
$defaults = array( |
137
|
|
|
'type' => 'select', |
138
|
|
|
'title' => __( 'Padding top', 'super-duper' ), |
139
|
|
|
'options' => $options, |
140
|
|
|
'default' => '', |
141
|
|
|
'desc_tip' => true, |
142
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
143
|
|
|
); |
144
|
|
|
|
145
|
|
|
// title |
146
|
|
|
if ( $type == 'pt' ) { |
147
|
|
|
$defaults['title'] = __( 'Padding top', 'super-duper' ); |
148
|
|
|
$defaults['icon'] = 'box-top'; |
149
|
|
|
$defaults['row'] = array( |
150
|
|
|
'title' => __( 'Padding', 'super-duper' ), |
151
|
|
|
'key' => 'wrapper-padding', |
152
|
|
|
'open' => true, |
153
|
|
|
'class' => 'text-center', |
154
|
|
|
); |
155
|
|
|
} elseif ( $type == 'pr' ) { |
156
|
|
|
$defaults['title'] = __( 'Padding right', 'super-duper' ); |
157
|
|
|
$defaults['icon'] = 'box-right'; |
158
|
|
|
$defaults['row'] = array( |
159
|
|
|
'key' => 'wrapper-padding', |
160
|
|
|
); |
161
|
|
|
} elseif ( $type == 'pb' ) { |
162
|
|
|
$defaults['title'] = __( 'Padding bottom', 'super-duper' ); |
163
|
|
|
$defaults['icon'] = 'box-bottom'; |
164
|
|
|
$defaults['row'] = array( |
165
|
|
|
'key' => 'wrapper-padding', |
166
|
|
|
); |
167
|
|
|
} elseif ( $type == 'pl' ) { |
168
|
|
|
$defaults['title'] = __( 'Padding left', 'super-duper' ); |
169
|
|
|
$defaults['icon'] = 'box-left'; |
170
|
|
|
$defaults['row'] = array( |
171
|
|
|
'key' => 'wrapper-padding', |
172
|
|
|
'close' => true, |
173
|
|
|
|
174
|
|
|
); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
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', 'super-duper' ); |
204
|
|
|
$defaults['options'] = array( |
205
|
|
|
'' => __( 'Default', 'super-duper' ), |
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', 'super-duper' ); |
217
|
|
|
$defaults['options'] = array( |
218
|
|
|
'' => __( 'Default', 'super-duper' ), |
219
|
|
|
'sm' => __( 'Small', 'super-duper' ), |
220
|
|
|
'lg' => __( 'Large', 'super-duper' ), |
221
|
|
|
); |
222
|
|
|
} elseif ( $type == 'type' ) { |
223
|
|
|
$defaults['title'] = __( 'Border type', 'super-duper' ); |
224
|
|
|
$defaults['options'] = array( |
225
|
|
|
'' => __( 'None', 'super-duper' ), |
226
|
|
|
'border' => __( 'Full', 'super-duper' ), |
227
|
|
|
'border-top' => __( 'Top', 'super-duper' ), |
228
|
|
|
'border-bottom' => __( 'Bottom', 'super-duper' ), |
229
|
|
|
'border-left' => __( 'Left', 'super-duper' ), |
230
|
|
|
'border-right' => __( 'Right', 'super-duper' ), |
231
|
|
|
); |
232
|
|
|
} else { |
233
|
|
|
$defaults['title'] = __( 'Border color' ); |
234
|
|
|
$defaults['options'] = array( |
235
|
|
|
'' => __( 'Default', 'super-duper' ), |
236
|
|
|
'0' => __( 'None', 'super-duper' ), |
237
|
|
|
) + sd_aui_colors(); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
241
|
|
|
|
242
|
|
|
return $input; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* A helper function for shadow inputs. |
247
|
|
|
* |
248
|
|
|
* @param string $type |
249
|
|
|
* @param array $overwrite |
250
|
|
|
* |
251
|
|
|
* @return array |
252
|
|
|
*/ |
253
|
|
|
function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) { |
|
|
|
|
254
|
|
|
$options = array( |
255
|
|
|
'' => __( 'None', 'super-duper' ), |
256
|
|
|
'shadow-sm' => __( 'Small', 'super-duper' ), |
257
|
|
|
'shadow' => __( 'Regular', 'super-duper' ), |
258
|
|
|
'shadow-lg' => __( 'Large', 'super-duper' ), |
259
|
|
|
); |
260
|
|
|
|
261
|
|
|
$defaults = array( |
262
|
|
|
'type' => 'select', |
263
|
|
|
'title' => __( 'Shadow', 'super-duper' ), |
264
|
|
|
'options' => $options, |
265
|
|
|
'default' => '', |
266
|
|
|
'desc_tip' => true, |
267
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
268
|
|
|
); |
269
|
|
|
|
270
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
271
|
|
|
|
272
|
|
|
return $input; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* A helper function for background inputs. |
277
|
|
|
* |
278
|
|
|
* @param string $type |
279
|
|
|
* @param array $overwrite |
280
|
|
|
* |
281
|
|
|
* @return array |
282
|
|
|
*/ |
283
|
|
|
function sd_get_background_input( $type = 'bg', $overwrite = array() ) { |
|
|
|
|
284
|
|
|
$options = array( |
285
|
|
|
'' => __( 'None', 'super-duper' ), |
286
|
|
|
'transparent' => __( 'Transparent', 'super-duper' ), |
287
|
|
|
) + sd_aui_colors(); |
288
|
|
|
|
289
|
|
|
$defaults = array( |
290
|
|
|
'type' => 'select', |
291
|
|
|
'title' => __( 'Background color', 'super-duper' ), |
292
|
|
|
'options' => $options, |
293
|
|
|
'default' => '', |
294
|
|
|
'desc_tip' => true, |
295
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
296
|
|
|
); |
297
|
|
|
|
298
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
299
|
|
|
|
300
|
|
|
return $input; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* A helper function for a set of background inputs. |
305
|
|
|
* |
306
|
|
|
* @param string $type |
307
|
|
|
* @param array $overwrite |
308
|
|
|
* |
309
|
|
|
* @return array |
310
|
|
|
*/ |
311
|
|
|
function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) { |
312
|
|
|
$options = array( |
313
|
|
|
'' => __( 'None', 'super-duper' ), |
314
|
|
|
'transparent' => __( 'Transparent', 'super-duper' ), |
315
|
|
|
) + sd_aui_colors() |
316
|
|
|
+ array( |
317
|
|
|
'custom-color' => __( 'Custom Color', 'super-duper' ), |
318
|
|
|
'custom-gradient' => __( 'Custom Gradient', 'super-duper' ), |
319
|
|
|
); |
320
|
|
|
|
321
|
|
|
$defaults = array( |
322
|
|
|
'type' => 'select', |
323
|
|
|
'title' => __( 'Background Color', 'super-duper' ), |
324
|
|
|
'options' => $options, |
325
|
|
|
'default' => '', |
326
|
|
|
'desc_tip' => true, |
327
|
|
|
'group' => __( 'Background', 'super-duper' ), |
328
|
|
|
); |
329
|
|
|
|
330
|
|
|
if ( $overwrite !== false ) { |
|
|
|
|
331
|
|
|
$input[ $type ] = wp_parse_args( $overwrite, $defaults ); |
|
|
|
|
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
if ( $overwrite_color !== false ) { |
335
|
|
|
$input[ $type . '_color' ] = wp_parse_args( |
336
|
|
|
$overwrite_color, |
337
|
|
|
array( |
338
|
|
|
'type' => 'color', |
339
|
|
|
'title' => __( 'Custom color', 'super-duper' ), |
340
|
|
|
'placeholder' => '', |
341
|
|
|
'default' => '#0073aa', |
342
|
|
|
'desc_tip' => true, |
343
|
|
|
'group' => __( 'Background', 'super-duper' ), |
344
|
|
|
'element_require' => '[%' . $type . '%]=="custom-color"', |
345
|
|
|
) |
346
|
|
|
); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
if ( $overwrite_gradient !== false ) { |
350
|
|
|
$input[ $type . '_gradient' ] = wp_parse_args( |
351
|
|
|
$overwrite_gradient, |
352
|
|
|
array( |
353
|
|
|
'type' => 'gradient', |
354
|
|
|
'title' => __( 'Custom gradient', 'super-duper' ), |
355
|
|
|
'placeholder' => '', |
356
|
|
|
'default' => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', |
357
|
|
|
'desc_tip' => true, |
358
|
|
|
'group' => __( 'Background', 'super-duper' ), |
359
|
|
|
'element_require' => '[%' . $type . '%]=="custom-gradient"', |
360
|
|
|
) |
361
|
|
|
); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
if ( $overwrite_image !== false ) { |
365
|
|
|
|
366
|
|
|
$input[ $type . '_image_fixed' ] = array( |
367
|
|
|
'type' => 'checkbox', |
368
|
|
|
'title' => __( 'Fixed background', 'super-duper' ), |
369
|
|
|
'default' => '', |
370
|
|
|
'desc_tip' => true, |
371
|
|
|
'group' => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ), |
372
|
|
|
'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )', |
373
|
|
|
|
374
|
|
|
); |
375
|
|
|
|
376
|
|
|
$input[ $type . '_image_use_featured' ] = array( |
377
|
|
|
'type' => 'checkbox', |
378
|
|
|
'title' => __( 'Use featured image', 'super-duper' ), |
379
|
|
|
'default' => '', |
380
|
|
|
'desc_tip' => true, |
381
|
|
|
'group' => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ), |
382
|
|
|
'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )', |
383
|
|
|
|
384
|
|
|
); |
385
|
|
|
|
386
|
|
|
$input[ $type . '_image' ] = wp_parse_args( |
387
|
|
|
$overwrite_image, |
388
|
|
|
array( |
389
|
|
|
'type' => 'image', |
390
|
|
|
'title' => __( 'Custom image', 'super-duper' ), |
391
|
|
|
'placeholder' => '', |
392
|
|
|
'default' => '', |
393
|
|
|
'desc_tip' => true, |
394
|
|
|
'group' => __( 'Background', 'super-duper' ), |
395
|
|
|
// 'element_require' => ' ![%' . $type . '_image_use_featured%] ' |
396
|
|
|
) |
397
|
|
|
); |
398
|
|
|
|
399
|
|
|
$input[ $type . '_image_id' ] = wp_parse_args( |
400
|
|
|
$overwrite_image, |
401
|
|
|
array( |
402
|
|
|
'type' => 'hidden', |
403
|
|
|
'hidden_type' => 'number', |
404
|
|
|
'title' => '', |
405
|
|
|
'placeholder' => '', |
406
|
|
|
'default' => '', |
407
|
|
|
'group' => __( 'Background', 'super-duper' ), |
408
|
|
|
) |
409
|
|
|
); |
410
|
|
|
|
411
|
|
|
$input[ $type . '_image_xy' ] = wp_parse_args( |
412
|
|
|
$overwrite_image, |
413
|
|
|
array( |
414
|
|
|
'type' => 'image_xy', |
415
|
|
|
'title' => '', |
416
|
|
|
'placeholder' => '', |
417
|
|
|
'default' => '', |
418
|
|
|
'group' => __( 'Background', 'super-duper' ), |
419
|
|
|
) |
420
|
|
|
); |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
return $input; |
|
|
|
|
424
|
|
|
} |
425
|
|
|
|
426
|
|
|
/** |
427
|
|
|
* A helper function for a set of inputs for the shape divider. |
428
|
|
|
* |
429
|
|
|
* @param string $type |
430
|
|
|
* @param array $overwrite |
431
|
|
|
* |
432
|
|
|
* @return array |
433
|
|
|
*/ |
434
|
|
|
function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) { |
|
|
|
|
435
|
|
|
|
436
|
|
|
$options = array( |
437
|
|
|
'' => __( 'None', 'super-duper' ), |
438
|
|
|
'mountains' => __( 'Mountains', 'super-duper' ), |
439
|
|
|
'drops' => __( 'Drops', 'super-duper' ), |
440
|
|
|
'clouds' => __( 'Clouds', 'super-duper' ), |
441
|
|
|
'zigzag' => __( 'Zigzag', 'super-duper' ), |
442
|
|
|
'pyramids' => __( 'Pyramids', 'super-duper' ), |
443
|
|
|
'triangle' => __( 'Triangle', 'super-duper' ), |
444
|
|
|
'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ), |
445
|
|
|
'tilt' => __( 'Tilt', 'super-duper' ), |
446
|
|
|
'opacity-tilt' => __( 'Opacity Tilt', 'super-duper' ), |
447
|
|
|
'opacity-fan' => __( 'Opacity Fan', 'super-duper' ), |
448
|
|
|
'curve' => __( 'Curve', 'super-duper' ), |
449
|
|
|
'curve-asymmetrical' => __( 'Curve Asymmetrical', 'super-duper' ), |
450
|
|
|
'waves' => __( 'Waves', 'super-duper' ), |
451
|
|
|
'wave-brush' => __( 'Wave Brush', 'super-duper' ), |
452
|
|
|
'waves-pattern' => __( 'Waves Pattern', 'super-duper' ), |
453
|
|
|
'arrow' => __( 'Arrow', 'super-duper' ), |
454
|
|
|
'split' => __( 'Split', 'super-duper' ), |
455
|
|
|
'book' => __( 'Book', 'super-duper' ), |
456
|
|
|
); |
457
|
|
|
|
458
|
|
|
$defaults = array( |
459
|
|
|
'type' => 'select', |
460
|
|
|
'title' => __( 'Type', 'super-duper' ), |
461
|
|
|
'options' => $options, |
462
|
|
|
'default' => '', |
463
|
|
|
'desc_tip' => true, |
464
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
465
|
|
|
); |
466
|
|
|
|
467
|
|
|
$input[ $type ] = wp_parse_args( $overwrite, $defaults ); |
|
|
|
|
468
|
|
|
|
469
|
|
|
$input[ $type . '_notice' ] = array( |
470
|
|
|
'type' => 'notice', |
471
|
|
|
'desc' => __( 'Parent element must be position `relative`', 'super-duper' ), |
472
|
|
|
'status' => 'warning', |
473
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
474
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
475
|
|
|
); |
476
|
|
|
|
477
|
|
|
$input[ $type . '_position' ] = wp_parse_args( |
478
|
|
|
$overwrite_color, |
479
|
|
|
array( |
480
|
|
|
'type' => 'select', |
481
|
|
|
'title' => __( 'Position', 'super-duper' ), |
482
|
|
|
'options' => array( |
483
|
|
|
'top' => __( 'Top', 'super-duper' ), |
484
|
|
|
'bottom' => __( 'Bottom', 'super-duper' ), |
485
|
|
|
), |
486
|
|
|
'desc_tip' => true, |
487
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
488
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
489
|
|
|
) |
490
|
|
|
); |
491
|
|
|
|
492
|
|
|
$options = array( |
493
|
|
|
'' => __( 'None', 'super-duper' ), |
494
|
|
|
'transparent' => __( 'Transparent', 'super-duper' ), |
495
|
|
|
) + sd_aui_colors() |
496
|
|
|
+ array( |
497
|
|
|
'custom-color' => __( 'Custom Color', 'super-duper' ), |
498
|
|
|
); |
499
|
|
|
|
500
|
|
|
$input[ $type . '_color' ] = wp_parse_args( |
501
|
|
|
$overwrite_color, |
502
|
|
|
array( |
503
|
|
|
'type' => 'select', |
504
|
|
|
'title' => __( 'Color', 'super-duper' ), |
505
|
|
|
'options' => $options, |
506
|
|
|
'desc_tip' => true, |
507
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
508
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
509
|
|
|
) |
510
|
|
|
); |
511
|
|
|
|
512
|
|
|
$input[ $type . '_custom_color' ] = wp_parse_args( |
513
|
|
|
$overwrite_color, |
514
|
|
|
array( |
515
|
|
|
'type' => 'color', |
516
|
|
|
'title' => __( 'Custom color', 'super-duper' ), |
517
|
|
|
'placeholder' => '', |
518
|
|
|
'default' => '#0073aa', |
519
|
|
|
'desc_tip' => true, |
520
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
521
|
|
|
'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""', |
522
|
|
|
) |
523
|
|
|
); |
524
|
|
|
|
525
|
|
|
$input[ $type . '_width' ] = wp_parse_args( |
526
|
|
|
$overwrite_gradient, |
527
|
|
|
array( |
528
|
|
|
'type' => 'range', |
529
|
|
|
'title' => __( 'Width', 'super-duper' ), |
530
|
|
|
'placeholder' => '', |
531
|
|
|
'default' => '200', |
532
|
|
|
'desc_tip' => true, |
533
|
|
|
'custom_attributes' => array( |
534
|
|
|
'min' => 100, |
535
|
|
|
'max' => 300, |
536
|
|
|
), |
537
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
538
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
539
|
|
|
) |
540
|
|
|
); |
541
|
|
|
|
542
|
|
|
$input[ $type . '_height' ] = array( |
543
|
|
|
'type' => 'range', |
544
|
|
|
'title' => __( 'Height', 'super-duper' ), |
545
|
|
|
'default' => '100', |
546
|
|
|
'desc_tip' => true, |
547
|
|
|
'custom_attributes' => array( |
548
|
|
|
'min' => 0, |
549
|
|
|
'max' => 500, |
550
|
|
|
), |
551
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
552
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
553
|
|
|
); |
554
|
|
|
|
555
|
|
|
$requires = array( |
556
|
|
|
'mountains' => array( 'flip' ), |
557
|
|
|
'drops' => array( 'flip', 'invert' ), |
558
|
|
|
'clouds' => array( 'flip', 'invert' ), |
559
|
|
|
'zigzag' => array(), |
560
|
|
|
'pyramids' => array( 'flip', 'invert' ), |
561
|
|
|
'triangle' => array( 'invert' ), |
562
|
|
|
'triangle-asymmetrical' => array( 'flip', 'invert' ), |
563
|
|
|
'tilt' => array( 'flip' ), |
564
|
|
|
'opacity-tilt' => array( 'flip' ), |
565
|
|
|
'opacity-fan' => array(), |
566
|
|
|
'curve' => array( 'invert' ), |
567
|
|
|
'curve-asymmetrical' => array( 'flip', 'invert' ), |
568
|
|
|
'waves' => array( 'flip', 'invert' ), |
569
|
|
|
'wave-brush' => array( 'flip' ), |
570
|
|
|
'waves-pattern' => array( 'flip' ), |
571
|
|
|
'arrow' => array( 'invert' ), |
572
|
|
|
'split' => array( 'invert' ), |
573
|
|
|
'book' => array( 'invert' ), |
574
|
|
|
); |
575
|
|
|
|
576
|
|
|
$input[ $type . '_flip' ] = array( |
577
|
|
|
'type' => 'checkbox', |
578
|
|
|
'title' => __( 'Flip', 'super-duper' ), |
579
|
|
|
'default' => '', |
580
|
|
|
'desc_tip' => true, |
581
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
582
|
|
|
'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ), |
583
|
|
|
); |
584
|
|
|
|
585
|
|
|
$input[ $type . '_invert' ] = array( |
586
|
|
|
'type' => 'checkbox', |
587
|
|
|
'title' => __( 'Invert', 'super-duper' ), |
588
|
|
|
'default' => '', |
589
|
|
|
'desc_tip' => true, |
590
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
591
|
|
|
'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ), |
592
|
|
|
); |
593
|
|
|
|
594
|
|
|
$input[ $type . '_btf' ] = array( |
595
|
|
|
'type' => 'checkbox', |
596
|
|
|
'title' => __( 'Bring to front', 'super-duper' ), |
597
|
|
|
'default' => '', |
598
|
|
|
'desc_tip' => true, |
599
|
|
|
'group' => __( 'Shape Divider', 'super-duper' ), |
600
|
|
|
'element_require' => '[%' . $type . '%]!=""', |
601
|
|
|
|
602
|
|
|
); |
603
|
|
|
|
604
|
|
|
return $input; |
605
|
|
|
} |
606
|
|
|
|
607
|
|
|
/** |
608
|
|
|
* Get the element require sting. |
609
|
|
|
* |
610
|
|
|
* @param $args |
611
|
|
|
* @param $key |
612
|
|
|
* @param $type |
613
|
|
|
* |
614
|
|
|
* @return string |
615
|
|
|
*/ |
616
|
|
|
function sd_get_element_require_string( $args, $key, $type ) { |
617
|
|
|
$output = ''; |
618
|
|
|
$requires = array(); |
619
|
|
|
|
620
|
|
|
if ( ! empty( $args ) ) { |
621
|
|
|
foreach ( $args as $t => $k ) { |
622
|
|
|
if ( in_array( $key, $k ) ) { |
623
|
|
|
$requires[] = '[%' . $type . '%]=="' . $t . '"'; |
624
|
|
|
} |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
if ( ! empty( $requires ) ) { |
628
|
|
|
$output = '(' . implode( ' || ', $requires ) . ')'; |
629
|
|
|
} |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
return $output; |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
/** |
636
|
|
|
* A helper function for text color inputs. |
637
|
|
|
* |
638
|
|
|
* @param string $type |
639
|
|
|
* @param array $overwrite |
640
|
|
|
* |
641
|
|
|
* @return array |
642
|
|
|
*/ |
643
|
|
|
function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) { |
|
|
|
|
644
|
|
|
$options = array( |
645
|
|
|
'' => __( 'None', 'super-duper' ), |
646
|
|
|
) + sd_aui_colors(); |
647
|
|
|
|
648
|
|
|
if ( $has_custom ) { |
649
|
|
|
$options['custom'] = __( 'Custom color', 'super-duper' ); |
650
|
|
|
} |
651
|
|
|
|
652
|
|
|
$defaults = array( |
653
|
|
|
'type' => 'select', |
654
|
|
|
'title' => __( 'Text color', 'super-duper' ), |
655
|
|
|
'options' => $options, |
656
|
|
|
'default' => '', |
657
|
|
|
'desc_tip' => true, |
658
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
659
|
|
|
); |
660
|
|
|
|
661
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
662
|
|
|
|
663
|
|
|
return $input; |
664
|
|
|
} |
665
|
|
|
|
666
|
|
|
function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) { |
667
|
|
|
$inputs = array(); |
668
|
|
|
|
669
|
|
|
if ( $overwrite !== false ) { |
670
|
|
|
$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true ); |
671
|
|
|
} |
672
|
|
|
|
673
|
|
|
if ( $overwrite_custom !== false ) { |
674
|
|
|
$custom = $type . '_custom'; |
675
|
|
|
$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type ); |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
return $inputs; |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* A helper function for custom color. |
683
|
|
|
* |
684
|
|
|
* @param string $type |
685
|
|
|
* @param array $overwrite |
686
|
|
|
* |
687
|
|
|
* @return array |
688
|
|
|
*/ |
689
|
|
|
function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) { |
|
|
|
|
690
|
|
|
|
691
|
|
|
$defaults = array( |
692
|
|
|
'type' => 'color', |
693
|
|
|
'title' => __( 'Custom color', 'super-duper' ), |
694
|
|
|
'default' => '', |
695
|
|
|
'placeholder' => '', |
696
|
|
|
'desc_tip' => true, |
697
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
698
|
|
|
); |
699
|
|
|
|
700
|
|
|
if ( $parent_type ) { |
701
|
|
|
$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"'; |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
705
|
|
|
|
706
|
|
|
return $input; |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* A helper function for column inputs. |
711
|
|
|
* |
712
|
|
|
* @param string $type |
713
|
|
|
* @param array $overwrite |
714
|
|
|
* |
715
|
|
|
* @return array |
716
|
|
|
*/ |
717
|
|
|
function sd_get_col_input( $type = 'col', $overwrite = array() ) { |
|
|
|
|
718
|
|
|
|
719
|
|
|
$device_size = ''; |
720
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
721
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
722
|
|
|
$device_size = '-md'; |
|
|
|
|
723
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
724
|
|
|
$device_size = '-lg'; |
725
|
|
|
} |
726
|
|
|
} |
727
|
|
|
$options = array( |
728
|
|
|
'' => __( 'auto', 'super-duper' ), |
729
|
|
|
'1' => '1/12', |
730
|
|
|
'2' => '2/12', |
731
|
|
|
'3' => '3/12', |
732
|
|
|
'4' => '4/12', |
733
|
|
|
'5' => '5/12', |
734
|
|
|
'6' => '6/12', |
735
|
|
|
'7' => '7/12', |
736
|
|
|
'8' => '8/12', |
737
|
|
|
'9' => '9/12', |
738
|
|
|
'10' => '10/12', |
739
|
|
|
'11' => '11/12', |
740
|
|
|
'12' => '12/12', |
741
|
|
|
); |
742
|
|
|
|
743
|
|
|
$defaults = array( |
744
|
|
|
'type' => 'select', |
745
|
|
|
'title' => __( 'Column width', 'super-duper' ), |
746
|
|
|
'options' => $options, |
747
|
|
|
'default' => '', |
748
|
|
|
'desc_tip' => true, |
749
|
|
|
'group' => __( 'Container', 'super-duper' ), |
750
|
|
|
'element_require' => '[%container%]=="col"', |
751
|
|
|
); |
752
|
|
|
|
753
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
754
|
|
|
|
755
|
|
|
return $input; |
756
|
|
|
} |
757
|
|
|
|
758
|
|
|
/** |
759
|
|
|
* A helper function for row columns inputs. |
760
|
|
|
* |
761
|
|
|
* @param string $type |
762
|
|
|
* @param array $overwrite |
763
|
|
|
* |
764
|
|
|
* @return array |
765
|
|
|
*/ |
766
|
|
|
function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) { |
|
|
|
|
767
|
|
|
|
768
|
|
|
$device_size = ''; |
769
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
770
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
771
|
|
|
$device_size = '-md'; |
|
|
|
|
772
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
773
|
|
|
$device_size = '-lg'; |
774
|
|
|
} |
775
|
|
|
} |
776
|
|
|
$options = array( |
777
|
|
|
'' => __( 'auto', 'super-duper' ), |
778
|
|
|
'1' => '1', |
779
|
|
|
'2' => '2', |
780
|
|
|
'3' => '3', |
781
|
|
|
'4' => '4', |
782
|
|
|
'5' => '5', |
783
|
|
|
'6' => '6', |
784
|
|
|
); |
785
|
|
|
|
786
|
|
|
$defaults = array( |
787
|
|
|
'type' => 'select', |
788
|
|
|
'title' => __( 'Row columns', 'super-duper' ), |
789
|
|
|
'options' => $options, |
790
|
|
|
'default' => '', |
791
|
|
|
'desc_tip' => true, |
792
|
|
|
'group' => __( 'Container', 'super-duper' ), |
793
|
|
|
'element_require' => '[%container%]=="row"', |
794
|
|
|
); |
795
|
|
|
|
796
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
797
|
|
|
|
798
|
|
|
return $input; |
799
|
|
|
} |
800
|
|
|
|
801
|
|
|
/** |
802
|
|
|
* A helper function for text align inputs. |
803
|
|
|
* |
804
|
|
|
* @param string $type |
805
|
|
|
* @param array $overwrite |
806
|
|
|
* |
807
|
|
|
* @return array |
808
|
|
|
*/ |
809
|
|
|
function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) { |
|
|
|
|
810
|
|
|
|
811
|
|
|
$device_size = ''; |
812
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
813
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
814
|
|
|
$device_size = '-md'; |
815
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
816
|
|
|
$device_size = '-lg'; |
817
|
|
|
} |
818
|
|
|
} |
819
|
|
|
$options = array( |
820
|
|
|
'' => __( 'Default', 'super-duper' ), |
821
|
|
|
'text' . $device_size . '-left' => __( 'Left', 'super-duper' ), |
822
|
|
|
'text' . $device_size . '-right' => __( 'Right', 'super-duper' ), |
823
|
|
|
'text' . $device_size . '-center' => __( 'Center', 'super-duper' ), |
824
|
|
|
); |
825
|
|
|
|
826
|
|
|
$defaults = array( |
827
|
|
|
'type' => 'select', |
828
|
|
|
'title' => __( 'Text align', 'super-duper' ), |
829
|
|
|
'options' => $options, |
830
|
|
|
'default' => '', |
831
|
|
|
'desc_tip' => true, |
832
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
833
|
|
|
); |
834
|
|
|
|
835
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
836
|
|
|
|
837
|
|
|
return $input; |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* A helper function for display inputs. |
842
|
|
|
* |
843
|
|
|
* @param string $type |
844
|
|
|
* @param array $overwrite |
845
|
|
|
* |
846
|
|
|
* @return array |
847
|
|
|
*/ |
848
|
|
|
function sd_get_display_input( $type = 'display', $overwrite = array() ) { |
|
|
|
|
849
|
|
|
|
850
|
|
|
$device_size = ''; |
851
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
852
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
853
|
|
|
$device_size = '-md'; |
854
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
855
|
|
|
$device_size = '-lg'; |
856
|
|
|
} |
857
|
|
|
} |
858
|
|
|
$options = array( |
859
|
|
|
'' => __( 'Default', 'super-duper' ), |
860
|
|
|
'd' . $device_size . '-none' => 'none', |
861
|
|
|
'd' . $device_size . '-inline' => 'inline', |
862
|
|
|
'd' . $device_size . '-inline-block' => 'inline-block', |
863
|
|
|
'd' . $device_size . '-block' => 'block', |
864
|
|
|
'd' . $device_size . '-table' => 'table', |
865
|
|
|
'd' . $device_size . '-table-cell' => 'table-cell', |
866
|
|
|
'd' . $device_size . '-table-row' => 'table-row', |
867
|
|
|
'd' . $device_size . '-flex' => 'flex', |
868
|
|
|
'd' . $device_size . '-inline-flex' => 'inline-flex', |
869
|
|
|
); |
870
|
|
|
|
871
|
|
|
$defaults = array( |
872
|
|
|
'type' => 'select', |
873
|
|
|
'title' => __( 'Display', 'super-duper' ), |
874
|
|
|
'options' => $options, |
875
|
|
|
'default' => '', |
876
|
|
|
'desc_tip' => true, |
877
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
878
|
|
|
); |
879
|
|
|
|
880
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
881
|
|
|
|
882
|
|
|
return $input; |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
/** |
886
|
|
|
* A helper function for text justify inputs. |
887
|
|
|
* |
888
|
|
|
* @param string $type |
889
|
|
|
* @param array $overwrite |
890
|
|
|
* |
891
|
|
|
* @return array |
892
|
|
|
*/ |
893
|
|
|
function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) { |
|
|
|
|
894
|
|
|
|
895
|
|
|
$defaults = array( |
896
|
|
|
'type' => 'checkbox', |
897
|
|
|
'title' => __( 'Text justify', 'super-duper' ), |
898
|
|
|
'default' => '', |
899
|
|
|
'desc_tip' => true, |
900
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
901
|
|
|
); |
902
|
|
|
|
903
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
904
|
|
|
|
905
|
|
|
return $input; |
906
|
|
|
} |
907
|
|
|
|
908
|
|
|
/** |
909
|
|
|
* Get the AUI colors. |
910
|
|
|
* |
911
|
|
|
* @param $include_branding |
912
|
|
|
* @param $include_outlines |
913
|
|
|
* @param $outline_button_only_text |
914
|
|
|
* |
915
|
|
|
* @return array |
916
|
|
|
*/ |
917
|
|
|
function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) { |
918
|
|
|
$theme_colors = array(); |
919
|
|
|
|
920
|
|
|
$theme_colors['primary'] = __( 'Primary', 'super-duper' ); |
921
|
|
|
$theme_colors['secondary'] = __( 'Secondary', 'super-duper' ); |
922
|
|
|
$theme_colors['success'] = __( 'Success', 'super-duper' ); |
923
|
|
|
$theme_colors['danger'] = __( 'Danger', 'super-duper' ); |
924
|
|
|
$theme_colors['warning'] = __( 'Warning', 'super-duper' ); |
925
|
|
|
$theme_colors['info'] = __( 'Info', 'super-duper' ); |
926
|
|
|
$theme_colors['light'] = __( 'Light', 'super-duper' ); |
927
|
|
|
$theme_colors['dark'] = __( 'Dark', 'super-duper' ); |
928
|
|
|
$theme_colors['white'] = __( 'White', 'super-duper' ); |
929
|
|
|
$theme_colors['purple'] = __( 'Purple', 'super-duper' ); |
930
|
|
|
$theme_colors['salmon'] = __( 'Salmon', 'super-duper' ); |
931
|
|
|
$theme_colors['cyan'] = __( 'Cyan', 'super-duper' ); |
932
|
|
|
$theme_colors['gray'] = __( 'Gray', 'super-duper' ); |
933
|
|
|
$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' ); |
934
|
|
|
$theme_colors['indigo'] = __( 'Indigo', 'super-duper' ); |
935
|
|
|
$theme_colors['orange'] = __( 'Orange', 'super-duper' ); |
936
|
|
|
|
937
|
|
|
if ( $include_outlines ) { |
938
|
|
|
$button_only = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : ''; |
939
|
|
|
$theme_colors['outline-primary'] = __( 'Primary outline', 'super-duper' ) . $button_only; |
940
|
|
|
$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only; |
941
|
|
|
$theme_colors['outline-success'] = __( 'Success outline', 'super-duper' ) . $button_only; |
942
|
|
|
$theme_colors['outline-danger'] = __( 'Danger outline', 'super-duper' ) . $button_only; |
943
|
|
|
$theme_colors['outline-warning'] = __( 'Warning outline', 'super-duper' ) . $button_only; |
944
|
|
|
$theme_colors['outline-info'] = __( 'Info outline', 'super-duper' ) . $button_only; |
945
|
|
|
$theme_colors['outline-light'] = __( 'Light outline', 'super-duper' ) . $button_only; |
946
|
|
|
$theme_colors['outline-dark'] = __( 'Dark outline', 'super-duper' ) . $button_only; |
947
|
|
|
$theme_colors['outline-white'] = __( 'White outline', 'super-duper' ) . $button_only; |
948
|
|
|
$theme_colors['outline-purple'] = __( 'Purple outline', 'super-duper' ) . $button_only; |
949
|
|
|
$theme_colors['outline-salmon'] = __( 'Salmon outline', 'super-duper' ) . $button_only; |
950
|
|
|
$theme_colors['outline-cyan'] = __( 'Cyan outline', 'super-duper' ) . $button_only; |
951
|
|
|
$theme_colors['outline-gray'] = __( 'Gray outline', 'super-duper' ) . $button_only; |
952
|
|
|
$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only; |
953
|
|
|
$theme_colors['outline-indigo'] = __( 'Indigo outline', 'super-duper' ) . $button_only; |
954
|
|
|
$theme_colors['outline-orange'] = __( 'Orange outline', 'super-duper' ) . $button_only; |
955
|
|
|
} |
956
|
|
|
|
957
|
|
|
if ( $include_branding ) { |
958
|
|
|
$theme_colors = $theme_colors + sd_aui_branding_colors(); |
959
|
|
|
} |
960
|
|
|
|
961
|
|
|
return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding ); |
962
|
|
|
} |
963
|
|
|
|
964
|
|
|
/** |
965
|
|
|
* Get the AUI brangin colors. |
966
|
|
|
* |
967
|
|
|
* @return array |
968
|
|
|
*/ |
969
|
|
|
function sd_aui_branding_colors() { |
970
|
|
|
return array( |
971
|
|
|
'facebook' => __( 'Facebook', 'super-duper' ), |
972
|
|
|
'twitter' => __( 'Twitter', 'super-duper' ), |
973
|
|
|
'instagram' => __( 'Instagram', 'super-duper' ), |
974
|
|
|
'linkedin' => __( 'Linkedin', 'super-duper' ), |
975
|
|
|
'flickr' => __( 'Flickr', 'super-duper' ), |
976
|
|
|
'github' => __( 'GitHub', 'super-duper' ), |
977
|
|
|
'youtube' => __( 'YouTube', 'super-duper' ), |
978
|
|
|
'wordpress' => __( 'WordPress', 'super-duper' ), |
979
|
|
|
'google' => __( 'Google', 'super-duper' ), |
980
|
|
|
'yahoo' => __( 'Yahoo', 'super-duper' ), |
981
|
|
|
'vkontakte' => __( 'Vkontakte', 'super-duper' ), |
982
|
|
|
); |
983
|
|
|
} |
984
|
|
|
|
985
|
|
|
|
986
|
|
|
/** |
987
|
|
|
* A helper function for container class. |
988
|
|
|
* |
989
|
|
|
* @param string $type |
990
|
|
|
* @param array $overwrite |
991
|
|
|
* |
992
|
|
|
* @return array |
993
|
|
|
*/ |
994
|
|
|
function sd_get_container_class_input( $type = 'container', $overwrite = array() ) { |
|
|
|
|
995
|
|
|
|
996
|
|
|
$options = array( |
997
|
|
|
'container' => __( 'container (default)', 'super-duper' ), |
998
|
|
|
'container-sm' => 'container-sm', |
999
|
|
|
'container-md' => 'container-md', |
1000
|
|
|
'container-lg' => 'container-lg', |
1001
|
|
|
'container-xl' => 'container-xl', |
1002
|
|
|
'container-xxl' => 'container-xxl', |
1003
|
|
|
'container-fluid' => 'container-fluid', |
1004
|
|
|
'row' => 'row', |
1005
|
|
|
'col' => 'col', |
1006
|
|
|
'card' => 'card', |
1007
|
|
|
'card-header' => 'card-header', |
1008
|
|
|
'card-body' => 'card-body', |
1009
|
|
|
'card-footer' => 'card-footer', |
1010
|
|
|
'list-group' => 'list-group', |
1011
|
|
|
'list-group-item' => 'list-group-item', |
1012
|
|
|
); |
1013
|
|
|
|
1014
|
|
|
$defaults = array( |
1015
|
|
|
'type' => 'select', |
1016
|
|
|
'title' => __( 'Type', 'super-duper' ), |
1017
|
|
|
'options' => $options, |
1018
|
|
|
'default' => '', |
1019
|
|
|
'desc_tip' => true, |
1020
|
|
|
'group' => __( 'Container', 'super-duper' ), |
1021
|
|
|
); |
1022
|
|
|
|
1023
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1024
|
|
|
|
1025
|
|
|
return $input; |
1026
|
|
|
} |
1027
|
|
|
|
1028
|
|
|
/** |
1029
|
|
|
* A helper function for position class. |
1030
|
|
|
* |
1031
|
|
|
* @param string $type |
1032
|
|
|
* @param array $overwrite |
1033
|
|
|
* |
1034
|
|
|
* @return array |
1035
|
|
|
*/ |
1036
|
|
|
function sd_get_position_class_input( $type = 'position', $overwrite = array() ) { |
|
|
|
|
1037
|
|
|
|
1038
|
|
|
$options = array( |
1039
|
|
|
'' => __( 'Default', 'super-duper' ), |
1040
|
|
|
'position-static' => 'static', |
1041
|
|
|
'position-relative' => 'relative', |
1042
|
|
|
'position-absolute' => 'absolute', |
1043
|
|
|
'position-fixed' => 'fixed', |
1044
|
|
|
'position-sticky' => 'sticky', |
1045
|
|
|
'fixed-top' => 'fixed-top', |
1046
|
|
|
'fixed-bottom' => 'fixed-bottom', |
1047
|
|
|
'sticky-top' => 'sticky-top', |
1048
|
|
|
); |
1049
|
|
|
|
1050
|
|
|
$defaults = array( |
1051
|
|
|
'type' => 'select', |
1052
|
|
|
'title' => __( 'Position', 'super-duper' ), |
1053
|
|
|
'options' => $options, |
1054
|
|
|
'default' => '', |
1055
|
|
|
'desc_tip' => true, |
1056
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1057
|
|
|
); |
1058
|
|
|
|
1059
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1060
|
|
|
|
1061
|
|
|
return $input; |
1062
|
|
|
} |
1063
|
|
|
|
1064
|
|
|
/** |
1065
|
|
|
* A helper function for sticky offset input. |
1066
|
|
|
* |
1067
|
|
|
* @param string $type |
1068
|
|
|
* @param array $overwrite |
1069
|
|
|
* |
1070
|
|
|
* @return array |
1071
|
|
|
*/ |
1072
|
|
|
function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) { |
1073
|
|
|
|
1074
|
|
|
$defaults = array( |
1075
|
|
|
'type' => 'number', |
1076
|
|
|
'title' => __( 'Sticky offset', 'super-duper' ), |
1077
|
|
|
//'desc' => __('Sticky offset'), |
1078
|
|
|
'default' => '', |
1079
|
|
|
'desc_tip' => true, |
1080
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1081
|
|
|
'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"', |
1082
|
|
|
); |
1083
|
|
|
|
1084
|
|
|
// title |
1085
|
|
|
if ( $type == 'top' ) { |
1086
|
|
|
$defaults['title'] = __( 'Top offset', 'super-duper' ); |
1087
|
|
|
$defaults['icon'] = 'box-top'; |
1088
|
|
|
$defaults['row'] = array( |
1089
|
|
|
'title' => __( 'Sticky offset', 'super-duper' ), |
1090
|
|
|
'key' => 'sticky-offset', |
1091
|
|
|
'open' => true, |
1092
|
|
|
'class' => 'text-center', |
1093
|
|
|
); |
1094
|
|
|
} elseif ( $type == 'bottom' ) { |
1095
|
|
|
$defaults['title'] = __( 'Bottom offset', 'super-duper' ); |
1096
|
|
|
$defaults['icon'] = 'box-bottom'; |
1097
|
|
|
$defaults['row'] = array( |
1098
|
|
|
'key' => 'sticky-offset', |
1099
|
|
|
'close' => true, |
1100
|
|
|
); |
1101
|
|
|
} |
1102
|
|
|
|
1103
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1104
|
|
|
|
1105
|
|
|
return $input; |
1106
|
|
|
} |
1107
|
|
|
|
1108
|
|
|
/** |
1109
|
|
|
* A helper function for font size |
1110
|
|
|
* |
1111
|
|
|
* @param string $type |
1112
|
|
|
* @param array $overwrite |
1113
|
|
|
* |
1114
|
|
|
* @return array |
1115
|
|
|
*/ |
1116
|
|
|
function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) { |
|
|
|
|
1117
|
|
|
|
1118
|
|
|
$options = array( |
1119
|
|
|
'' => __( 'Inherit from parent', 'super-duper' ), |
1120
|
|
|
'h6' => 'h6', |
1121
|
|
|
'h5' => 'h5', |
1122
|
|
|
'h4' => 'h4', |
1123
|
|
|
'h3' => 'h3', |
1124
|
|
|
'h2' => 'h2', |
1125
|
|
|
'h1' => 'h1', |
1126
|
|
|
'display-1' => 'display-1', |
1127
|
|
|
'display-2' => 'display-2', |
1128
|
|
|
'display-3' => 'display-3', |
1129
|
|
|
'display-4' => 'display-4', |
1130
|
|
|
); |
1131
|
|
|
|
1132
|
|
|
if ( $has_custom ) { |
1133
|
|
|
$options['custom'] = __( 'Custom size', 'super-duper' ); |
1134
|
|
|
} |
1135
|
|
|
|
1136
|
|
|
$defaults = array( |
1137
|
|
|
'type' => 'select', |
1138
|
|
|
'title' => __( 'Font size', 'super-duper' ), |
1139
|
|
|
'options' => $options, |
1140
|
|
|
'default' => '', |
1141
|
|
|
'desc_tip' => true, |
1142
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1143
|
|
|
); |
1144
|
|
|
|
1145
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1146
|
|
|
|
1147
|
|
|
return $input; |
1148
|
|
|
} |
1149
|
|
|
|
1150
|
|
|
/** |
1151
|
|
|
* A helper function for custom font size. |
1152
|
|
|
* |
1153
|
|
|
* @param string $type |
1154
|
|
|
* @param array $overwrite |
1155
|
|
|
* |
1156
|
|
|
* @return array |
1157
|
|
|
*/ |
1158
|
|
|
function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) { |
|
|
|
|
1159
|
|
|
|
1160
|
|
|
$defaults = array( |
1161
|
|
|
'type' => 'number', |
1162
|
|
|
'title' => __( 'Font size (rem)', 'super-duper' ), |
1163
|
|
|
'default' => '', |
1164
|
|
|
'placeholder' => '1.25', |
1165
|
|
|
'custom_attributes' => array( |
1166
|
|
|
'step' => '0.1', |
1167
|
|
|
'min' => '0', |
1168
|
|
|
'max' => '100', |
1169
|
|
|
), |
1170
|
|
|
'desc_tip' => true, |
1171
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1172
|
|
|
); |
1173
|
|
|
|
1174
|
|
|
if ( $parent_type ) { |
1175
|
|
|
$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"'; |
1176
|
|
|
} |
1177
|
|
|
|
1178
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1179
|
|
|
|
1180
|
|
|
return $input; |
1181
|
|
|
} |
1182
|
|
|
|
1183
|
|
|
/** |
1184
|
|
|
* A helper function for custom font size. |
1185
|
|
|
* |
1186
|
|
|
* @param string $type |
1187
|
|
|
* @param array $overwrite |
1188
|
|
|
* |
1189
|
|
|
* @return array |
1190
|
|
|
*/ |
1191
|
|
|
function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) { |
|
|
|
|
1192
|
|
|
|
1193
|
|
|
$defaults = array( |
1194
|
|
|
'type' => 'number', |
1195
|
|
|
'title' => __( 'Font Line Height', 'super-duper' ), |
1196
|
|
|
'default' => '', |
1197
|
|
|
'placeholder' => '1.75', |
1198
|
|
|
'custom_attributes' => array( |
1199
|
|
|
'step' => '0.1', |
1200
|
|
|
'min' => '0', |
1201
|
|
|
'max' => '100', |
1202
|
|
|
), |
1203
|
|
|
'desc_tip' => true, |
1204
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1205
|
|
|
); |
1206
|
|
|
|
1207
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1208
|
|
|
|
1209
|
|
|
return $input; |
1210
|
|
|
} |
1211
|
|
|
|
1212
|
|
|
/** |
1213
|
|
|
* A helper function for font size inputs. |
1214
|
|
|
* |
1215
|
|
|
* @param string $type |
1216
|
|
|
* @param array $overwrite |
1217
|
|
|
* |
1218
|
|
|
* @return array |
1219
|
|
|
*/ |
1220
|
|
|
function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) { |
1221
|
|
|
|
1222
|
|
|
$inputs = array(); |
1223
|
|
|
|
1224
|
|
|
if ( $overwrite !== false ) { |
|
|
|
|
1225
|
|
|
$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true ); |
1226
|
|
|
} |
1227
|
|
|
|
1228
|
|
|
if ( $overwrite_custom !== false ) { |
1229
|
|
|
$custom = $type . '_custom'; |
1230
|
|
|
$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type ); |
1231
|
|
|
} |
1232
|
|
|
|
1233
|
|
|
return $inputs; |
1234
|
|
|
} |
1235
|
|
|
|
1236
|
|
|
/** |
1237
|
|
|
* A helper function for font weight. |
1238
|
|
|
* |
1239
|
|
|
* @param string $type |
1240
|
|
|
* @param array $overwrite |
1241
|
|
|
* |
1242
|
|
|
* @return array |
1243
|
|
|
*/ |
1244
|
|
|
function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) { |
|
|
|
|
1245
|
|
|
|
1246
|
|
|
$options = array( |
1247
|
|
|
'' => __( 'Inherit', 'super-duper' ), |
1248
|
|
|
'font-weight-bold' => 'bold', |
1249
|
|
|
'font-weight-bolder' => 'bolder', |
1250
|
|
|
'font-weight-normal' => 'normal', |
1251
|
|
|
'font-weight-light' => 'light', |
1252
|
|
|
'font-weight-lighter' => 'lighter', |
1253
|
|
|
'font-italic' => 'italic', |
1254
|
|
|
'font-weight-bold font-italic' => 'bold italic', |
1255
|
|
|
'font-weight-bolder font-italic' => 'bolder italic', |
1256
|
|
|
'font-weight-normal font-italic' => 'normal italic', |
1257
|
|
|
'font-weight-light font-italic' => 'light italic', |
1258
|
|
|
'font-weight-lighter font-italic' => 'lighter italic', |
1259
|
|
|
); |
1260
|
|
|
|
1261
|
|
|
$defaults = array( |
1262
|
|
|
'type' => 'select', |
1263
|
|
|
'title' => __( 'Appearance', 'super-duper' ), |
1264
|
|
|
'options' => $options, |
1265
|
|
|
'default' => '', |
1266
|
|
|
'desc_tip' => true, |
1267
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1268
|
|
|
); |
1269
|
|
|
|
1270
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1271
|
|
|
|
1272
|
|
|
return $input; |
1273
|
|
|
} |
1274
|
|
|
|
1275
|
|
|
/** |
1276
|
|
|
* A helper function for font case class. |
1277
|
|
|
* |
1278
|
|
|
* @param $type |
1279
|
|
|
* @param $overwrite |
1280
|
|
|
* |
1281
|
|
|
* @return array |
1282
|
|
|
*/ |
1283
|
|
|
function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) { |
|
|
|
|
1284
|
|
|
|
1285
|
|
|
$options = array( |
1286
|
|
|
'' => __( 'Default', 'super-duper' ), |
1287
|
|
|
'text-lowercase' => __( 'lowercase', 'super-duper' ), |
1288
|
|
|
'text-uppercase' => __( 'UPPERCASE', 'super-duper' ), |
1289
|
|
|
'text-capitalize' => __( 'Capitalize', 'super-duper' ), |
1290
|
|
|
); |
1291
|
|
|
|
1292
|
|
|
$defaults = array( |
1293
|
|
|
'type' => 'select', |
1294
|
|
|
'title' => __( 'Letter case', 'super-duper' ), |
1295
|
|
|
'options' => $options, |
1296
|
|
|
'default' => '', |
1297
|
|
|
'desc_tip' => true, |
1298
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1299
|
|
|
); |
1300
|
|
|
|
1301
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1302
|
|
|
|
1303
|
|
|
return $input; |
1304
|
|
|
} |
1305
|
|
|
|
1306
|
|
|
/** |
1307
|
|
|
* @param string $type |
1308
|
|
|
* @param array $overwrite |
1309
|
|
|
* |
1310
|
|
|
* @return array |
1311
|
|
|
* @todo remove this as now included above. |
1312
|
|
|
* A helper function for font size |
1313
|
|
|
* |
1314
|
|
|
*/ |
1315
|
|
|
function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) { |
|
|
|
|
1316
|
|
|
|
1317
|
|
|
$options = array( |
1318
|
|
|
'' => __( 'No', 'super-duper' ), |
1319
|
|
|
'font-italic' => __( 'Yes', 'super-duper' ), |
1320
|
|
|
); |
1321
|
|
|
|
1322
|
|
|
$defaults = array( |
1323
|
|
|
'type' => 'select', |
1324
|
|
|
'title' => __( 'Font italic', 'super-duper' ), |
1325
|
|
|
'options' => $options, |
1326
|
|
|
'default' => '', |
1327
|
|
|
'desc_tip' => true, |
1328
|
|
|
'group' => __( 'Typography', 'super-duper' ), |
1329
|
|
|
); |
1330
|
|
|
|
1331
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1332
|
|
|
|
1333
|
|
|
return $input; |
1334
|
|
|
} |
1335
|
|
|
|
1336
|
|
|
/** |
1337
|
|
|
* A helper function for the anchor input. |
1338
|
|
|
* |
1339
|
|
|
* @param $type |
1340
|
|
|
* @param $overwrite |
1341
|
|
|
* |
1342
|
|
|
* @return array |
1343
|
|
|
*/ |
1344
|
|
|
function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) { |
|
|
|
|
1345
|
|
|
|
1346
|
|
|
$defaults = array( |
1347
|
|
|
'type' => 'text', |
1348
|
|
|
'title' => __( 'HTML anchor', 'super-duper' ), |
1349
|
|
|
'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.' ), |
1350
|
|
|
'default' => '', |
1351
|
|
|
'desc_tip' => true, |
1352
|
|
|
'group' => __( 'Advanced', 'super-duper' ), |
1353
|
|
|
); |
1354
|
|
|
|
1355
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1356
|
|
|
|
1357
|
|
|
return $input; |
1358
|
|
|
} |
1359
|
|
|
|
1360
|
|
|
/** |
1361
|
|
|
* A helper function for the class input. |
1362
|
|
|
* |
1363
|
|
|
* @param $type |
1364
|
|
|
* @param $overwrite |
1365
|
|
|
* |
1366
|
|
|
* @return array |
1367
|
|
|
*/ |
1368
|
|
|
function sd_get_class_input( $type = 'css_class', $overwrite = array() ) { |
|
|
|
|
1369
|
|
|
|
1370
|
|
|
$defaults = array( |
1371
|
|
|
'type' => 'text', |
1372
|
|
|
'title' => __( 'Additional CSS class(es)', 'super-duper' ), |
1373
|
|
|
'desc' => __( 'Separate multiple classes with spaces.', 'super-duper' ), |
1374
|
|
|
'default' => '', |
1375
|
|
|
'desc_tip' => true, |
1376
|
|
|
'group' => __( 'Advanced', 'super-duper' ), |
1377
|
|
|
); |
1378
|
|
|
|
1379
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1380
|
|
|
|
1381
|
|
|
return $input; |
1382
|
|
|
} |
1383
|
|
|
|
1384
|
|
|
/** |
1385
|
|
|
* A helper function for font size inputs. |
1386
|
|
|
* |
1387
|
|
|
* @param string $type |
1388
|
|
|
* @param array $overwrite |
1389
|
|
|
* |
1390
|
|
|
* @return array |
1391
|
|
|
*/ |
1392
|
|
|
function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) { |
|
|
|
|
1393
|
|
|
|
1394
|
|
|
$options = array( |
1395
|
|
|
'hover-zoom' => __( 'Zoom', 'super-duper' ), |
1396
|
|
|
'hover-shadow' => __( 'Shadow', 'super-duper' ), |
1397
|
|
|
'hover-move-up' => __( 'Move up', 'super-duper' ), |
1398
|
|
|
'hover-move-down' => __( 'Move down', 'super-duper' ), |
1399
|
|
|
'hover-move-left' => __( 'Move left', 'super-duper' ), |
1400
|
|
|
'hover-move-right' => __( 'Move right', 'super-duper' ), |
1401
|
|
|
); |
1402
|
|
|
|
1403
|
|
|
$defaults = array( |
1404
|
|
|
'type' => 'select', |
1405
|
|
|
'multiple' => true, |
1406
|
|
|
'title' => __( 'Hover Animations', 'super-duper' ), |
1407
|
|
|
'options' => $options, |
1408
|
|
|
'default' => '', |
1409
|
|
|
'desc_tip' => true, |
1410
|
|
|
'group' => __( 'Hover Animations', 'super-duper' ), |
1411
|
|
|
); |
1412
|
|
|
|
1413
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1414
|
|
|
|
1415
|
|
|
return $input; |
1416
|
|
|
} |
1417
|
|
|
|
1418
|
|
|
|
1419
|
|
|
function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) { |
|
|
|
|
1420
|
|
|
$device_size = ''; |
1421
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
1422
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
1423
|
|
|
$device_size = '-md'; |
1424
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
1425
|
|
|
$device_size = '-lg'; |
1426
|
|
|
} |
1427
|
|
|
} |
1428
|
|
|
$options = array( |
1429
|
|
|
'' => __( 'Default', 'super-duper' ), |
1430
|
|
|
'align-items' . $device_size . '-start' => 'align-items-start', |
1431
|
|
|
'align-items' . $device_size . '-end' => 'align-items-end', |
1432
|
|
|
'align-items' . $device_size . '-center' => 'align-items-center', |
1433
|
|
|
'align-items' . $device_size . '-baseline' => 'align-items-baseline', |
1434
|
|
|
'align-items' . $device_size . '-stretch' => 'align-items-stretch', |
1435
|
|
|
); |
1436
|
|
|
|
1437
|
|
|
$defaults = array( |
1438
|
|
|
'type' => 'select', |
1439
|
|
|
'title' => __( 'Vertical Align Items', 'super-duper' ), |
1440
|
|
|
'options' => $options, |
1441
|
|
|
'default' => '', |
1442
|
|
|
'desc_tip' => true, |
1443
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1444
|
|
|
'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ', |
1445
|
|
|
|
1446
|
|
|
); |
1447
|
|
|
|
1448
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1449
|
|
|
|
1450
|
|
|
return $input; |
1451
|
|
|
} |
1452
|
|
|
|
1453
|
|
|
function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) { |
1454
|
|
|
$inputs = array(); |
1455
|
|
|
$sizes = array( |
1456
|
|
|
'' => 'Mobile', |
1457
|
|
|
'_md' => 'Tablet', |
1458
|
|
|
'_lg' => 'Desktop', |
1459
|
|
|
); |
1460
|
|
|
|
1461
|
|
|
if ( $overwrite !== false ) { |
1462
|
|
|
|
1463
|
|
|
foreach ( $sizes as $ds => $dt ) { |
1464
|
|
|
$overwrite['device_type'] = $dt; |
1465
|
|
|
$inputs[ $type . $ds ] = sd_get_flex_align_items_input( $type, $overwrite ); |
1466
|
|
|
} |
1467
|
|
|
} |
1468
|
|
|
|
1469
|
|
|
return $inputs; |
1470
|
|
|
} |
1471
|
|
|
|
1472
|
|
|
function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) { |
|
|
|
|
1473
|
|
|
$device_size = ''; |
1474
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
1475
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
1476
|
|
|
$device_size = '-md'; |
1477
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
1478
|
|
|
$device_size = '-lg'; |
1479
|
|
|
} |
1480
|
|
|
} |
1481
|
|
|
$options = array( |
1482
|
|
|
'' => __( 'Default', 'super-duper' ), |
1483
|
|
|
'justify-content' . $device_size . '-start' => 'justify-content-start', |
1484
|
|
|
'justify-content' . $device_size . '-end' => 'justify-content-end', |
1485
|
|
|
'justify-content' . $device_size . '-center' => 'justify-content-center', |
1486
|
|
|
'justify-content' . $device_size . '-between' => 'justify-content-between', |
1487
|
|
|
'justify-content' . $device_size . '-stretch' => 'justify-content-around', |
1488
|
|
|
); |
1489
|
|
|
|
1490
|
|
|
$defaults = array( |
1491
|
|
|
'type' => 'select', |
1492
|
|
|
'title' => __( 'Justify content' ), |
1493
|
|
|
'options' => $options, |
1494
|
|
|
'default' => '', |
1495
|
|
|
'desc_tip' => true, |
1496
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1497
|
|
|
'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ', |
1498
|
|
|
|
1499
|
|
|
); |
1500
|
|
|
|
1501
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1502
|
|
|
|
1503
|
|
|
return $input; |
1504
|
|
|
} |
1505
|
|
|
|
1506
|
|
|
function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) { |
1507
|
|
|
$inputs = array(); |
1508
|
|
|
$sizes = array( |
1509
|
|
|
'' => 'Mobile', |
1510
|
|
|
'_md' => 'Tablet', |
1511
|
|
|
'_lg' => 'Desktop', |
1512
|
|
|
); |
1513
|
|
|
|
1514
|
|
|
if ( $overwrite !== false ) { |
1515
|
|
|
|
1516
|
|
|
foreach ( $sizes as $ds => $dt ) { |
1517
|
|
|
$overwrite['device_type'] = $dt; |
1518
|
|
|
$inputs[ $type . $ds ] = sd_get_flex_justify_content_input( $type, $overwrite ); |
1519
|
|
|
} |
1520
|
|
|
} |
1521
|
|
|
|
1522
|
|
|
return $inputs; |
1523
|
|
|
} |
1524
|
|
|
|
1525
|
|
|
|
1526
|
|
|
function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) { |
|
|
|
|
1527
|
|
|
$device_size = ''; |
1528
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
1529
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
1530
|
|
|
$device_size = '-md'; |
1531
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
1532
|
|
|
$device_size = '-lg'; |
1533
|
|
|
} |
1534
|
|
|
} |
1535
|
|
|
$options = array( |
1536
|
|
|
'' => __( 'Default', 'super-duper' ), |
1537
|
|
|
'align-items' . $device_size . '-start' => 'align-items-start', |
1538
|
|
|
'align-items' . $device_size . '-end' => 'align-items-end', |
1539
|
|
|
'align-items' . $device_size . '-center' => 'align-items-center', |
1540
|
|
|
'align-items' . $device_size . '-baseline' => 'align-items-baseline', |
1541
|
|
|
'align-items' . $device_size . '-stretch' => 'align-items-stretch', |
1542
|
|
|
); |
1543
|
|
|
|
1544
|
|
|
$defaults = array( |
1545
|
|
|
'type' => 'select', |
1546
|
|
|
'title' => __( 'Align Self', 'super-duper' ), |
1547
|
|
|
'options' => $options, |
1548
|
|
|
'default' => '', |
1549
|
|
|
'desc_tip' => true, |
1550
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1551
|
|
|
'element_require' => ' [%container%]=="col" ', |
1552
|
|
|
|
1553
|
|
|
); |
1554
|
|
|
|
1555
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1556
|
|
|
|
1557
|
|
|
return $input; |
1558
|
|
|
} |
1559
|
|
|
|
1560
|
|
|
function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) { |
1561
|
|
|
$inputs = array(); |
1562
|
|
|
$sizes = array( |
1563
|
|
|
'' => 'Mobile', |
1564
|
|
|
'_md' => 'Tablet', |
1565
|
|
|
'_lg' => 'Desktop', |
1566
|
|
|
); |
1567
|
|
|
|
1568
|
|
|
if ( $overwrite !== false ) { |
1569
|
|
|
|
1570
|
|
|
foreach ( $sizes as $ds => $dt ) { |
1571
|
|
|
$overwrite['device_type'] = $dt; |
1572
|
|
|
$inputs[ $type . $ds ] = sd_get_flex_align_self_input( $type, $overwrite ); |
1573
|
|
|
} |
1574
|
|
|
} |
1575
|
|
|
|
1576
|
|
|
return $inputs; |
1577
|
|
|
} |
1578
|
|
|
|
1579
|
|
|
function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) { |
|
|
|
|
1580
|
|
|
$device_size = ''; |
1581
|
|
|
if ( ! empty( $overwrite['device_type'] ) ) { |
1582
|
|
|
if ( $overwrite['device_type'] == 'Tablet' ) { |
1583
|
|
|
$device_size = '-md'; |
1584
|
|
|
} elseif ( $overwrite['device_type'] == 'Desktop' ) { |
1585
|
|
|
$device_size = '-lg'; |
1586
|
|
|
} |
1587
|
|
|
} |
1588
|
|
|
$options = array( |
1589
|
|
|
'' => __( 'Default', 'super-duper' ), |
1590
|
|
|
); |
1591
|
|
|
|
1592
|
|
|
$i = 0; |
1593
|
|
|
while ( $i <= 12 ) { |
1594
|
|
|
$options[ 'order' . $device_size . '-' . $i ] = $i; |
1595
|
|
|
$i++; |
1596
|
|
|
} |
1597
|
|
|
|
1598
|
|
|
$defaults = array( |
1599
|
|
|
'type' => 'select', |
1600
|
|
|
'title' => __( 'Flex Order', 'super-duper' ), |
1601
|
|
|
'options' => $options, |
1602
|
|
|
'default' => '', |
1603
|
|
|
'desc_tip' => true, |
1604
|
|
|
'group' => __( 'Wrapper Styles', 'super-duper' ), |
1605
|
|
|
'element_require' => ' [%container%]=="col" ', |
1606
|
|
|
|
1607
|
|
|
); |
1608
|
|
|
|
1609
|
|
|
$input = wp_parse_args( $overwrite, $defaults ); |
1610
|
|
|
|
1611
|
|
|
return $input; |
1612
|
|
|
} |
1613
|
|
|
|
1614
|
|
|
function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) { |
1615
|
|
|
$inputs = array(); |
1616
|
|
|
$sizes = array( |
1617
|
|
|
'' => 'Mobile', |
1618
|
|
|
'_md' => 'Tablet', |
1619
|
|
|
'_lg' => 'Desktop', |
1620
|
|
|
); |
1621
|
|
|
|
1622
|
|
|
if ( $overwrite !== false ) { |
1623
|
|
|
|
1624
|
|
|
foreach ( $sizes as $ds => $dt ) { |
1625
|
|
|
$overwrite['device_type'] = $dt; |
1626
|
|
|
$inputs[ $type . $ds ] = sd_get_flex_order_input( $type, $overwrite ); |
1627
|
|
|
} |
1628
|
|
|
} |
1629
|
|
|
|
1630
|
|
|
return $inputs; |
1631
|
|
|
} |
1632
|
|
|
|
1633
|
|
|
/** |
1634
|
|
|
* Build AUI classes from settings. |
1635
|
|
|
* |
1636
|
|
|
* @param $args |
1637
|
|
|
* |
1638
|
|
|
* @return string |
1639
|
|
|
* @todo find best way to use px- py- or general p- |
1640
|
|
|
*/ |
1641
|
|
|
function sd_build_aui_class( $args ) { |
1642
|
|
|
|
1643
|
|
|
$classes = array(); |
1644
|
|
|
|
1645
|
|
|
// margins. |
1646
|
|
|
if ( isset( $args['mt'] ) && $args['mt'] !== '' ) { |
1647
|
|
|
$classes[] = 'mt-' . sanitize_html_class( $args['mt'] ); |
1648
|
|
|
$mt = $args['mt']; |
1649
|
|
|
} else { |
1650
|
|
|
$mt = null; |
1651
|
|
|
} |
1652
|
|
|
if ( isset( $args['mr'] ) && $args['mr'] !== '' ) { |
1653
|
|
|
$classes[] = 'mr-' . sanitize_html_class( $args['mr'] ); |
1654
|
|
|
$mr = $args['mr']; |
1655
|
|
|
} else { |
1656
|
|
|
$mr = null; |
1657
|
|
|
} |
1658
|
|
|
if ( isset( $args['mb'] ) && $args['mb'] !== '' ) { |
1659
|
|
|
$classes[] = 'mb-' . sanitize_html_class( $args['mb'] ); |
1660
|
|
|
$mb = $args['mb']; |
1661
|
|
|
} else { |
1662
|
|
|
$mb = null; |
1663
|
|
|
} |
1664
|
|
|
if ( isset( $args['ml'] ) && $args['ml'] !== '' ) { |
1665
|
|
|
$classes[] = 'ml-' . sanitize_html_class( $args['ml'] ); |
1666
|
|
|
$ml = $args['ml']; |
1667
|
|
|
} else { |
1668
|
|
|
$ml = null; |
1669
|
|
|
} |
1670
|
|
|
|
1671
|
|
|
// margins tablet. |
1672
|
|
|
if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) { |
1673
|
|
|
$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] ); |
1674
|
|
|
$mt_md = $args['mt_md']; |
1675
|
|
|
} else { |
1676
|
|
|
$mt_md = null; |
1677
|
|
|
} |
1678
|
|
|
if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) { |
1679
|
|
|
$classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] ); |
1680
|
|
|
$mt_md = $args['mr_md']; |
1681
|
|
|
} else { |
1682
|
|
|
$mr_md = null; |
1683
|
|
|
} |
1684
|
|
|
if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) { |
1685
|
|
|
$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] ); |
1686
|
|
|
$mt_md = $args['mb_md']; |
1687
|
|
|
} else { |
1688
|
|
|
$mb_md = null; |
1689
|
|
|
} |
1690
|
|
|
if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) { |
1691
|
|
|
$classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] ); |
1692
|
|
|
$mt_md = $args['ml_md']; |
1693
|
|
|
} else { |
1694
|
|
|
$ml_md = null; |
1695
|
|
|
} |
1696
|
|
|
|
1697
|
|
|
// margins desktop. |
1698
|
|
|
if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) { |
1699
|
|
|
if ( $mt == null && $mt_md == null ) { |
1700
|
|
|
$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] ); |
1701
|
|
|
} else { |
1702
|
|
|
$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] ); |
1703
|
|
|
} |
1704
|
|
|
} |
1705
|
|
|
if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) { |
1706
|
|
|
if ( $mr == null && $mr_md == null ) { |
|
|
|
|
1707
|
|
|
$classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] ); |
1708
|
|
|
} else { |
1709
|
|
|
$classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] ); |
1710
|
|
|
} |
1711
|
|
|
} |
1712
|
|
|
if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) { |
1713
|
|
|
if ( $mb == null && $mb_md == null ) { |
|
|
|
|
1714
|
|
|
$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] ); |
1715
|
|
|
} else { |
1716
|
|
|
$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] ); |
1717
|
|
|
} |
1718
|
|
|
} |
1719
|
|
|
if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) { |
1720
|
|
|
if ( $ml == null && $ml_md == null ) { |
|
|
|
|
1721
|
|
|
$classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] ); |
1722
|
|
|
} else { |
1723
|
|
|
$classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] ); |
1724
|
|
|
} |
1725
|
|
|
} |
1726
|
|
|
|
1727
|
|
|
// padding. |
1728
|
|
|
if ( isset( $args['pt'] ) && $args['pt'] !== '' ) { |
1729
|
|
|
$classes[] = 'pt-' . sanitize_html_class( $args['pt'] ); |
1730
|
|
|
$pt = $args['pt']; |
1731
|
|
|
} else { |
1732
|
|
|
$pt = null; |
1733
|
|
|
} |
1734
|
|
|
if ( isset( $args['pr'] ) && $args['pr'] !== '' ) { |
1735
|
|
|
$classes[] = 'pr-' . sanitize_html_class( $args['pr'] ); |
1736
|
|
|
$pr = $args['pr']; |
1737
|
|
|
} else { |
1738
|
|
|
$pr = null; |
1739
|
|
|
} |
1740
|
|
|
if ( isset( $args['pb'] ) && $args['pb'] !== '' ) { |
1741
|
|
|
$classes[] = 'pb-' . sanitize_html_class( $args['pb'] ); |
1742
|
|
|
$pb = $args['pb']; |
1743
|
|
|
} else { |
1744
|
|
|
$pb = null; |
1745
|
|
|
} |
1746
|
|
|
if ( isset( $args['pl'] ) && $args['pl'] !== '' ) { |
1747
|
|
|
$classes[] = 'pl-' . sanitize_html_class( $args['pl'] ); |
1748
|
|
|
$pl = $args['pl']; |
1749
|
|
|
} else { |
1750
|
|
|
$pl = null; |
1751
|
|
|
} |
1752
|
|
|
|
1753
|
|
|
// padding tablet. |
1754
|
|
|
if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) { |
1755
|
|
|
$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] ); |
1756
|
|
|
$pt_md = $args['pt_md']; |
1757
|
|
|
} else { |
1758
|
|
|
$pt_md = null; |
1759
|
|
|
} |
1760
|
|
|
if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) { |
1761
|
|
|
$classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] ); |
1762
|
|
|
$pt_md = $args['pr_md']; |
1763
|
|
|
} else { |
1764
|
|
|
$pr_md = null; |
1765
|
|
|
} |
1766
|
|
|
if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) { |
1767
|
|
|
$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] ); |
1768
|
|
|
$pt_md = $args['pb_md']; |
1769
|
|
|
} else { |
1770
|
|
|
$pb_md = null; |
1771
|
|
|
} |
1772
|
|
|
if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) { |
1773
|
|
|
$classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] ); |
1774
|
|
|
$pt_md = $args['pl_md']; |
1775
|
|
|
} else { |
1776
|
|
|
$pl_md = null; |
1777
|
|
|
} |
1778
|
|
|
|
1779
|
|
|
// padding desktop. |
1780
|
|
|
if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) { |
1781
|
|
|
if ( $pt == null && $pt_md == null ) { |
1782
|
|
|
$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] ); |
1783
|
|
|
} else { |
1784
|
|
|
$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] ); |
1785
|
|
|
} |
1786
|
|
|
} |
1787
|
|
|
if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) { |
1788
|
|
|
if ( $pr == null && $pr_md == null ) { |
|
|
|
|
1789
|
|
|
$classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] ); |
1790
|
|
|
} else { |
1791
|
|
|
$classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] ); |
1792
|
|
|
} |
1793
|
|
|
} |
1794
|
|
|
if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) { |
1795
|
|
|
if ( $pb == null && $pb_md == null ) { |
|
|
|
|
1796
|
|
|
$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] ); |
1797
|
|
|
} else { |
1798
|
|
|
$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] ); |
1799
|
|
|
} |
1800
|
|
|
} |
1801
|
|
|
if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) { |
1802
|
|
|
if ( $pl == null && $pl_md == null ) { |
|
|
|
|
1803
|
|
|
$classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] ); |
1804
|
|
|
} else { |
1805
|
|
|
$classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] ); |
1806
|
|
|
} |
1807
|
|
|
} |
1808
|
|
|
|
1809
|
|
|
// row cols, mobile, tablet, desktop |
1810
|
|
|
if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) { |
1811
|
|
|
$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] ); |
1812
|
|
|
$row_cols = $args['row_cols']; |
1813
|
|
|
} else { |
1814
|
|
|
$row_cols = null; |
1815
|
|
|
} |
1816
|
|
|
if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) { |
1817
|
|
|
$classes[] = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] ); |
1818
|
|
|
$row_cols_md = $args['row_cols_md']; |
1819
|
|
|
} else { |
1820
|
|
|
$row_cols_md = null; |
1821
|
|
|
} |
1822
|
|
|
if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) { |
1823
|
|
|
if ( $row_cols == null && $row_cols_md == null ) { |
1824
|
|
|
$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] ); |
1825
|
|
|
} else { |
1826
|
|
|
$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] ); |
1827
|
|
|
} |
1828
|
|
|
} |
1829
|
|
|
|
1830
|
|
|
// columns , mobile, tablet, desktop |
1831
|
|
|
if ( ! empty( $args['col'] ) && $args['col'] !== '' ) { |
1832
|
|
|
$classes[] = sanitize_html_class( 'col-' . $args['col'] ); |
1833
|
|
|
$col = $args['col']; |
1834
|
|
|
} else { |
1835
|
|
|
$col = null; |
1836
|
|
|
} |
1837
|
|
|
if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) { |
1838
|
|
|
$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] ); |
1839
|
|
|
$col_md = $args['col_md']; |
1840
|
|
|
} else { |
1841
|
|
|
$col_md = null; |
1842
|
|
|
} |
1843
|
|
|
if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) { |
1844
|
|
|
if ( $col == null && $col_md == null ) { |
1845
|
|
|
$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] ); |
1846
|
|
|
} else { |
1847
|
|
|
$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] ); |
1848
|
|
|
} |
1849
|
|
|
} |
1850
|
|
|
|
1851
|
|
|
// border |
1852
|
|
|
if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) { |
1853
|
|
|
$classes[] = 'border-0'; |
1854
|
|
|
} elseif ( ! empty( $args['border'] ) ) { |
1855
|
|
|
$classes[] = 'border border-' . sanitize_html_class( $args['border'] ); |
1856
|
|
|
} |
1857
|
|
|
|
1858
|
|
|
// border radius type |
1859
|
|
|
if ( ! empty( $args['rounded'] ) ) { |
1860
|
|
|
$classes[] = sanitize_html_class( $args['rounded'] ); |
1861
|
|
|
} |
1862
|
|
|
|
1863
|
|
|
// border radius size |
1864
|
|
|
if ( ! empty( $args['rounded_size'] ) ) { |
1865
|
|
|
$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] ); |
1866
|
|
|
// if we set a size then we need to remove "rounded" if set |
1867
|
|
|
if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) { |
1868
|
|
|
unset( $classes[ $key ] ); |
1869
|
|
|
} |
1870
|
|
|
} |
1871
|
|
|
|
1872
|
|
|
// shadow |
1873
|
|
|
//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); } |
1874
|
|
|
|
1875
|
|
|
// background |
1876
|
|
|
if ( ! empty( $args['bg'] ) ) { |
1877
|
|
|
$classes[] = 'bg-' . sanitize_html_class( $args['bg'] ); |
1878
|
|
|
} |
1879
|
|
|
|
1880
|
|
|
// text_color |
1881
|
|
|
if ( ! empty( $args['text_color'] ) ) { |
1882
|
|
|
$classes[] = 'text-' . sanitize_html_class( $args['text_color'] ); |
1883
|
|
|
} |
1884
|
|
|
|
1885
|
|
|
// text_align |
1886
|
|
|
if ( ! empty( $args['text_justify'] ) ) { |
1887
|
|
|
$classes[] = 'text-justify'; |
1888
|
|
|
} else { |
1889
|
|
|
if ( ! empty( $args['text_align'] ) ) { |
1890
|
|
|
$classes[] = sanitize_html_class( $args['text_align'] ); |
1891
|
|
|
$text_align = $args['text_align']; |
1892
|
|
|
} else { |
1893
|
|
|
$text_align = null; |
1894
|
|
|
} |
1895
|
|
|
if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) { |
1896
|
|
|
$classes[] = sanitize_html_class( $args['text_align_md'] ); |
1897
|
|
|
$text_align_md = $args['text_align_md']; |
1898
|
|
|
} else { |
1899
|
|
|
$text_align_md = null; |
1900
|
|
|
} |
1901
|
|
|
if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) { |
1902
|
|
|
if ( $text_align == null && $text_align_md == null ) { |
1903
|
|
|
$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) ); |
1904
|
|
|
} else { |
1905
|
|
|
$classes[] = sanitize_html_class( $args['text_align_lg'] ); |
1906
|
|
|
} |
1907
|
|
|
} |
1908
|
|
|
} |
1909
|
|
|
|
1910
|
|
|
// display |
1911
|
|
|
if ( ! empty( $args['display'] ) ) { |
1912
|
|
|
$classes[] = sanitize_html_class( $args['display'] ); |
1913
|
|
|
$display = $args['display']; |
1914
|
|
|
} else { |
1915
|
|
|
$display = null; |
1916
|
|
|
} |
1917
|
|
|
if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) { |
1918
|
|
|
$classes[] = sanitize_html_class( $args['display_md'] ); |
1919
|
|
|
$display_md = $args['display_md']; |
1920
|
|
|
} else { |
1921
|
|
|
$display_md = null; |
1922
|
|
|
} |
1923
|
|
|
if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) { |
1924
|
|
|
if ( $display == null && $display_md == null ) { |
1925
|
|
|
$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) ); |
1926
|
|
|
} else { |
1927
|
|
|
$classes[] = sanitize_html_class( $args['display_lg'] ); |
1928
|
|
|
} |
1929
|
|
|
} |
1930
|
|
|
|
1931
|
|
|
// bgtus - background transparent until scroll |
1932
|
|
|
if ( ! empty( $args['bgtus'] ) ) { |
1933
|
|
|
$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' ); |
1934
|
|
|
} |
1935
|
|
|
|
1936
|
|
|
// hover animations |
1937
|
|
|
if ( ! empty( $args['hover_animations'] ) ) { |
1938
|
|
|
$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) ); |
1939
|
|
|
} |
1940
|
|
|
|
1941
|
|
|
// build classes from build keys |
1942
|
|
|
$build_keys = sd_get_class_build_keys(); |
|
|
|
|
1943
|
|
|
if ( ! empty( $build_keys ) ) { |
1944
|
|
|
foreach ( $build_keys as $key ) { |
|
|
|
|
1945
|
|
|
|
1946
|
|
|
if ( substr( $key, -4 ) == '-MTD' ) { |
1947
|
|
|
|
1948
|
|
|
$k = str_replace( '_MTD', '', $key ); |
1949
|
|
|
|
1950
|
|
|
// Mobile, Tablet, Desktop |
1951
|
|
|
if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) { |
1952
|
|
|
$classes[] = sanitize_html_class( $args[ $k ] ); |
1953
|
|
|
$v = $args[ $k ]; |
1954
|
|
|
} else { |
1955
|
|
|
$v = null; |
1956
|
|
|
} |
1957
|
|
|
if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) { |
1958
|
|
|
$classes[] = sanitize_html_class( $args[ $k . '_md' ] ); |
1959
|
|
|
$v_md = $args[ $k . '_md' ]; |
1960
|
|
|
} else { |
1961
|
|
|
$v_md = null; |
1962
|
|
|
} |
1963
|
|
|
if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) { |
1964
|
|
|
if ( $v == null && $v_md == null ) { |
1965
|
|
|
$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) ); |
1966
|
|
|
} else { |
1967
|
|
|
$classes[] = sanitize_html_class( $args[ $k . '_lg' ] ); |
1968
|
|
|
} |
1969
|
|
|
} |
1970
|
|
|
} else { |
1971
|
|
|
if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) { |
1972
|
|
|
continue; |
1973
|
|
|
} |
1974
|
|
|
if ( ! empty( $args[ $key ] ) ) { |
1975
|
|
|
$classes[] = sd_sanitize_html_classes( $args[ $key ] ); |
1976
|
|
|
} |
1977
|
|
|
} |
1978
|
|
|
} |
1979
|
|
|
} |
1980
|
|
|
|
1981
|
|
|
return implode( ' ', $classes ); |
1982
|
|
|
} |
1983
|
|
|
|
1984
|
|
|
/** |
1985
|
|
|
* Build Style output from arguments. |
1986
|
|
|
* |
1987
|
|
|
* @param $args |
1988
|
|
|
* |
1989
|
|
|
* @return array |
1990
|
|
|
*/ |
1991
|
|
|
function sd_build_aui_styles( $args ) { |
1992
|
|
|
|
1993
|
|
|
$styles = array(); |
1994
|
|
|
|
1995
|
|
|
// background color |
1996
|
|
|
if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) { |
1997
|
|
|
if ( $args['bg'] == 'custom-color' ) { |
1998
|
|
|
$styles['background-color'] = $args['bg_color']; |
1999
|
|
|
} elseif ( $args['bg'] == 'custom-gradient' ) { |
2000
|
|
|
$styles['background-image'] = $args['bg_gradient']; |
2001
|
|
|
|
2002
|
|
|
// use background on text. |
2003
|
|
|
if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) { |
2004
|
|
|
$styles['background-clip'] = 'text'; |
2005
|
|
|
$styles['-webkit-background-clip'] = 'text'; |
2006
|
|
|
$styles['text-fill-color'] = 'transparent'; |
2007
|
|
|
$styles['-webkit-text-fill-color'] = 'transparent'; |
2008
|
|
|
} |
2009
|
|
|
} |
2010
|
|
|
} |
2011
|
|
|
|
2012
|
|
|
if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) { |
2013
|
|
|
$hasImage = true; |
2014
|
|
|
if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) { |
2015
|
|
|
$styles['background-image'] = 'url(' . $args['bg_image'] . ')'; |
2016
|
|
|
$styles['background-blend-mode'] = 'overlay'; |
2017
|
|
|
} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) { |
2018
|
|
|
$styles['background-image'] .= ',url(' . $args['bg_image'] . ')'; |
2019
|
|
|
} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) { |
2020
|
|
|
// do nothing as we alreay have a preset |
2021
|
|
|
$hasImage = false; |
2022
|
|
|
} else { |
2023
|
|
|
$styles['background-image'] = 'url(' . $args['bg_image'] . ')'; |
2024
|
|
|
} |
2025
|
|
|
|
2026
|
|
|
if ( $hasImage ) { |
2027
|
|
|
$styles['background-size'] = 'cover'; |
2028
|
|
|
|
2029
|
|
|
if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) { |
2030
|
|
|
$styles['background-attachment'] = 'fixed'; |
2031
|
|
|
} |
2032
|
|
|
} |
2033
|
|
|
|
2034
|
|
|
if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) { |
2035
|
|
|
$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%'; |
2036
|
|
|
} |
2037
|
|
|
} |
2038
|
|
|
|
2039
|
|
|
// sticky offset top |
2040
|
|
|
if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) { |
2041
|
|
|
$styles['top'] = absint( $args['sticky_offset_top'] ); |
2042
|
|
|
} |
2043
|
|
|
|
2044
|
|
|
// sticky offset bottom |
2045
|
|
|
if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) { |
2046
|
|
|
$styles['bottom'] = absint( $args['sticky_offset_bottom'] ); |
2047
|
|
|
} |
2048
|
|
|
|
2049
|
|
|
// font size |
2050
|
|
|
if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) { |
2051
|
|
|
$styles['font-size'] = (float) $args['font_size_custom'] . 'rem'; |
2052
|
|
|
} |
2053
|
|
|
|
2054
|
|
|
// font color |
2055
|
|
|
if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) { |
2056
|
|
|
$styles['color'] = esc_attr( $args['text_color_custom'] ); |
2057
|
|
|
} |
2058
|
|
|
|
2059
|
|
|
// font line height |
2060
|
|
|
if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) { |
2061
|
|
|
$styles['line-height'] = esc_attr( $args['font_line_height'] ); |
2062
|
|
|
} |
2063
|
|
|
|
2064
|
|
|
$style_string = ''; |
2065
|
|
|
if ( ! empty( $styles ) ) { |
2066
|
|
|
foreach ( $styles as $key => $val ) { |
2067
|
|
|
$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';'; |
2068
|
|
|
} |
2069
|
|
|
} |
2070
|
|
|
|
2071
|
|
|
return $style_string; |
|
|
|
|
2072
|
|
|
|
2073
|
|
|
} |
2074
|
|
|
|
2075
|
|
|
/** |
2076
|
|
|
* Sanitize single or multiple HTML classes. |
2077
|
|
|
* |
2078
|
|
|
* @param $classes |
2079
|
|
|
* @param $sep |
2080
|
|
|
* |
2081
|
|
|
* @return string |
2082
|
|
|
*/ |
2083
|
|
|
function sd_sanitize_html_classes( $classes, $sep = ' ' ) { |
2084
|
|
|
$return = ''; |
2085
|
|
|
|
2086
|
|
|
if ( ! is_array( $classes ) ) { |
2087
|
|
|
$classes = explode( $sep, $classes ); |
2088
|
|
|
} |
2089
|
|
|
|
2090
|
|
|
if ( ! empty( $classes ) ) { |
2091
|
|
|
foreach ( $classes as $class ) { |
2092
|
|
|
$return .= sanitize_html_class( $class ) . ' '; |
2093
|
|
|
} |
2094
|
|
|
} |
2095
|
|
|
|
2096
|
|
|
return $return; |
2097
|
|
|
} |
2098
|
|
|
|
2099
|
|
|
|
2100
|
|
|
/** |
2101
|
|
|
* Keys that are used for the class builder. |
2102
|
|
|
* |
2103
|
|
|
* @return void |
2104
|
|
|
*/ |
2105
|
|
|
function sd_get_class_build_keys() { |
2106
|
|
|
$keys = array( |
2107
|
|
|
'container', |
2108
|
|
|
'position', |
2109
|
|
|
'flex_direction', |
2110
|
|
|
'shadow', |
2111
|
|
|
'rounded', |
2112
|
|
|
'nav_style', |
2113
|
|
|
'horizontal_alignment', |
2114
|
|
|
'nav_fill', |
2115
|
|
|
'width', |
2116
|
|
|
'font_weight', |
2117
|
|
|
'font_size', |
2118
|
|
|
'font_case', |
2119
|
|
|
'css_class', |
2120
|
|
|
'flex_align_items-MTD', |
2121
|
|
|
'flex_justify_content-MTD', |
2122
|
|
|
'flex_align_self-MTD', |
2123
|
|
|
'flex_order-MTD', |
2124
|
|
|
); |
2125
|
|
|
|
2126
|
|
|
return apply_filters( 'sd_class_build_keys', $keys ); |
|
|
|
|
2127
|
|
|
} |
2128
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.