PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.3
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.3
4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 All 146 releases
ultimate-post-kit / modules / static-social-count / widgets / static-social-count.php

static-social-count.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.5.3, at modules/static-social-count/widgets/static-social-count.php

840 lines 23.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\StaticSocialCount\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Background;
9 use Elementor\Repeater;
10 use Elementor\Icons_Manager;
11 use Elementor\Group_Control_Box_Shadow;
12 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 class Static_Social_Count extends Group_Control_Query {
19 public function get_name() {
20 return 'upk-static-social-count';
21 }
22
23 public function get_title() {
24 return BDTUPK . esc_html__('Social Count (Static)', 'ultimate-post-kit');
25 }
26
27 public function get_icon() {
28 return 'upk-widget-icon upk-icon-static-social-count';
29 }
30
31 public function get_categories() {
32 return ['ultimate-post-kit'];
33 }
34
35 public function get_style_depends() {
36 if ($this->upk_is_edit_mode()) {
37 return ['upk-all-styles'];
38 } else {
39 return ['upk-font', 'upk-static-social-count'];
40 }
41 }
42 public function get_script_depends() {
43 if ($this->upk_is_edit_mode()) {
44 return ['upk-all-scripts'];
45 } else {
46 return ['upk-static-social-count'];
47 }
48 }
49
50 public function get_keywords() {
51 return ['post', 'grid', 'blog', 'recent', 'news', 'social-count', 'count'];
52 }
53
54 public function get_custom_help_url() {
55 return 'https://youtu.be/MmbdYPee9qw';
56 }
57
58 public function has_widget_inner_wrapper(): bool {
59 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
60 }
61 protected function is_dynamic_content(): bool {
62 return false;
63 }
64
65 protected function register_controls() {
66 $this->start_controls_section(
67 'section_layout',
68 [
69 'label' => esc_html__('Layout', 'ultimate-post-kit'),
70 ]
71 );
72
73 $this->add_control(
74 'select_style',
75 [
76 'label' => esc_html__('Select Style', 'ultimate-post-kit') . BDTUPK_NC,
77 'type' => Controls_Manager::SELECT,
78 'default' => '',
79 'options' => [
80 '' => esc_html__('Style 1', 'ultimate-post-kit'),
81 'upk-style-2' => esc_html__('Style 2', 'ultimate-post-kit'),
82 'upk-style-3' => esc_html__('Style 3', 'ultimate-post-kit'),
83 ],
84 ]
85 );
86
87 $this->add_responsive_control(
88 'grid_columns',
89 [
90 'label' => __('Columns', 'ultimate-post-kit'),
91 'type' => Controls_Manager::SELECT,
92 'default' => '4',
93 'tablet_default' => '4',
94 'mobile_default' => '1',
95 'options' => [
96 '1' => '1',
97 '2' => '2',
98 '3' => '3',
99 '4' => '4',
100 '5' => '5',
101 '6' => '6',
102 ],
103 'selectors' => [
104 '{{WRAPPER}} .upk-static-social-count' => ' grid-template-columns: repeat({{VALUE}}, 1fr);'
105 ],
106 // 'condition' => [
107 // 'select_layout' => 'grid'
108 // ]
109 ]
110 );
111
112 $this->add_responsive_control(
113 'social_icon_space_between',
114 [
115 'label' => esc_html__('Column Gap', 'ultimate-post-kit'),
116 'type' => Controls_Manager::SLIDER,
117 'size_units' => ['px'],
118 'range' => [
119 'px' => [
120 'min' => 0,
121 'max' => 100,
122 'step' => 1,
123 ]
124 ],
125 'selectors' => [
126 '{{WRAPPER}} .upk-static-social-count' => 'grid-gap: {{SIZE}}{{UNIT}};',
127 ],
128 'separator' => 'before'
129 ]
130 );
131 $this->end_controls_section();
132 $this->start_controls_section(
133 'section_social_sites',
134 [
135 'label' => esc_html__('Social Count', 'ultimate-post-kit'),
136 ]
137 );
138 $repeater = new Repeater();
139 $repeater->start_controls_tabs(
140 'social_count_tabs'
141 );
142 $repeater->start_controls_tab(
143 'social_count_tabs_content',
144 [
145 'label' => esc_html__('Content', 'ultimate-post-kit'),
146 ]
147 );
148 $repeater->add_control(
149 'social_site_name',
150 [
151 'label' => esc_html__('Label', 'ultimate-post-kit'),
152 'type' => Controls_Manager::TEXT,
153 'placeholder' => esc_html__('facebook', 'ultimate-post-kit'),
154 'dynamic' => [
155 'active' => true,
156 ],
157 ]
158 );
159 $repeater->add_control(
160 'social_site_link',
161 [
162 'label' => esc_html__('Link', 'ultimate-post-kit'),
163 'type' => Controls_Manager::URL,
164 'dynamic' => [ 'active' => true ],
165 'placeholder' => esc_html__('https://facebook.com', 'ultimate-post-kit'),
166 'show_external' => true,
167 'default' => [
168 'url' => 'https://bdthemes.com',
169 'is_external' => true,
170 'nofollow' => true,
171 ],
172 ]
173 );
174 $repeater->add_control(
175 'social_site_icon',
176 [
177 'label' => esc_html__('Icon', 'ultimate-post-kit'),
178 'type' => Controls_Manager::ICONS,
179 'default' => [
180 'value' => 'fab fa-wordpress',
181 'library' => 'fa-brands',
182 ],
183 'recommended' => [
184 'fa-brands' => [
185 'android',
186 'apple',
187 'behance',
188 'bitbucket',
189 'codepen',
190 'delicious',
191 'deviantart',
192 'digg',
193 'dribbble',
194 'elementor',
195 'facebook',
196 'flickr',
197 'foursquare',
198 'free-code-camp',
199 'github',
200 'gitlab',
201 'globe',
202 'houzz',
203 'instagram',
204 'jsfiddle',
205 'linkedin',
206 'medium',
207 'meetup',
208 'mix',
209 'mixcloud',
210 'odnoklassniki',
211 'pinterest',
212 'product-hunt',
213 'reddit',
214 'shopping-cart',
215 'skype',
216 'slideshare',
217 'snapchat',
218 'soundcloud',
219 'spotify',
220 'stack-overflow',
221 'steam',
222 'telegram',
223 'thumb-tack',
224 'tripadvisor',
225 'tumblr',
226 'twitch',
227 'twitter',
228 'viber',
229 'vimeo',
230 'vk',
231 'weibo',
232 'weixin',
233 'whatsapp',
234 'wordpress',
235 'xing',
236 'yelp',
237 'youtube',
238 '500px',
239 ],
240 'fa-solid' => [
241 'envelope',
242 'link',
243 'rss',
244 ],
245 ],
246 'skin' => 'inline',
247 'label_block' => false
248 ]
249 );
250 $repeater->add_control(
251 'social_counter',
252 [
253 'label' => esc_html__('Number', 'ultimate-post-kit'),
254 'type' => Controls_Manager::TEXT,
255 'dynamic' => [
256 'active' => true,
257 ],
258 ]
259 );
260 $repeater->add_control(
261 'social_site_meta',
262 [
263 'label' => esc_html__('Meta', 'ultimate-post-kit'),
264 'type' => Controls_Manager::TEXT,
265 'dynamic' => [
266 'active' => true,
267 ],
268 ]
269 );
270 $repeater->end_controls_tab();
271 $repeater->start_controls_tab(
272 'social_count_tabs_style',
273 [
274 'label' => esc_html__('Style', 'ultimate-post-kit'),
275 ]
276 );
277 $repeater->add_group_control(
278 Group_Control_Background::get_type(),
279 [
280 'name' => 'social_single_item_bg',
281 'label' => esc_html__('Background', 'ultimate-post-kit'),
282 'types' => ['classic', 'gradient'],
283 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
284 'exclude' => ['image'],
285 'selector' => '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}}.upk-item',
286 ]
287 );
288 $repeater->add_control(
289 'heading_icon_social_single',
290 [
291 'label' => esc_html__('ICON NORMAL', 'ultimate-post-kit'),
292 'type' => Controls_Manager::HEADING,
293 'separator' => 'before',
294 ]
295 );
296 $repeater->add_control(
297 'social_single_color',
298 [
299 'label' => esc_html__('Color', 'ultimate-post-kit'),
300 'type' => Controls_Manager::COLOR,
301 'selectors' => [
302 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'color: {{VALUE}};',
303 ],
304 ]
305 );
306 $repeater->add_control(
307 'social_single_bg_color',
308 [
309 'label' => esc_html__('Background', 'ultimate-post-kit'),
310 'type' => Controls_Manager::COLOR,
311 'selectors' => [
312 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'background: {{VALUE}};',
313 ],
314 ]
315 );
316 $repeater->add_control(
317 'social_single_border_color',
318 [
319 'label' => esc_html__('Border', 'ultimate-post-kit'),
320 'type' => Controls_Manager::COLOR,
321 'selectors' => [
322 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'border-color: {{VALUE}};',
323 ],
324 ]
325 );
326 $repeater->add_control(
327 'heading_icon_h_social_single',
328 [
329 'label' => esc_html__('ICON HOVER', 'ultimate-post-kit'),
330 'type' => Controls_Manager::HEADING,
331 'separator' => 'before',
332 ]
333 );
334 $repeater->add_control(
335 'social_single_h_color',
336 [
337 'label' => esc_html__('Color', 'ultimate-post-kit'),
338 'type' => Controls_Manager::COLOR,
339 'selectors' => [
340 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'color:{{VALUE}}',
341 ],
342 ]
343 );
344 $repeater->add_control(
345 'social_single_h_bg_color',
346 [
347 'label' => esc_html__('Background', 'ultimate-post-kit'),
348 'type' => Controls_Manager::COLOR,
349 'selectors' => [
350 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'background: {{VALUE}};',
351 ],
352 ]
353 );
354 $repeater->add_control(
355 'social_single_h_border_color',
356 [
357 'label' => esc_html__('Border', 'ultimate-post-kit'),
358 'type' => Controls_Manager::COLOR,
359 'selectors' => [
360 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'border-color: {{VALUE}};',
361 ],
362 ]
363 );
364 $repeater->add_control(
365 'heading_number_social_single',
366 [
367 'label' => esc_html__('NUMBER', 'ultimate-post-kit'),
368 'type' => Controls_Manager::HEADING,
369 'separator' => 'before',
370 ]
371 );
372 $repeater->add_control(
373 'social_single_count_color',
374 [
375 'label' => esc_html__('Color', 'ultimate-post-kit'),
376 'type' => Controls_Manager::COLOR,
377 'selectors' => [
378 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-count .counter-value' => 'color: {{VALUE}};',
379 ],
380 ]
381 );
382
383 $repeater->add_control(
384 'heading_meta_social_single',
385 [
386 'label' => esc_html__('META', 'ultimate-post-kit'),
387 'type' => Controls_Manager::HEADING,
388 'separator' => 'before',
389 ]
390 );
391 $repeater->add_control(
392 'social_single_meta_color',
393 [
394 'label' => esc_html__('Color', 'ultimate-post-kit'),
395 'type' => Controls_Manager::COLOR,
396 'selectors' => [
397 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-meta' => 'color: {{VALUE}};',
398 ],
399 ]
400 );
401 $repeater->end_controls_tab();
402 $repeater->end_controls_tabs();
403 $this->add_control(
404 'social_counter_list',
405 [
406 'label' => esc_html__('Social', 'ultimate-post-kit'),
407 'type' => Controls_Manager::REPEATER,
408 'fields' => $repeater->get_controls(),
409 'default' => [
410 [
411 'social_site_name' => esc_html__('Facebook', 'ultimate-post-kit'),
412 'social_site_icon' => [
413 'value' => 'fab fa-facebook',
414 'library' => 'fa-brands',
415 ],
416 'social_counter' => '450',
417 'social_site_meta' => esc_html__('Likes', 'ultimate-post-kit'),
418 'social_site_link' => [
419 'url' => esc_html__('https://facebook.com/bdthemes', 'ultimate-post-kit')
420 ]
421 ],
422 [
423 'social_site_name' => esc_html__('Twitter', 'ultimate-post-kit'),
424 'social_site_icon' => [
425 'value' => 'fab fa-twitter',
426 'library' => 'fa-brands',
427 ],
428 'social_counter' => '3000',
429 'social_site_meta' => esc_html__('Followers', 'ultimate-post-kit'),
430 'social_site_link' => [
431 'url' => esc_html__('https://twitter.com/bdthemescom', 'ultimate-post-kit')
432 ]
433 ],
434 [
435 'social_site_name' => esc_html__('Youtube', 'ultimate-post-kit'),
436 'social_site_icon' => [
437 'value' => 'fab fa-youtube',
438 'library' => 'fa-brands',
439 ],
440 'social_counter' => '2000000',
441 'social_site_meta' => esc_html__('Subscriber', 'ultimate-post-kit'),
442 'social_site_link' => [
443 'url' => esc_html__('https://youtube.com/bdthemes', 'ultimate-post-kit')
444 ]
445 ],
446 [
447 'social_site_name' => esc_html__('Instagram', 'ultimate-post-kit'),
448 'social_site_icon' => [
449 'value' => 'fab fa-instagram',
450 'library' => 'fa-brands',
451 ],
452 'social_counter' => '105000',
453 'social_site_meta' => esc_html__('Followers', 'ultimate-post-kit'),
454 'social_site_link' => [
455 'url' => esc_html__('https://instagram.com/bdthemes', 'ultimate-post-kit')
456 ]
457 ],
458 ],
459 'title_field' => '{{{ social_site_name }}}',
460 ]
461 );
462 $this->end_controls_section();
463 $this->start_controls_section(
464 'static_social_items',
465 [
466 'label' => esc_html__('Items', 'ultimate-post-kit'),
467 'tab' => Controls_Manager::TAB_STYLE,
468 ]
469 );
470 $this->start_controls_tabs(
471 'static_social_item_tabs'
472 );
473 $this->start_controls_tab(
474 'static_social_tab_normal',
475 [
476 'label' => esc_html__('Normal', 'ultimate-post-kit'),
477 ]
478 );
479 $this->add_group_control(
480 Group_Control_Background::get_type(),
481 [
482 'name' => 'social_static_background',
483 'label' => esc_html__('Background', 'ultimate-post-kit'),
484 'types' => ['classic', 'gradient'],
485 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
486 'exclude' => ['image'],
487 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
488 ]
489 );
490 $this->add_group_control(
491 Group_Control_Border::get_type(),
492 [
493 'name' => 'social_static_border',
494 'label' => esc_html__('Border', 'ultimate-post-kit'),
495 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
496 ]
497 );
498 $this->add_responsive_control(
499 'social_static_padding',
500 [
501 'label' => esc_html__('Padding', 'ultimate-post-kit'),
502 'type' => Controls_Manager::DIMENSIONS,
503 'size_units' => ['px', '%', 'em'],
504 'selectors' => [
505 '{{WRAPPER}} .upk-static-social-count .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
506 ],
507 ]
508 );
509
510 $this->add_responsive_control(
511 'social_static_border_radius',
512 [
513 'label' => esc_html__('Radius', 'ultimate-post-kit'),
514 'type' => Controls_Manager::DIMENSIONS,
515 'size_units' => ['px', '%', 'em'],
516 'selectors' => [
517 '{{WRAPPER}} .upk-static-social-count .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
518 ],
519 ]
520 );
521 $this->add_group_control(
522 Group_Control_Box_Shadow::get_type(),
523 [
524 'name' => 'static_social_shadow',
525 'label' => esc_html__('Box Shadow', 'ultimate-post-kit'),
526 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
527 ]
528 );
529 $this->end_controls_tab();
530 $this->start_controls_tab(
531 'static_social_tab_hover',
532 [
533 'label' => esc_html__('Hover', 'ultimate-post-kit'),
534 ]
535 );
536 $this->add_group_control(
537 Group_Control_Background::get_type(),
538 [
539 'name' => 'static_social_hover_bg',
540 'label' => esc_html__('Background', 'ultimate-post-kit'),
541 'types' => ['classic', 'gradient'],
542 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
543 'exclude' => ['image'],
544 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item:hover',
545 ]
546 );
547 $this->end_controls_tab();
548 $this->end_controls_tabs();
549 $this->end_controls_section();
550 $this->start_controls_section(
551 'section_social_count_style',
552 [
553 'label' => esc_html__('Icon', 'ultimate-post-kit'),
554 'tab' => Controls_Manager::TAB_STYLE,
555 ]
556 );
557 $this->start_controls_tabs(
558 'social_icons_tab'
559 );
560 $this->start_controls_tab(
561 'social_icon_tab_normal',
562 [
563 'label' => esc_html__('Normal', 'ultimate-post-kit'),
564 ]
565 );
566 $this->add_control(
567 'icon_color',
568 [
569 'label' => esc_html__('Color', 'ultimate-post-kit'),
570 'type' => Controls_Manager::COLOR,
571 'selectors' => [
572 '{{WRAPPER}} .upk-static-social-count .upk-icon span' => 'color: {{VALUE}}',
573 ],
574 ]
575 );
576 $this->add_group_control(
577 Group_Control_Background::get_type(),
578 [
579 'name' => 'icon_background',
580 'label' => esc_html__('Background', 'ultimate-post-kit'),
581 'types' => ['classic', 'gradient'],
582 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span',
583 ]
584 );
585 $this->add_group_control(
586 Group_Control_Border::get_type(),
587 [
588 'name' => 'social_icons_border',
589 'label' => esc_html__('Border', 'ultimate-post-kit'),
590 'placeholder' => '1px',
591 'default' => '1px',
592 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span',
593 ]
594 );
595 $this->add_responsive_control(
596 'social_icon_padding',
597 [
598 'label' => esc_html__('Padding', 'ultimate-post-kit'),
599 'type' => Controls_Manager::DIMENSIONS,
600 'size_units' => ['px', '%', 'em'],
601 'selectors' => [
602 '{{WRAPPER}} .upk-static-social-count .upk-icon span ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
603 ],
604 ]
605 );
606 $this->add_responsive_control(
607 'social_icon_radius',
608 [
609 'label' => esc_html__('Radius', 'ultimate-post-kit'),
610 'type' => Controls_Manager::DIMENSIONS,
611 'size_units' => ['px', '%', 'em'],
612 'selectors' => [
613 '{{WRAPPER}} .upk-static-social-count .upk-icon span ' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
614 ],
615 ]
616 );
617 $this->add_responsive_control(
618 'social_icon_size',
619 [
620 'label' => esc_html__('Size', 'ultimate-post-kit'),
621 'type' => Controls_Manager::SLIDER,
622 'size_units' => ['px'],
623 'range' => [
624 'px' => [
625 'min' => 0,
626 'max' => 100,
627 'step' => 1,
628 ]
629 ],
630 'selectors' => [
631 '{{WRAPPER}} .upk-static-social-count .upk-icon span' => 'font-size: {{SIZE}}{{UNIT}};',
632 ]
633 ]
634 );
635 $this->add_responsive_control(
636 'social_icon_spacing',
637 [
638 'label' => esc_html__('Bottom Spacing', 'ultimate-post-kit'),
639 'type' => Controls_Manager::SLIDER,
640 'size_units' => ['px'],
641 'range' => [
642 'px' => [
643 'min' => 0,
644 'max' => 100,
645 'step' => 1,
646 ]
647 ],
648 'selectors' => [
649 '{{WRAPPER}} .upk-static-social-count .upk-icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
650 ],
651 'condition' => [
652 'select_style' => ''
653 ]
654 ]
655 );
656 $this->add_responsive_control(
657 'social_icon_spacing_left',
658 [
659 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
660 'type' => Controls_Manager::SLIDER,
661 'size_units' => ['px'],
662 'range' => [
663 'px' => [
664 'min' => 0,
665 'max' => 100,
666 'step' => 1,
667 ]
668 ],
669 'selectors' => [
670 '{{WRAPPER}} .upk-static-social-count .upk-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
671 ],
672 'condition' => [
673 'select_style' => 'upk-style-2'
674 ]
675 ]
676 );
677 $this->end_controls_tab();
678 $this->start_controls_tab(
679 'social_icon_tab_hover',
680 [
681 'label' => esc_html__('Hover', 'ultimate-post-kit'),
682 ]
683 );
684 $this->add_control(
685 'icon_h_color',
686 [
687 'label' => esc_html__('Color', 'ultimate-post-kit'),
688 'type' => Controls_Manager::COLOR,
689 'selectors' => [
690 '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover' => 'color: {{VALUE}}',
691 ],
692 ]
693 );
694 $this->add_group_control(
695 Group_Control_Background::get_type(),
696 [
697 'name' => 'icon_h_background',
698 'label' => esc_html__('Background', 'ultimate-post-kit'),
699 'types' => ['classic', 'gradient'],
700 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover',
701 ]
702 );
703 $this->add_control(
704 'icon_h_border_color',
705 [
706 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
707 'type' => Controls_Manager::COLOR,
708 'selectors' => [
709 '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover' => 'border-color: {{VALUE}}',
710 ],
711 'condition' => [
712 'social_icons_border_border!' => ''
713 ]
714 ]
715 );
716 $this->end_controls_tab();
717 $this->end_controls_tabs();
718 $this->end_controls_section();
719 $this->start_controls_section(
720 'social_counter',
721 [
722 'label' => esc_html__('Counter', 'ultimate-post-kit'),
723 'tab' => Controls_Manager::TAB_STYLE,
724 ]
725 );
726 $this->add_control(
727 'counter_color',
728 [
729 'label' => esc_html__('Color', 'ultimate-post-kit'),
730 'type' => Controls_Manager::COLOR,
731 'selectors' => [
732 '{{WRAPPER}} .upk-static-social-count .upk-count .counter-value' => 'color: {{VALUE}}',
733 ],
734 ]
735 );
736 $this->add_group_control(
737 Group_Control_Typography::get_type(),
738 [
739 'name' => 'counter_typography',
740 'label' => esc_html__('Typography', 'ultimate-post-kit'),
741 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-count .counter-value',
742 ]
743 );
744 $this->add_responsive_control(
745 'social_counter_spacing',
746 [
747 'label' => esc_html__('Bottom Spacing', 'ultimate-post-kit'),
748 'type' => Controls_Manager::SLIDER,
749 'size_units' => ['px'],
750 'range' => [
751 'px' => [
752 'min' => 0,
753 'max' => 100,
754 'step' => 1,
755 ]
756 ],
757 'selectors' => [
758 '{{WRAPPER}} .upk-static-social-count .upk-count' => 'margin-bottom: {{SIZE}}{{UNIT}};',
759 ]
760 ]
761 );
762 $this->end_controls_section();
763
764 $this->start_controls_section(
765 'social_meta',
766 [
767 'label' => esc_html__('Meta', 'ultimate-post-kit'),
768 'tab' => Controls_Manager::TAB_STYLE,
769 ]
770 );
771 $this->add_control(
772 'meta_color',
773 [
774 'label' => esc_html__('Color', 'ultimate-post-kit'),
775 'type' => Controls_Manager::COLOR,
776 'selectors' => [
777 '{{WRAPPER}} .upk-static-social-count .upk-meta' => 'color: {{VALUE}}',
778 ],
779 ]
780 );
781 $this->add_group_control(
782 Group_Control_Typography::get_type(),
783 [
784 'name' => 'meta_typography',
785 'label' => esc_html__('Typography', 'ultimate-post-kit'),
786 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-meta',
787 ]
788 );
789 $this->end_controls_section();
790 }
791
792 protected function render() {
793 $settings = $this->get_settings_for_display();
794 $this->add_render_attribute('upk-static-social-count', 'class', ['upk-static-social-count', $settings['select_style']], true);
795 $social_links = $this->get_settings('social_counter_list'); ?>
796 <div <?php $this->print_render_attribute_string('upk-static-social-count'); ?>>
797 <?php foreach ($social_links as $link_key => $social_link) {
798 $this->add_render_attribute($link_key, 'class', [
799 'upk-item',
800 'upk-social-icon',
801 'upk-social-icon-' . strtolower($social_link['social_site_name']),
802 'elementor-repeater-item-' . $social_link['_id'],
803 ]);
804 if ($social_link['social_site_link']['is_external'] !== 'on') {
805 $this->add_render_attribute($link_key, 'href', esc_url($social_link['social_site_link']['url']));
806 } else {
807 $this->add_render_attribute(
808 $link_key,
809 [
810 'href' => [
811 esc_url($social_link['social_site_link']['url'])
812 ],
813 'target' => '_blank'
814 ],
815 null,
816 true
817 );
818 }
819 ?>
820 <a <?php $this->print_render_attribute_string($link_key); ?>>
821 <div class="upk-icon">
822 <span title="<?php echo esc_attr($social_link['social_site_name']); ?>">
823 <?php Icons_Manager::render_icon($social_link['social_site_icon'], ['aria-hidden' => 'true']); ?>
824 </span>
825 </div>
826 <div class="upk-content">
827 <div class="upk-count">
828 <?php echo '<span class="counter-value">' . esc_html($social_link['social_counter']) . '</span>'; ?>
829 </div>
830 <div class="upk-meta">
831 <?php printf('<span>%s</span>', esc_html($social_link['social_site_meta'])); ?>
832 </div>
833 </div>
834 </a>
835 <?php
836 }
837 echo '</div>';
838 }
839 }
840