PluginProbe
Borderless – Addons and Templates for Elementor / 1.4.9
Borderless – Addons and Templates for Elementor v1.4.9
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / elementor / widgets / progress-bar.php

progress-bar.php in Borderless – Addons and Templates for Elementor 1.4.9, at modules/elementor/widgets/progress-bar.php

422 lines 11.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Borderless\Widgets;
4
5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
7 use \Elementor\Controls_Manager;
8 use \Elementor\Group_Control_Background;
9 use \Elementor\Group_Control_Box_Shadow;
10 use \Elementor\Group_Control_Typography;
11 use \Elementor\Core\Schemes\Typography;
12 use \Elementor\Widget_Base;
13
14 class Progress_Bar extends Widget_Base {
15
16 public function get_name() {
17 return 'borderless-elementor-progress-bar';
18 }
19
20 public function get_title() {
21 return esc_html__( 'Progress Bar', 'borderless');
22 }
23
24 public function get_icon() {
25 return 'borderless-icon-progress-bar';
26 }
27
28 public function get_categories() {
29 return [ 'borderless' ];
30 }
31
32 public function get_keywords()
33 {
34 return [
35 'progress bar',
36 'bar',
37 'borderless',
38 'borderless progress bar',
39 'borderless bar'
40 ];
41 }
42
43 public function get_custom_help_url()
44 {
45 return 'https://wpborderless.com/';
46 }
47
48 public function get_style_depends() {
49 return
50 [
51 'borderless-elementor-style'
52 ];
53 }
54
55 public function get_script_depends() {
56 return
57 [
58 'borderless-elementor-appear-script',
59 'borderless-elementor-progressbar-script'
60 ];
61 }
62
63 protected function _register_controls() {
64
65
66 /*-----------------------------------------------------------------------------------*/
67 /* *. Layout
68 /*-----------------------------------------------------------------------------------*/
69
70 $this->start_controls_section(
71 'borderless_elementor_section_progress_bar_layout',
72 [
73 'label' => esc_html__( 'Layout', 'borderless' ),
74 'tab' => Controls_Manager::TAB_CONTENT,
75 ]
76 );
77
78 $this->add_control(
79 'borderless_elementor_progress_bar_title',
80 [
81 'label' => esc_html__( 'Title', 'borderless'),
82 'type' => Controls_Manager::TEXT,
83 'dynamic' => [
84 'active' => true,
85 ],
86 ]
87 );
88
89 $this->add_control(
90 'borderless_elementor_progress_bar_counter_value',
91 [
92 'label' => esc_html__( 'Counter Value', 'borderless'),
93 'type' => Controls_Manager::SLIDER,
94 'size_units' => ['%'],
95 'range' => [
96 '%' => [
97 'min' => 1,
98 'max' => 100,
99 ],
100 ],
101 'default' => [
102 'unit' => '%',
103 'size' => 50,
104 ],
105 'separator' => 'before',
106 ]
107 );
108
109 $this->add_control(
110 'borderless_elementor_progress_bar_animation_duration',
111 [
112 'label' => __('Animation Duration', 'borderless'),
113 'type' => Controls_Manager::SLIDER,
114 'size_units' => ['px'],
115 'range' => [
116 'px' => [
117 'min' => 1000,
118 'max' => 10000,
119 'step' => 100,
120 ],
121 ],
122 'default' => [
123 'unit' => 'px',
124 'size' => 1500,
125 ],
126 'separator' => 'before',
127 ]
128 );
129
130 $this->end_controls_section();
131
132
133 /*-----------------------------------------------------------------------------------*/
134 /* *. Layout - Style
135 /*-----------------------------------------------------------------------------------*/
136
137 $this->start_controls_section(
138 'borderless_elementor_section_progress_bar_styles_general',
139 [
140 'label' => esc_html__( 'General', 'borderless'),
141 'tab' => Controls_Manager::TAB_STYLE
142 ]
143 );
144
145 $this->add_control(
146 'borderless_elementor_progress_bar_alignment',
147 [
148 'label' => __('Alignment', 'borderless'),
149 'type' => \Elementor\Controls_Manager::CHOOSE,
150 'options' => [
151 'borderless-elementor-progress-bar-alignment-left' => [
152 'title' => __('Left', 'borderless'),
153 'icon' => 'fa fa-align-left',
154 ],
155 'borderless-elementor-progress-bar-alignment-center' => [
156 'title' => __('Center', 'borderless'),
157 'icon' => 'fa fa-align-center',
158 ],
159 'borderless-elementor-progress-bar-alignment-right' => [
160 'title' => __('Right', 'borderless'),
161 'icon' => 'fa fa-align-right',
162 ],
163 ],
164 'default' => 'borderless-elementor-progress-bar-alignment-center',
165 ]
166 );
167
168 $this->add_control(
169 'borderless_elementor_progress_bar_size',
170 [
171 'label' => __('Size', 'borderless'),
172 'type' => Controls_Manager::SLIDER,
173 'size_units' => ['%'],
174 'range' => [
175 '%' => [
176 'min' => 1,
177 'max' => 100,
178 'step' => 1,
179 ],
180 ],
181 'default' => [
182 'unit' => '%',
183 'size' => 100,
184 ],
185 'selectors' => [
186 '{{WRAPPER}} .borderless-elementor-progress-bar' => 'width: {{SIZE}}{{UNIT}};',
187 ],
188 'separator' => 'before',
189 ]
190 );
191
192 $this->add_control(
193 'borderless_elementor_progress_bar_stroke_width',
194 [
195 'label' => __('Stroke Width', 'borderless'),
196 'type' => Controls_Manager::SLIDER,
197 'size_units' => ['px'],
198 'range' => [
199 'px' => [
200 'min' => 0,
201 'max' => 100,
202 'step' => 1,
203 ],
204 ],
205 'default' => [
206 'unit' => 'px',
207 'size' => 2,
208 ],
209 'separator' => 'before',
210 ]
211 );
212
213 $this->add_control(
214 'borderless_elementor_progress_bar_stroke_color_style',
215 [
216 'label' => __( 'Stroke Color Style', 'borderless' ),
217 'type' => \Elementor\Controls_Manager::SELECT,
218 'default' => 'borderless-elementor-progress-bar-stroke-solid-color',
219 'options' => [
220 'borderless-elementor-progress-bar-stroke-solid-color' => __( 'Solid', 'borderless' ),
221 'borderless-elementor-progress-bar-stroke-gradient-color' => __( 'Gradient', 'borderless' ),
222 ],
223 ]
224 );
225
226 $this->add_control(
227 'borderless_elementor_progress_bar_stroke_color',
228 [
229 'label' => __('Stroke Color', 'borderless'),
230 'type' => Controls_Manager::COLOR,
231 'default' => '#000',
232 'condition' => [
233 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-solid-color',
234 ],
235 ]
236 );
237
238 $this->add_control(
239 'borderless_elementor_progress_bar_stroke_color_from',
240 [
241 'label' => __('Stroke Color From', 'borderless'),
242 'type' => Controls_Manager::COLOR,
243 'default' => '#000',
244 'condition' => [
245 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
246 ],
247 ]
248 );
249
250 $this->add_control(
251 'borderless_elementor_progress_bar_stroke_color_to',
252 [
253 'label' => __('Stroke Color To', 'borderless'),
254 'type' => Controls_Manager::COLOR,
255 'default' => '#000',
256 'condition' => [
257 'borderless_elementor_progress_bar_stroke_color_style' => 'borderless-elementor-progress-bar-stroke-gradient-color',
258 ],
259 ]
260 );
261
262 $this->add_control(
263 'borderless_elementor_progress_bar_trail_width',
264 [
265 'label' => __('Trail Width', 'borderless'),
266 'type' => Controls_Manager::SLIDER,
267 'size_units' => ['px'],
268 'range' => [
269 'px' => [
270 'min' => 0,
271 'max' => 100,
272 'step' => 1,
273 ],
274 ],
275 'default' => [
276 'unit' => 'px',
277 'size' => 2,
278 ],
279 'separator' => 'before',
280 ]
281 );
282
283 $this->add_control(
284 'borderless_elementor_progress_bar_trail_color',
285 [
286 'label' => __('Trail Color', 'borderless'),
287 'type' => Controls_Manager::COLOR,
288 'default' => '#eee',
289 ]
290 );
291
292 $this->add_control(
293 'borderless_elementor_progress_bar_background_color',
294 [
295 'label' => __('Background Color', 'borderless'),
296 'type' => Controls_Manager::COLOR,
297 'default' => '#fff',
298 'selectors' => [
299 '{{WRAPPER}} .borderless-elementor-progress-bar' => 'background-color: {{VALUE}}',
300 ],
301 'separator' => 'before',
302 ]
303 );
304
305 $this->add_group_control(
306 Group_Control_Box_Shadow::get_type(),
307 [
308 'name' => 'borderless_elementor_progress_bar_box_shadow',
309 'label' => __('Box Shadow', 'borderless'),
310 'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar',
311 'separator' => 'before',
312 ]
313 );
314
315 $this->end_controls_section();
316
317 /*-----------------------------------------------------------------------------------*/
318 /* *. Typography - Style
319 /*-----------------------------------------------------------------------------------*/
320
321 $this->start_controls_section(
322 'borderless_section_circular_progress_bar_typography',
323 [
324 'label' => __('Typography', 'borderless'),
325 'tab' => Controls_Manager::TAB_STYLE,
326 ]
327 );
328
329 $this->add_group_control(
330 Group_Control_Typography::get_type(),
331 [
332 'name' => 'borderless_elementor_progress_bar_title_typography',
333 'label' => __('Title', 'borderless'),
334 'scheme' => Typography::TYPOGRAPHY_1,
335 'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title',
336 ]
337 );
338
339 $this->add_control(
340 'borderless_elementor_progress_bar_title_color',
341 [
342 'label' => __('Title Color', 'borderless'),
343 'type' => Controls_Manager::COLOR,
344 'default' => '',
345 'selectors' => [
346 '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-title' => 'color: {{VALUE}}',
347 ],
348 'separator' => 'after',
349 ]
350 );
351
352 $this->add_group_control(
353 Group_Control_Typography::get_type(),
354 [
355 'name' => 'borderless_elementor_progress_bar_counter_typography',
356 'label' => __('Counter', 'borderless'),
357 'scheme' => Typography::TYPOGRAPHY_1,
358 'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-value',
359 ]
360 );
361
362 $this->add_control(
363 'borderless_elementor_progress_bar_counter_color',
364 [
365 'label' => __('Counter Color', 'borderless'),
366 'type' => Controls_Manager::COLOR,
367 'default' => '',
368 'separator' => 'after',
369 ]
370 );
371
372 $this->add_group_control(
373 Group_Control_Typography::get_type(),
374 [
375 'name' => 'borderless_elementor_progress_bar_postfix_typography',
376 'label' => __('Postfix', 'borderless'),
377 'scheme' => Typography::TYPOGRAPHY_1,
378 'selector' => '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix',
379 ]
380 );
381
382 $this->add_control(
383 'borderless_elementor_progress_bar_postfix_color',
384 [
385 'label' => __('Postfix Color', 'borderless'),
386 'type' => Controls_Manager::COLOR,
387 'default' => '',
388 'selectors' => [
389 '{{WRAPPER}} .borderless-elementor-progress-bar .progressbar-text div .borderless-elementor-progress-bar-counter-postfix' => 'color: {{VALUE}}',
390 ],
391 ]
392 );
393
394 $this->end_controls_section();
395
396 }
397
398 /*-----------------------------------------------------------------------------------*/
399 /* *. Render
400 /*-----------------------------------------------------------------------------------*/
401
402 protected function render() {
403 $settings = $this->get_settings_for_display();
404
405 if ($settings['borderless_elementor_progress_bar_stroke_color_style'] == 'borderless-elementor-progress-bar-stroke-solid-color' ) {
406 $borderless_elementor_progress_bar_stroke_color_style = 'stroke_color_mode="solid" stroke_color="'.$settings['borderless_elementor_progress_bar_stroke_color'].'"';
407
408 } else {
409 $borderless_elementor_progress_bar_stroke_color_style = 'stroke_color_mode="gradient" stroke_color="'.$settings['borderless_elementor_progress_bar_stroke_color'].'" stroke_color_from="'.$settings['borderless_elementor_progress_bar_stroke_color_from'].'" stroke_color_to="'.$settings['borderless_elementor_progress_bar_stroke_color_to'].'"';
410 }
411
412 echo'<div class="borderless-elementor-progress-bar-widget '.$settings['borderless_elementor_progress_bar_alignment'].'"><div class="borderless-elementor-progress-bar '.$settings['borderless_elementor_progress_bar_shape'].'" title="'.$settings['borderless_elementor_progress_bar_title'].'" counter_value="'.$settings['borderless_elementor_progress_bar_counter_value']['size'].'" '.$borderless_elementor_progress_bar_stroke_color_style.' trail_color="'.$settings['borderless_elementor_progress_bar_trail_color'].'" counter_color="'.$settings['borderless_elementor_progress_bar_counter_color'].'" stroke_width="'.$settings['borderless_elementor_progress_bar_stroke_width']['size'].'" trail_width="'.$settings['borderless_elementor_progress_bar_trail_width']['size'].'" animation_duration="'.$settings['borderless_elementor_progress_bar_animation_duration']['size'].'">
413 </div></div>';
414
415 }
416
417 protected function _content_template() {
418
419 }
420
421
422 }