PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.1.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.1.0
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / widgets / Counter.php
spider-elements / widgets Last commit date
templates 2 years ago Accordion.php 2 years ago Alerts_Box.php 2 years ago Animated_Heading.php 2 years ago Before_after.php 2 years ago Blog_Grid.php 2 years ago Buttons.php 2 years ago Cheat_sheet.php 2 years ago Counter.php 2 years ago Fullscreen_Slider.php 2 years ago Icon_box.php 2 years ago Instagram.php 2 years ago Integrations.php 2 years ago List_Item.php 2 years ago Marquee_Slides.php 2 years ago Pricing_Table_Switcher.php 2 years ago Pricing_Table_Tabs.php 2 years ago Skill_Showcase.php 2 years ago Tabs.php 2 years ago Team_Carousel.php 2 years ago Testimonial.php 2 years ago Timeline.php 2 years ago Video_Playlist.php 2 years ago Video_Popup.php 2 years ago
Counter.php
445 lines
1 <?php
2 /**
3 * Use namespace to avoid conflict
4 */
5
6 namespace SPEL\Widgets;
7
8 use Elementor\Group_Control_Typography;
9 use Elementor\Widget_Base;
10 use Elementor\Controls_Manager;
11
12 // Exit if accessed directly
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Class Team
19 * @package spider\Widgets
20 * @since 1.0.0
21 */
22 class Counter extends Widget_Base {
23
24 public function get_name() {
25 return 'spe_counter'; // ID of the widget (Don't change this name)
26 }
27
28 public function get_title() {
29 return esc_html__( 'Counter', 'spider-elements' );
30 }
31
32 public function get_icon() {
33 return 'eicon-counter spel-icon';
34 }
35
36 public function get_keywords() {
37 return [ 'spider', 'Counter', 'Progress bar', ];
38 }
39
40 public function get_categories() {
41 return [ 'spider-elements' ];
42 }
43
44 /**
45 * Name: get_style_depends()
46 * Desc: Register the required CSS dependencies for the frontend.
47 */
48 public function get_style_depends() {
49 return [ 'spel-main' ];
50 }
51
52 /**
53 * Name: get_script_depends()
54 * Desc: Register the required JS dependencies for the frontend.
55 */
56 public function get_script_depends() {
57 return [ 'spel-el-widgets', 'counterup', 'waypoint' ];
58 }
59
60 /**
61 * Name: register_controls()
62 * Desc: Register controls for these widgets
63 * Params: no params
64 * Return: @void
65 * Since: @1.0.0
66 * Package: @spider-elements
67 * Author: spider-themes
68 */
69 protected function register_controls() {
70 $this->elementor_content_control();
71 $this->counter_style_control();
72 }
73
74
75 /**
76 * Name: elementor_content_control()
77 * Desc: Register the Content Tab output on the Elementor editor.
78 * Params: no params
79 * Return: @void
80 * Since: @1.0.0
81 * Package: @spider-elements
82 * Author: spider-themes
83 */
84
85 public function elementor_content_control() {
86 //==================== Select Preset Skin ====================//
87 $this->start_controls_section(
88 'counter_preset', [
89 'label' => __( 'Preset Skin', 'spider-elements' ),
90 ]
91 );
92
93 $this->add_control(
94 'style',
95 [
96 'label' => esc_html__( 'Counter Style', 'spider-elements' ),
97 'type' => Controls_Manager::CHOOSE,
98 'options' => [
99 '1' => [
100 'icon' => 'counter1',
101 'title' => esc_html__( '01 : Counter', 'spider-elements' )
102 ],
103 '2' => [
104 'icon' => 'counter2',
105 'title' => esc_html__( '02 : Counter', 'spider-elements' )
106 ],
107 ],
108 'default' => '1',
109 ]
110 );
111
112 $this->end_controls_section(); // End Preset Skin
113
114 //=================== SecCountertion ===================//
115 $this->start_controls_section(
116 'sec_counter', [
117 'label' => esc_html__( 'Counter', 'spider-elements' ),
118 ]
119 );
120
121 $this->add_control(
122 'counter_value', [
123 'label' => esc_html__( 'Value', 'spider-elements' ),
124 'type' => Controls_Manager::NUMBER,
125 'default' => 85,
126 'min' => 0,
127 'max' => 100,
128 ]
129 );
130
131 // Control for Number Prefix & Suffix
132 $this->add_control(
133 'counter_prefix',
134 [
135 'label' => esc_html__( 'Number Prefix', 'spider-elements' ),
136 'type' => \Elementor\Controls_Manager::TEXT,
137 'default' => '',
138 ]
139 );
140
141 $this->add_control(
142 'counter_suffix',
143 [
144 'label' => esc_html__( 'Number Suffix', 'spider-elements' ),
145 'type' => \Elementor\Controls_Manager::TEXT,
146 'default' => '%',
147 ]
148 );
149
150 // Control for Counter Text
151 $this->add_control(
152 'counter_text', [
153 'label' => esc_html__( 'Title', 'spider-elements' ),
154 'type' => Controls_Manager::TEXT,
155 'default' => esc_html__( 'User research', 'spider-elements' ),
156 ]
157 );
158
159 // $this->add_control(
160 // 'text_switcher', [
161 // 'label' => esc_html__( 'Counter Text Show/Hide', 'spider-elements' ),
162 // 'type' => Controls_Manager::SWITCHER,
163 // 'label_on' => esc_html__( 'Yes', 'spider-elements' ),
164 // 'label_off' => esc_html__( 'No', 'spider-elements' ),
165 // 'return_value' => 'yes',
166 // 'default' => 'yes',
167 // 'separator' => 'before'
168 // ]
169 // );
170
171 $this->end_controls_section();
172
173 }
174
175
176 /**
177 * Name: counter_style_control()
178 * Desc: Register the Style Tab output on the Elementor editor.
179 * Params: no params
180 * Return: @void
181 * Since: @1.0.0
182 * Package: @spider-elements
183 * Author: spider-themes
184 */
185 public function counter_style_control() {
186
187 //===================== Counter Content Style ============================//
188 $this->start_controls_section(
189 'style_counter', [
190 'label' => esc_html__( 'Counter', 'spider-elements' ),
191 'tab' => Controls_Manager::TAB_STYLE,
192 ]
193 );
194
195 $this->add_group_control(
196 \Elementor\Group_Control_Background::get_type(),
197 [
198 'name' => 'style_bg',
199 'types' => [ 'classic', 'gradient', 'video' ],
200 'selector' => '{{WRAPPER}} .skill_item_two .radial-progress',
201 'condition' => [
202 'style' => [ '2' ]
203 ]
204 ]
205 );
206
207 // $this->add_control(
208 // 'style_bg',
209 // [
210 // 'label' => esc_html__( 'Background Color', 'spider-elements' ),
211 // 'type' => Controls_Manager::COLOR,
212 // 'selectors' => [
213 // '{{WRAPPER}} .skill_item_two .radial-progress' => 'background: {{VALUE}};',
214 // ],
215 // 'condition' => [
216 // 'style' => [ '2' ]
217 // ]
218 // ]
219 // );
220
221 $this->add_control(
222 'style_radius',
223 [
224 'label' => __( 'Border Radius', 'spider-elements' ),
225 'type' => Controls_Manager::DIMENSIONS,
226 'size_units' => [ 'px' ],
227 'selectors' => [
228 '{{WRAPPER}} .skill_item_two .radial-progress' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
229 ],
230 'condition' => [
231 'style' => [ '2' ]
232 ]
233 ]
234 );
235
236 $this->add_responsive_control(
237 'counter_circle_size',
238 [
239 'label' => __( 'Size', 'spider-elements' ),
240 'type' => Controls_Manager::SLIDER,
241 'size_units' => [ 'px' ],
242 'range' => [
243 'px' => [
244 'min' => 50,
245 'max' => 500,
246 'step' => 1,
247 ],
248 ],
249 'default' => [
250 'unit' => 'px',
251 'size' => 100,
252 ],
253 'selectors' => [
254 '{{WRAPPER}} .skill_item svg.radial-progress' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};'
255 ],
256 'separator' => 'after',
257 ]
258 );
259
260 $this->add_control(
261 'fill_color',
262 [
263 'label' => esc_html__( 'Fill Color', 'spider-elements' ),
264 'type' => Controls_Manager::COLOR,
265 'selectors' => [
266 '{{WRAPPER}} svg.radial-progress circle.incomplete' => 'stroke: {{VALUE}};',
267 ],
268 ]
269 );
270
271 $this->add_control(
272 'stroke_color',
273 [
274 'label' => esc_html__( 'Stroke Color', 'spider-elements' ),
275 'type' => Controls_Manager::COLOR,
276 'selectors' => [
277 '{{WRAPPER}} .radial-progress .complete' => 'stroke: {{VALUE}};',
278 ],
279 ]
280 );
281
282 $this->add_responsive_control(
283 'counter_circle_stroke_width',
284 [
285 'label' => __( 'Stroke Width', 'spider-elements' ),
286 'type' => Controls_Manager::SLIDER,
287 'size_units' => [ 'px' ],
288 'range' => [
289 'px' => [
290 'min' => 0,
291 'max' => 100,
292 'step' => 1,
293 ],
294 ],
295 'default' => [
296 'unit' => 'px',
297 'size' => 6,
298 ],
299 'selectors' => [
300 '{{WRAPPER}} svg.radial-progress circle' => 'stroke-width: {{SIZE}}{{UNIT}}',
301 ],
302 'separator' => 'before',
303 ]
304 );
305
306 $this->end_controls_section();
307
308
309 // Control for percent color
310 $this->start_controls_section(
311 'number_style', [
312 'label' => esc_html__( 'Number', 'spider-elements' ),
313 'tab' => Controls_Manager::TAB_STYLE,
314 ]
315 );
316
317 $this->add_control(
318 'number_color',
319 [
320 'label' => esc_html__( 'Color', 'spider-elements' ),
321 'type' => Controls_Manager::COLOR,
322 'selectors' => [
323 '{{WRAPPER}} .counters-container .skill_item .counter-wrap' => 'color: {{VALUE}};',
324 '{{WRAPPER}} .skill_item_two .skill_pr .counter2-wrap' => 'color: {{VALUE}};',
325 ],
326 ]
327 );
328
329 $this->add_group_control(
330 Group_Control_Typography::get_type(), [
331 'name' => 'number_typo',
332 'selector' => '{{WRAPPER}} .counters-container .skill_item .counter-wrap,
333 {{WRAPPER}} .skill_item_two .skill_pr .counter2-wrap',
334 ]
335
336 );
337
338 $this->add_responsive_control(
339 'prefix_suffix_size',
340 [
341 'label' => __( 'Number Gap', 'spider-elements' ),
342 'type' => Controls_Manager::SLIDER,
343 'size_units' => [ 'px', 'em', 'rem', '%' ],
344 'range' => [
345 'px' => [
346 'min' => 0,
347 'max' => 500,
348 'step' => 1,
349 ],
350 'em' => [
351 'min' => 0,
352 'max' => 50,
353 'step' => 0.1,
354 ],
355 'rem' => [
356 'min' => 0,
357 'max' => 50,
358 'step' => 0.1,
359 ],
360 '%' => [
361 'min' => 0,
362 'max' => 100,
363 'step' => 1,
364 ],
365 ],
366 'selectors' => [
367 '{{WRAPPER}} .counter-wrap' => 'gap: {{SIZE}}{{UNIT}};',
368 '{{WRAPPER}} .counter2-wrap' => 'gap: {{SIZE}}{{UNIT}};'
369 ],
370 'separator' => 'before',
371 ]
372 );
373
374 $this->end_controls_section();
375
376 // Control for text color
377 $this->start_controls_section(
378 'counter_title', [
379 'label' => esc_html__( 'Title', 'spider-elements' ),
380 'tab' => Controls_Manager::TAB_STYLE,
381 ]
382 );
383
384 $this->add_control(
385 'counter_text_color',
386 [
387 'label' => esc_html__( 'Color', 'spider-elements' ),
388 'type' => Controls_Manager::COLOR,
389 'selectors' => [
390 '{{WRAPPER}} .skill_item h6' => 'color: {{VALUE}};',
391 '{{WRAPPER}} .counters-container h6' => 'color: {{VALUE}};',
392 ],
393 ]
394 );
395
396 $this->add_group_control(
397 Group_Control_Typography::get_type(), [
398 'name' => 'counter_text_typo',
399 'selector' => '{{WRAPPER}} .counters-container h6'
400 ]
401 );
402 $this->add_responsive_control(
403 'counter_text_margin',
404 [
405 'label' => __( 'Margin Top', 'spider-elements' ),
406 'type' => Controls_Manager::SLIDER,
407 'size_units' => [ 'px', '%' ],
408 'range' => [
409 'px' => [
410 'min' => 0,
411 'max' => 100,
412 'step' => 1,
413 ],
414 ],
415 'default' => [
416 'size' => 6,
417 ],
418 'selectors' => [
419 '{{WRAPPER}} .skill_item h6' => 'margin-top: {{SIZE}}{{UNIT}}',
420 '{{WRAPPER}} .counters-container h6' => 'margin-top: {{SIZE}}{{UNIT}}',
421
422 ],
423 ]
424 );
425 $this->end_controls_section();
426
427 }
428
429 /**
430 * Name: elementor_render()
431 * Desc: Render the widget output on the frontend.
432 * Params: no params
433 * Return: @void
434 * Since: @1.0.0
435 * Package: @spider-elements
436 * Author: spider-themes
437 */
438 protected function render() {
439 $settings = $this->get_settings_for_display();
440 extract( $settings ); //extract all settings array to variables converted to name of key
441
442 //================= Template Parts =================//
443 include "templates/counter/counter-{$settings['style']}.php";
444 }
445 }