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 / ProgressBar / Controls.php

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

423 lines 14.6 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\ProgressBar;
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::progress_bar_settings( $obj ),
35 );
36 }
37
38 /**
39 * Style section
40 *
41 * @param object $obj Reference object.
42 *
43 * @return array
44 */
45 public static function style( $obj ) {
46 return array_merge(
47 self::progress_bar_style( $obj ),
48 self::labels_style( $obj ),
49 self::count_number_style( $obj ),
50 );
51 }
52
53 /**
54 * Preset section
55 *
56 * @param object $obj Reference object.
57 *
58 * @return array
59 */
60 private static function preset( $obj ) {
61 $fields['progress_bar_preset'] = $obj->start_section(
62 esc_html__( 'Layout', 'shopbuilder' ),
63 'content'
64 );
65 $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
66 $fields['layout_style'] = [
67 'type' => 'rtsb-image-selector',
68 'options' => ControlHelper::general_widgets_progress_bar_layouts(),
69 'default' => 'rtsb-progress-bar-layout1',
70 ];
71 $fields['progress_bar_preset_end'] = $obj->end_section();
72 return $fields;
73 }
74
75
76 /**
77 * Countdown section
78 *
79 * @param object $obj Reference object.
80 *
81 * @return array
82 */
83 private static function progress_bar_settings( $obj ) {
84 $fields['progress_bar_settings_sec_start'] = $obj->start_section(
85 esc_html__( 'Progress Settings', 'shopbuilder' ),
86 'content',
87 [],
88 );
89 $fields['display_progress_count'] = [
90 'label' => esc_html__( 'Progress Count', 'shopbuilder' ),
91 'description' => esc_html__( 'Switch on to show progress count.', 'shopbuilder' ),
92 'label_on' => esc_html__( 'On', 'shopbuilder' ),
93 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
94 'type' => 'switch',
95 'default' => 'yes',
96 ];
97 $fields['display_progress_stripe'] = [
98 'label' => esc_html__( 'Progress Stripe', 'shopbuilder' ),
99 'description' => esc_html__( 'Switch on to show progress bar stripe.', 'shopbuilder' ),
100 'label_on' => esc_html__( 'On', 'shopbuilder' ),
101 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
102 'type' => 'switch',
103 'condition' => [
104 'layout_style' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4' ],
105 ],
106 ];
107 $fields['display_progress_label'] = [
108 'label' => esc_html__( 'Progress Label', 'shopbuilder' ),
109 'description' => esc_html__( 'Switch on to show progress label.', 'shopbuilder' ),
110 'label_on' => esc_html__( 'On', 'shopbuilder' ),
111 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
112 'type' => 'switch',
113 'default' => 'yes',
114 ];
115 $fields['progress_count'] = [
116 'label' => esc_html__( 'Progress Count Number', 'shopbuilder' ),
117 'description' => esc_html__( 'Please enter the count number.', 'shopbuilder' ),
118 'type' => 'number',
119 'min' => 0,
120 'max' => 100,
121 'default' => 80,
122 'condition' => [
123 'display_progress_count' => 'yes',
124 ],
125 ];
126 $fields['progress_label'] = [
127 'label' => esc_html__( 'Progress Label', 'shopbuilder' ),
128 'type' => 'text',
129 'default' => esc_html__( 'Progress Bar', 'shopbuilder' ),
130 'label_block' => true,
131 'condition' => [
132 'display_progress_label' => 'yes',
133 ],
134 ];
135 $fields['progress_size'] = [
136 'type' => 'slider',
137 'mode' => 'responsive',
138 'label' => esc_html__( 'Size', 'shopbuilder' ),
139 'size_units' => [ 'px' ],
140 'range' => [
141 'px' => [
142 'min' => 100,
143 'max' => 600,
144 ],
145 ],
146 'selectors' => [ $obj->selectors['progress_bar']['progress_size'] => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};' ],
147 'condition' => [
148 'layout_style!' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout3','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
149 ],
150 ];
151 $fields['half_circle_size'] = [
152 'type' => 'slider',
153 'mode' => 'responsive',
154 'label' => esc_html__( 'Size', 'shopbuilder' ),
155 'size_units' => [ 'px' ],
156 'range' => [
157 'px' => [
158 'min' => 100,
159 'max' => 600,
160 ],
161 ],
162 'selectors' => [
163 $obj->selectors['progress_bar']['half_circle_size']['full'] => 'width: {{SIZE}}{{UNIT}};height: calc({{SIZE}}{{UNIT}}/2)' ,
164 $obj->selectors['progress_bar']['half_circle_size']['half'] => 'width: {{SIZE}}{{UNIT}};height:{{SIZE}}{{UNIT}}' ,
165 ],
166 'condition' => [
167 'layout_style' => [ 'rtsb-progress-bar-layout3' ],
168 ],
169 ];
170 $fields['progress_stroke'] = [
171 'type' => 'slider',
172 'mode' => 'responsive',
173 'label' => esc_html__( 'Stroke', 'shopbuilder' ),
174 'size_units' => [ 'px' ],
175 'range' => [
176 'px' => [
177 'min' => 1,
178 'max' => 100,
179 ],
180 ],
181 'selectors' => [ $obj->selectors['progress_bar']['progress_stroke'] => 'border-width: {{SIZE}}{{UNIT}};' ],
182 'condition' => [
183 'layout_style!' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
184 ],
185 ];
186 $fields['progress_height'] = [
187 'type' => 'slider',
188 'mode' => 'responsive',
189 'label' => esc_html__( 'Progress Height', 'shopbuilder' ),
190 'size_units' => [ 'px' ],
191 'range' => [
192 'px' => [
193 'min' => 0,
194 'max' => 100,
195 ],
196 ],
197 'selectors' => [ $obj->selectors['progress_bar']['height'] => 'height: {{SIZE}}{{UNIT}};' ],
198 'condition' => [
199 'layout_style' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
200 ],
201 ];
202 $fields['progress_left_position'] = [
203 'type' => 'slider',
204 'mode' => 'responsive',
205 'label' => esc_html__( 'Progress Position', 'shopbuilder' ),
206 'size_units' => [ 'px' ],
207 'range' => [
208 'px' => [
209 'min' => 0,
210 'max' => 100,
211 ],
212 ],
213 'selectors' => [ $obj->selectors['progress_bar']['left_position'] => 'left: {{SIZE}}{{UNIT}};' ],
214 'condition' => [
215 'layout_style' => [ 'rtsb-progress-bar-layout4' ],
216 ],
217 ];
218 $fields['progress_bar_transition'] = [
219 'label' => esc_html__( 'Animation Duration', 'shopbuilder' ),
220 'description' => esc_html__( 'This time calculate with milliseconds.', 'shopbuilder' ),
221 'type' => 'number',
222 'default' => '1500',
223 ];
224 $fields['progress_bar_settings_sec_end'] = $obj->end_section();
225
226 return $fields;
227 }
228 /**
229 * Content Box style section
230 *
231 * @param object $obj Reference object.
232 *
233 * @return array
234 */
235 private static function progress_bar_style( $obj ) {
236 $fields['progress_bar_style_section'] = $obj->start_section(
237 esc_html__( 'Progress Bar Style', 'shopbuilder' ),
238 'style',
239 [],
240 );
241 $fields['bg_color'] = [
242 'type' => 'background',
243 'mode' => 'group',
244 'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
245 'label' => esc_html__( 'Background Color', 'shopbuilder' ),
246 'selector' => $obj->selectors['progress_bar_style']['bg_color'],
247 'condition' => [
248 'layout_style' => [ 'rtsb-progress-bar-layout2','rtsb-progress-bar-layout3' ],
249 ],
250 ];
251 $fields['fill_color'] = [
252 'type' => 'background',
253 'mode' => 'group',
254 'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
255 'label' => esc_html__( 'Fill Color', 'shopbuilder' ),
256 'selector' => $obj->selectors['progress_bar_style']['fill_color'] ,
257 'fields_options' => [
258 'background' => [
259 'label' => esc_html__( 'Fill Color', 'shopbuilder' ),
260 ],
261 ],
262 'condition' => [
263 'layout_style' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
264 ],
265 ];
266 $fields['fill_border_color'] = [
267 'type' => 'color',
268 'label' => esc_html__( 'Fill Color', 'shopbuilder' ),
269 'selectors' => [
270 $obj->selectors['progress_bar_style']['fill_border_color'] => 'border-color: {{VALUE}}',
271 ],
272 'condition' => [
273 'layout_style' => [ 'rtsb-progress-bar-layout2', 'rtsb-progress-bar-layout3' ],
274 ],
275 ];
276 $fields['stroke_color'] = [
277 'type' => 'background',
278 'mode' => 'group',
279 'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
280 'label' => esc_html__( 'Stroke Color', 'shopbuilder' ),
281 'selector' => $obj->selectors['progress_bar_style']['stroke_color'],
282 'fields_options' => [
283 'background' => [
284 'label' => esc_html__( 'Stroke Color', 'shopbuilder' ),
285 ],
286 ],
287 'condition' => [
288 'layout_style' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
289 ],
290 ];
291 $fields['stroke_fill_color'] = [
292 'type' => 'color',
293 'label' => esc_html__( 'Stroke Color', 'shopbuilder' ),
294 'selectors' => [
295 $obj->selectors['progress_bar_style']['stroke_fill_color'] => 'border-color: {{VALUE}}',
296 ],
297 'condition' => [
298 'layout_style' => [ 'rtsb-progress-bar-layout2', 'rtsb-progress-bar-layout3' ],
299 ],
300 ];
301 $fields['progress_bar_border_radius'] = [
302 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
303 'type' => 'dimensions',
304 'mode' => 'responsive',
305 'size_units' => [ 'px' ],
306 'selectors' => [
307 $obj->selectors['progress_bar_style']['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
308 ],
309 'condition' => [
310 'layout_style' => [ 'rtsb-progress-bar-layout1','rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
311 ],
312 ];
313 $fields['progress_bar_border_padding'] = [
314 'label' => esc_html__( 'Padding', 'shopbuilder' ),
315 'type' => 'dimensions',
316 'mode' => 'responsive',
317 'size_units' => [ 'px' ],
318 'allowed_dimensions' => [ 'top', 'bottom' ],
319 'selectors' => [
320 $obj->selectors['progress_bar_style']['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
321 ],
322 'condition' => [
323 'layout_style' => [ 'rtsb-progress-bar-layout4' ],
324 ],
325 ];
326 $fields['progress_bar_style_section_end'] = $obj->end_section();
327 return $fields;
328 }
329 /**
330 * Label style section
331 *
332 * @param object $obj Reference object.
333 *
334 * @return array
335 */
336 private static function labels_style( $obj ) {
337 $condition = [
338 'display_progress_label' => 'yes',
339 ];
340 $css_selectors = $obj->selectors['labels_style'];
341 $title = esc_html__( 'Labels Style', 'shopbuilder' );
342 $selectors = [
343 'typography' => $css_selectors['typography'],
344 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
345 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
346 ];
347
348 $fields = ControlHelper::general_elementor_style( 'progress_bar_labels_style', $title, $obj, $condition, $selectors );
349 unset(
350 $fields['progress_bar_labels_style_alignment'],
351 $fields['rtsb_el_progress_bar_labels_style_border'],
352 $fields['progress_bar_labels_style_color_tabs'],
353 $fields['progress_bar_labels_style_color_tab'],
354 $fields['progress_bar_labels_style_color_tab_end'],
355 $fields['progress_bar_labels_style_border_note'],
356 $fields['progress_bar_labels_style_hover_color_tab'],
357 $fields['progress_bar_labels_style_hover_color'],
358 $fields['progress_bar_labels_style_bg_color'],
359 $fields['progress_bar_labels_style_hover_bg_color'],
360 $fields['progress_bar_labels_style_hover_color_tab_end'],
361 $fields['progress_bar_labels_style_color_tabs_end'],
362 $fields['progress_bar_labels_style_border_hover_color'],
363 $fields['progress_bar_labels_style_padding']
364 );
365
366 return $fields;
367 }
368 /**
369 * Count style section
370 *
371 * @param object $obj Reference object.
372 *
373 * @return array
374 */
375 private static function count_number_style( $obj ) {
376 $condition = [
377 'display_progress_count' => 'yes',
378 ];
379 $css_selectors = $obj->selectors['count_number_style'];
380 $title = esc_html__( 'Count Number Style', 'shopbuilder' );
381 $selectors = [
382 'typography' => $css_selectors['typography'],
383 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
384 'progress_count_bg_color' => [
385 $css_selectors['progress_count_bg_color']['bg_color'] => 'background-color: {{VALUE}};',
386 $css_selectors['progress_count_bg_color']['border_color'] => 'border-top-color: {{VALUE}};',
387 ],
388 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
389 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
390 ];
391
392 $fields = ControlHelper::general_elementor_style( 'progress_bar_count_style', $title, $obj, $condition, $selectors );
393 unset(
394 $fields['progress_bar_count_style_alignment'],
395 $fields['rtsb_el_progress_bar_count_style_border'],
396 $fields['progress_bar_count_style_color_tabs'],
397 $fields['progress_bar_count_style_color_tab'],
398 $fields['progress_bar_count_style_color_tab_end'],
399 $fields['progress_bar_count_style_border_note'],
400 $fields['progress_bar_count_style_bg_color'],
401 $fields['progress_bar_count_style_hover_color_tab'],
402 $fields['progress_bar_count_style_hover_color'],
403 $fields['progress_bar_count_style_hover_bg_color'],
404 $fields['progress_bar_count_style_hover_color_tab_end'],
405 $fields['progress_bar_count_style_color_tabs_end'],
406 $fields['progress_bar_count_style_border_hover_color'],
407 );
408 $fields['progress_bar_count_style_padding']['condition'] = [
409 'layout_style' => [ 'rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
410 ];
411 $extra_fields['progress_count_bg_color'] = [
412 'type' => 'color',
413 'label' => esc_html__( 'Background', 'shopbuilder' ),
414 'selectors' => $selectors['progress_count_bg_color'],
415 'condition' => [
416 'layout_style' => [ 'rtsb-progress-bar-layout4','rtsb-progress-bar-layout5' ],
417 ],
418 ];
419 $fields = Fns::insert_controls( 'progress_bar_count_style_color', $fields, $extra_fields, true );
420 return $fields;
421 }
422 }
423