PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / General / CountDown / Controls.php

Controls.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at app/Elementor/Widgets/General/CountDown/Controls.php

554 lines 19.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Controls class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\General\CountDown;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Settings class.
20 *
21 * @package RadiusTheme\SB
22 */
23 class Controls {
24 /**
25 * Content section
26 *
27 * @param object $obj Reference object.
28 *
29 * @return array
30 */
31 public static function content( $obj ) {
32 return array_merge(
33 self::preset( $obj ),
34 self::countdown_settings( $obj ),
35 self::countdown_content_settings( $obj ),
36 );
37 }
38
39 /**
40 * Style section
41 *
42 * @param object $obj Reference object.
43 *
44 * @return array
45 */
46 public static function style( $obj ) {
47 return array_merge(
48 self::content_box_style( $obj ),
49 self::digits_style( $obj ),
50 self::labels_style( $obj ),
51 self::countdown_circle_style( $obj ),
52 );
53 }
54
55 /**
56 * Preset section
57 *
58 * @param object $obj Reference object.
59 *
60 * @return array
61 */
62 private static function preset( $obj ) {
63 $fields['countdown_preset'] = $obj->start_section(
64 esc_html__( 'Layout', 'shopbuilder' ),
65 'content'
66 );
67 $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
68 $fields['layout_style'] = [
69 'type' => 'rtsb-image-selector',
70 'options' => ControlHelper::general_widgets_countdown_layouts(),
71 'default' => 'rtsb-countdown-layout1',
72 ];
73 $fields['countdown_preset_end'] = $obj->end_section();
74 return $fields;
75 }
76
77
78 /**
79 * Countdown section
80 *
81 * @param object $obj Reference object.
82 *
83 * @return array
84 */
85 private static function countdown_settings( $obj ) {
86 $fields['countdown_settings_sec_start'] = $obj->start_section(
87 esc_html__( 'Timer Settings', 'shopbuilder' ),
88 'content',
89 [],
90 );
91 $fields['countdown_date_time'] = [
92 'label' => esc_html__( 'Countdown Date Time', 'shopbuilder' ),
93 'description' => esc_html__( 'Please enter the countdown date time.', 'shopbuilder' ),
94 'type' => 'date_time',
95 ];
96 $fields['countdown_settings_sec_end'] = $obj->end_section();
97
98 return $fields;
99 }
100
101 /**
102 * Content Settings
103 *
104 * @param object $obj Reference object.
105 *
106 * @return array
107 */
108 private static function countdown_content_settings( $obj ) {
109 $fields['countdown_content_settings_sec_start'] = $obj->start_section(
110 esc_html__( 'Content Settings', 'shopbuilder' ),
111 'content',
112 [],
113 );
114 $fields['display_days'] = [
115 'label' => esc_html__( 'Display Days', 'shopbuilder' ),
116 'description' => esc_html__( 'Switch on to show countdown days.', 'shopbuilder' ),
117 'label_on' => esc_html__( 'On', 'shopbuilder' ),
118 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
119 'type' => 'switch',
120 'default' => 'yes',
121 ];
122 $fields['countdown_days_label'] = [
123 'label' => esc_html__( 'Label Days', 'shopbuilder' ),
124 'type' => 'text',
125 'default' => esc_html__( 'Days', 'shopbuilder' ),
126 'label_block' => true,
127 'condition' => [
128 'display_days' => 'yes',
129 ],
130 ];
131 $fields['display_hours'] = [
132 'label' => esc_html__( 'Display Hours', 'shopbuilder' ),
133 'description' => esc_html__( 'Switch on to show countdown hours.', 'shopbuilder' ),
134 'label_on' => esc_html__( 'On', 'shopbuilder' ),
135 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
136 'type' => 'switch',
137 'default' => 'yes',
138 'separator' => 'before',
139 ];
140 $fields['countdown_hours_label'] = [
141 'label' => esc_html__( 'Label Hours', 'shopbuilder' ),
142 'type' => 'text',
143 'default' => esc_html__( 'Hours', 'shopbuilder' ),
144 'label_block' => true,
145 'condition' => [
146 'display_hours' => 'yes',
147 ],
148 ];
149 $fields['display_minutes'] = [
150 'label' => esc_html__( 'Display Minutes', 'shopbuilder' ),
151 'description' => esc_html__( 'Switch on to show countdown minutes.', 'shopbuilder' ),
152 'label_on' => esc_html__( 'On', 'shopbuilder' ),
153 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
154 'type' => 'switch',
155 'default' => 'yes',
156 'separator' => 'before',
157 ];
158 $fields['countdown_minutes_label'] = [
159 'label' => esc_html__( 'Label Minutes', 'shopbuilder' ),
160 'type' => 'text',
161 'default' => esc_html__( 'Minutes', 'shopbuilder' ),
162 'label_block' => true,
163 'condition' => [
164 'display_minutes' => 'yes',
165 ],
166 ];
167 $fields['display_seconds'] = [
168 'label' => esc_html__( 'Display Seconds', 'shopbuilder' ),
169 'description' => esc_html__( 'Switch on to show countdown seconds.', 'shopbuilder' ),
170 'label_on' => esc_html__( 'On', 'shopbuilder' ),
171 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
172 'type' => 'switch',
173 'default' => 'yes',
174 'separator' => 'before',
175 ];
176 $fields['countdown_seconds_label'] = [
177 'label' => esc_html__( 'Label Seconds', 'shopbuilder' ),
178 'type' => 'text',
179 'default' => esc_html__( 'Seconds', 'shopbuilder' ),
180 'label_block' => true,
181 'condition' => [
182 'display_seconds' => 'yes',
183 ],
184 ];
185 $fields['countdown_content_settings_sec_end'] = $obj->end_section();
186
187 return $fields;
188 }
189 /**
190 * Countdown Circle Settings
191 *
192 * @param object $obj Reference object.
193 *
194 * @return array
195 */
196 private static function countdown_circle_style( $obj ) {
197 $condition = [
198 'layout_style' => [ 'rtsb-countdown-layout5' ],
199 ];
200 $fields['countdown_circle_style_section'] = $obj->start_section(
201 esc_html__( 'Circle Style', 'shopbuilder' ),
202 'style',
203 [],
204 $condition
205 );
206 $fields['countdown_circle_gap'] = [
207 'type' => 'slider',
208 'mode' => 'responsive',
209 'label' => esc_html__( 'Circle Gap', 'shopbuilder' ),
210 'size_units' => [ 'px' ],
211 'range' => [
212 'px' => [
213 'min' => 0,
214 'max' => 100,
215 ],
216 ],
217 'selectors' => [ $obj->selectors['countdown_circle']['gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
218 ];
219 $fields['countdown_circle_stroke'] = [
220 'type' => 'slider',
221 'mode' => 'responsive',
222 'label' => esc_html__( 'Circle Stroke', 'shopbuilder' ),
223 'size_units' => [ 'px' ],
224 'range' => [
225 'px' => [
226 'min' => 10,
227 'max' => 100,
228 ],
229 ],
230 'default' => [
231 'unit' => 'px',
232 'size' => 10,
233 ],
234 'render_type' => 'template',
235 'selectors' => [ $obj->selectors['countdown_circle']['stroke'] => 'stroke-width: {{SIZE}};' ],
236 ];
237 $fields['down_track_color'] = [
238 'type' => 'color',
239 'label' => esc_html__( 'Down Track Color', 'shopbuilder' ),
240 'selectors' => [ $obj->selectors['countdown_circle']['down_track_color'] => 'stroke: {{VALUE}};' ],
241 ];
242 $fields['up_track_color'] = [
243 'type' => 'color',
244 'label' => esc_html__( 'Up Track Color', 'shopbuilder' ),
245 'selectors' => [ $obj->selectors['countdown_circle']['up_track_color'] => 'stroke: {{VALUE}};' ],
246 ];
247
248 $fields['countdown_circle_style_section_end'] = $obj->end_section();
249
250 return $fields;
251 }
252
253
254 /**
255 * Content Box style section
256 *
257 * @param object $obj Reference object.
258 *
259 * @return array
260 */
261 private static function content_box_style( $obj ) {
262 $css_selectors = $obj->selectors['content_box_style'];
263 $title = esc_html__( 'Content Box Style', 'shopbuilder' );
264 $condition = [
265 'layout_style!' => [ 'rtsb-countdown-layout5','rtsb-countdown-layout6' ],
266 ];
267 $selectors = [
268
269 'box_shadow' => $css_selectors['box_shadow'],
270 'gradient_bg' => $css_selectors['gradient_bg'],
271 'bg_overlay' => $css_selectors['bg_overlay'],
272 'border' => $css_selectors['border'],
273 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
274 'countdown_gap' => [ $css_selectors['countdown_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
275 'circle_width' => [ $css_selectors['circle_width'] => 'width: {{SIZE}}{{UNIT}};' ],
276 'circle_height' => [ $css_selectors['circle_height'] => 'height: {{SIZE}}{{UNIT}};' ],
277 ];
278
279 $fields = ControlHelper::general_elementor_style( 'countdown_content_box_style', $title, $obj, $condition, $selectors );
280
281 unset(
282 $fields['countdown_content_box_style_color'],
283 $fields['countdown_content_box_style_bg_color'],
284 $fields['countdown_content_box_style_padding'],
285 $fields['countdown_content_box_style_alignment'],
286 $fields['countdown_content_box_style_typo_note'],
287 $fields['rtsb_el_countdown_content_box_style_typography'],
288 $fields['countdown_content_box_style_color_tabs'],
289 $fields['countdown_content_box_style_color_tab'],
290 $fields['countdown_content_box_style_color_tab_end'],
291 $fields['countdown_content_box_style_hover_color_tab'],
292 $fields['countdown_content_box_style_hover_color'],
293 $fields['countdown_content_box_style_hover_bg_color'],
294 $fields['countdown_content_box_style_hover_color_tab_end'],
295 $fields['countdown_content_box_style_color_tabs_end'],
296 $fields['countdown_content_box_style_border_hover_color'],
297 $fields['countdown_content_box_style_margin']
298 );
299 $fields['countdown_content_box_style_border_note']['separator'] = 'default';
300 $fields['countdown_content_box_style_color_note']['separator'] = 'default';
301 $extra_controls['countdown_content_box_style_border_radius'] = [
302 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
303 'type' => 'dimensions',
304 'mode' => 'responsive',
305 'size_units' => [ 'px' ],
306 'selectors' => $selectors['border_radius'],
307 ];
308 $fields = Fns::insert_controls( 'countdown_content_box_style_spacing_note', $fields, $extra_controls );
309 $extra_controls2['countdown_content_box_style_gradient_bg'] = [
310 'label' => esc_html__( 'Background', 'shopbuilder' ),
311 'type' => 'background',
312 'mode' => 'group',
313 'selector' => $selectors['gradient_bg'],
314 ];
315 $extra_controls2['countdown_content_box_style_bg_overlay'] = [
316 'label' => esc_html__( 'Background Overlay', 'shopbuilder' ),
317 'type' => 'background',
318 'mode' => 'group',
319 'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
320 'selector' => $selectors['bg_overlay'],
321 'fields_options' => [
322 'background' => [
323 'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ),
324 ],
325 ],
326 ];
327 $extra_controls2['countdown_content_box_style_box_shadow'] = [
328 'type' => 'box-shadow',
329 'mode' => 'group',
330 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
331 'selector' => $selectors['box_shadow'],
332 ];
333 $fields = Fns::insert_controls( 'countdown_content_box_style_color_note', $fields, $extra_controls2, true );
334 $extra_controls3['countdown_gap'] = [
335 'type' => 'slider',
336 'mode' => 'responsive',
337 'label' => esc_html__( 'Gap', 'shopbuilder' ),
338 'size_units' => [ 'px' ],
339 'range' => [
340 'px' => [
341 'min' => 0,
342 'max' => 200,
343 ],
344 ],
345 'selectors' => $selectors['countdown_gap'],
346 ];
347 $extra_controls3['countdown_circle_width'] = [
348 'type' => 'slider',
349 'mode' => 'responsive',
350 'label' => esc_html__( 'Width', 'shopbuilder' ),
351 'size_units' => [ 'px' ],
352 'range' => [
353 'px' => [
354 'min' => 40,
355 'max' => 600,
356 ],
357 ],
358 'selectors' => $selectors['circle_width'],
359 ];
360 $extra_controls3['countdown_circle_height'] = [
361 'type' => 'slider',
362 'mode' => 'responsive',
363 'label' => esc_html__( 'Height', 'shopbuilder' ),
364 'size_units' => [ 'px' ],
365 'range' => [
366 'px' => [
367 'min' => 40,
368 'max' => 600,
369 ],
370 ],
371 'selectors' => $selectors['circle_height'],
372 ];
373 $fields = Fns::insert_controls( 'countdown_content_box_style_spacing_note', $fields, $extra_controls3, true );
374 return $fields;
375 }
376 /**
377 * Digits style section
378 *
379 * @param object $obj Reference object.
380 *
381 * @return array
382 */
383 private static function digits_style( $obj ) {
384 $css_selectors = $obj->selectors['digits_style'];
385 $title = esc_html__( 'Digits Style', 'shopbuilder' );
386 $selectors = [
387 'typography' => $css_selectors['typography'],
388 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
389 'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ],
390 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
391 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
392 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
393 'digits_gap' => [ $css_selectors['digits_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
394 'digits_wrapper_gap' => [ $css_selectors['digits_wrapper_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
395 'digits_width' => [ $css_selectors['digits_width'] => 'width: {{SIZE}}{{UNIT}};' ],
396 'digits_height' => [ $css_selectors['digits_height'] => 'height: {{SIZE}}{{UNIT}};' ],
397 ];
398
399 $fields = ControlHelper::general_elementor_style( 'countdown_digits_style', $title, $obj, [], $selectors );
400
401 unset(
402 $fields['countdown_digits_style_alignment'],
403 $fields['rtsb_el_countdown_digits_style_border'],
404 $fields['countdown_digits_style_color_tabs'],
405 $fields['countdown_digits_style_color_tab'],
406 $fields['countdown_digits_style_color_tab_end'],
407 $fields['countdown_digits_style_hover_color_tab'],
408 $fields['countdown_digits_style_hover_color'],
409 $fields['countdown_digits_style_hover_bg_color'],
410 $fields['countdown_digits_style_hover_color_tab_end'],
411 $fields['countdown_digits_style_color_tabs_end'],
412 $fields['countdown_digits_style_border_hover_color']
413 );
414 $fields['countdown_digits_style_bg_color']['condition'] = [
415 'layout_style' => [ 'rtsb-countdown-layout6' ],
416 ];
417 $fields['countdown_digits_style_padding']['condition'] = [
418 'layout_style' => [ 'rtsb-countdown-layout6' ],
419 ];
420 $fields['countdown_digits_style_border_note']['condition'] = [
421 'layout_style' => [ 'rtsb-countdown-layout6' ],
422 ];
423 $extra_controls['countdown_digits_border_radius'] = [
424 'mode' => 'responsive',
425 'type' => 'dimensions',
426 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
427 'size_units' => [ 'px' ],
428 'selectors' => $selectors['border_radius'],
429 'condition' => [
430 'layout_style' => [ 'rtsb-countdown-layout6' ],
431 ],
432 ];
433 $fields = Fns::insert_controls( 'countdown_digits_style_border_note', $fields, $extra_controls, true );
434 $extra_controls3['digits_gap'] = [
435 'type' => 'slider',
436 'mode' => 'responsive',
437 'label' => esc_html__( 'Gap', 'shopbuilder' ),
438 'size_units' => [ 'px' ],
439 'range' => [
440 'px' => [
441 'min' => 0,
442 'max' => 200,
443 ],
444 ],
445 'selectors' => $selectors['digits_gap'],
446 'condition' => [
447 'layout_style' => [ 'rtsb-countdown-layout6' ],
448 ],
449 ];
450 $extra_controls3['digits_wrapper_gap'] = [
451 'type' => 'slider',
452 'mode' => 'responsive',
453 'label' => esc_html__( 'Wrapper Gap', 'shopbuilder' ),
454 'size_units' => [ 'px' ],
455 'range' => [
456 'px' => [
457 'min' => 0,
458 'max' => 200,
459 ],
460 ],
461 'selectors' => $selectors['digits_wrapper_gap'],
462 'condition' => [
463 'layout_style' => [ 'rtsb-countdown-layout6' ],
464 ],
465 ];
466 $extra_controls3['countdown_digits_width'] = [
467 'type' => 'slider',
468 'mode' => 'responsive',
469 'label' => esc_html__( 'Width', 'shopbuilder' ),
470 'size_units' => [ 'px' ],
471 'range' => [
472 'px' => [
473 'min' => 40,
474 'max' => 600,
475 ],
476 ],
477 'selectors' => $selectors['digits_width'],
478 'condition' => [
479 'layout_style' => [ 'rtsb-countdown-layout6' ],
480 ],
481 ];
482 $extra_controls3['countdown_digits_height'] = [
483 'type' => 'slider',
484 'mode' => 'responsive',
485 'label' => esc_html__( 'Height', 'shopbuilder' ),
486 'size_units' => [ 'px' ],
487 'range' => [
488 'px' => [
489 'min' => 40,
490 'max' => 600,
491 ],
492 ],
493 'selectors' => $selectors['digits_height'],
494 'condition' => [
495 'layout_style' => [ 'rtsb-countdown-layout6' ],
496 ],
497 ];
498 $fields = Fns::insert_controls( 'countdown_digits_style_spacing_note', $fields, $extra_controls3, true );
499 return $fields;
500 }
501 /**
502 * Label style section
503 *
504 * @param object $obj Reference object.
505 *
506 * @return array
507 */
508 private static function labels_style( $obj ) {
509 $css_selectors = $obj->selectors['labels_style'];
510 $title = esc_html__( 'Labels Style', 'shopbuilder' );
511 $selectors = [
512 'typography' => $css_selectors['typography'],
513 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
514 'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ],
515 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
516 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
517 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
518 ];
519
520 $fields = ControlHelper::general_elementor_style( 'countdown_labels_style', $title, $obj, [], $selectors );
521 $fields['countdown_labels_style_bg_color']['condition'] = [
522 'layout_style' => [ 'rtsb-countdown-layout3' ],
523 ];
524 $fields['countdown_labels_style_border_note']['condition'] = [
525 'layout_style' => [ 'rtsb-countdown-layout3' ],
526 ];
527 unset(
528 $fields['countdown_labels_style_alignment'],
529 $fields['rtsb_el_countdown_labels_style_border'],
530 $fields['countdown_labels_style_color_tabs'],
531 $fields['countdown_labels_style_color_tab'],
532 $fields['countdown_labels_style_color_tab_end'],
533 $fields['countdown_labels_style_hover_color_tab'],
534 $fields['countdown_labels_style_hover_color'],
535 $fields['countdown_labels_style_hover_bg_color'],
536 $fields['countdown_labels_style_hover_color_tab_end'],
537 $fields['countdown_labels_style_color_tabs_end'],
538 $fields['countdown_labels_style_border_hover_color']
539 );
540 $extra_controls['countdown_text_border_radius'] = [
541 'mode' => 'responsive',
542 'type' => 'dimensions',
543 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
544 'size_units' => [ 'px' ],
545 'selectors' => $selectors['border_radius'],
546 'condition' => [
547 'layout_style' => [ 'rtsb-countdown-layout3' ],
548 ],
549 ];
550 $fields = Fns::insert_controls( 'countdown_labels_style_border_note', $fields, $extra_controls, true );
551 return $fields;
552 }
553 }
554