PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.65
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.65
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / widgets / Share_Buttons / Share_Buttons.php

Share_Buttons.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.65, at includes/widgets/Share_Buttons/Share_Buttons.php

762 lines 27.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace King_Addons;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Repeater;
8 use Elementor\Widget_Base;
9
10 if (!defined('ABSPATH')) {
11 exit; // Exit if accessed directly.
12 }
13
14
15
16 class Share_Buttons extends Widget_Base
17 {
18
19
20 public function get_name(): string
21 {
22 return 'king-addons-share-buttons';
23 }
24
25 public function get_title(): string
26 {
27 return esc_html__('Share Buttons', 'king-addons');
28 }
29
30 public function get_icon(): string
31 {
32 return 'king-addons-icon king-addons-share-buttons';
33 }
34
35 public function get_style_depends(): array
36 {
37 return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-share-buttons-style'];
38 }
39
40 public function get_categories(): array
41 {
42 return ['king-addons'];
43 }
44
45 public function get_keywords(): array
46 {
47 return ['social', 'share', 'sharing', 'network', 'facebook', 'twitter', 'youtube', 'linkedin', 'x social', 'buttons', 'button',
48 'social sharing', 'sharing buttons', 'share buttons', 'king addons', 'king', 'addons', 'kingaddons', 'king-addons'];
49 }
50
51 public function get_custom_help_url()
52 {
53 return 'mailto:bug@kingaddons.com?subject=Bug Report - King Addons&body=Please describe the issue';
54 }
55
56 public function add_repeater_args_share_custom_label(): array
57 {
58 return [
59 'type' => Controls_Manager::HIDDEN,
60 'default' => ''
61 ];
62 }
63
64 public function add_control_share_show_icon()
65 {
66 }
67
68 public function add_control_share_columns()
69 {
70 $this->add_responsive_control(
71 'share_columns',
72 [
73 'label' => esc_html__('Columns', 'king-addons'),
74 'type' => Controls_Manager::SELECT,
75 'options' => [
76 '0' => esc_html__('Auto', 'king-addons'),
77 '1' => esc_html__('1', 'king-addons'),
78 '2' => esc_html__('2', 'king-addons'),
79 'pro-3' => esc_html__('3 (Pro)', 'king-addons'),
80 'pro-4' => esc_html__('4 (Pro)', 'king-addons'),
81 'pro-5' => esc_html__('5 (Pro)', 'king-addons'),
82 'pro-6' => esc_html__('6 (Pro)', 'king-addons'),
83 ],
84 'default' => '0',
85 'prefix_class' => 'elementor-grid%s-',
86 ]
87 );
88 }
89
90 public function add_control_share_show_label()
91 {
92 }
93
94 public function add_control_share_icon_border_radius()
95 {
96 }
97
98 protected function register_controls()
99 {
100
101 $this->start_controls_section(
102 'section_share_general',
103 [
104 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('General', 'king-addons'),
105 'tab' => Controls_Manager::TAB_CONTENT,
106 ]
107 );
108
109 $repeater = new Repeater();
110
111 $repeater->add_control(
112 'share_icon',
113 [
114 'label' => esc_html__('Network', 'king-addons'),
115 'type' => Controls_Manager::SELECT,
116 'options' => [
117 'fab fa-facebook-f' => 'Facebook',
118 'fab fa-x-twitter' => 'X (Twitter)',
119 'fab fa-linkedin-in' => 'LinkedIn',
120 'fab fa-pinterest-p' => 'Pinterest',
121 'fab fa-reddit' => 'Reddit',
122 'fab fa-whatsapp' => 'WhatsApp',
123 'fab fa-telegram' => 'Telegram',
124 'fab fa-vk' => 'VK',
125 'fab fa-odnoklassniki' => 'OK',
126 'fab fa-skype' => 'Skype',
127 'fab fa-tumblr' => 'Tumblr',
128 'fab fa-get-pocket' => 'Pocket',
129 'fab fa-digg' => 'Digg',
130 'fab fa-xing' => 'Xing',
131 'fas fa-envelope' => 'Email',
132 'fas fa-print' => 'Print',
133 ],
134 'default' => 'fab fa-reddit',
135 ]
136 );
137
138 $repeater->add_control('share_custom_label', $this->add_repeater_args_share_custom_label());
139
140 $repeater->add_control(
141 'show_whatsapp_title',
142 [
143 'label' => esc_html__('Show Title', 'king-addons'),
144 'type' => Controls_Manager::SWITCHER,
145 'separator' => 'before',
146 'default' => 'yes',
147 'condition' => [
148 'share_icon' => 'fab fa-whatsapp'
149 ]
150 ]
151 );
152
153 $repeater->add_control(
154 'show_whatsapp_excerpt',
155 [
156 'label' => esc_html__('Show Excerpt', 'king-addons'),
157 'type' => Controls_Manager::SWITCHER,
158 'condition' => [
159 'share_icon' => 'fab fa-whatsapp'
160 ]
161 ]
162 );
163
164 $this->add_control(
165 'share_buttons',
166 [
167 'type' => Controls_Manager::REPEATER,
168 'fields' => $repeater->get_controls(),
169 'default' => [
170 [
171 'share_icon' => 'fab fa-facebook-f',
172 ],
173 [
174 'share_icon' => 'fab fa-x-twitter',
175 ],
176 [
177 'share_icon' => 'fab fa-linkedin-in',
178 ],
179 ],
180 'title_field' => 'Social Icon',
181 ]
182 );
183
184 if (!king_addons_freemius()->can_use_premium_code__premium_only()) {
185 $this->add_control(
186 'share_repeater_pro_notice',
187 [
188 'type' => Controls_Manager::RAW_HTML,
189 'raw' => 'More than 3 buttons are available<br> in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-share-buttons-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>',
190 'content_classes' => 'king-addons-pro-notice',
191 ]
192 );
193 }
194
195 $this->end_controls_section();
196
197 $this->start_controls_section(
198 'section_share_layout',
199 [
200 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Layout', 'king-addons'),
201 'tab' => Controls_Manager::TAB_CONTENT,
202 ]
203 );
204
205 $this->add_control_share_columns();
206
207 Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'share-buttons', 'share_columns', ['pro-3', 'pro-4', 'pro-5', 'pro-6']);
208
209 $this->add_control_share_show_icon();
210
211 $this->add_control_share_show_label();
212
213 $this->end_controls_section();
214
215 Core::renderProFeaturesSection($this, '', Controls_Manager::RAW_HTML, 'share-buttons', [
216 'Add Unlimited Social Icons',
217 'Custom Social Media Label',
218 'Layout Columns: 1,2,3,4,5,6',
219 'Only Labels: Show/Hide Icon',
220 'Only Icons: Show/Hide Label',
221 'Advanced Styling Options',
222 ]);
223
224 $this->start_controls_section(
225 'section_styles_share_layout',
226 [
227 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Layout', 'king-addons'),
228 'tab' => Controls_Manager::TAB_STYLE,
229 ]
230 );
231
232 $this->add_responsive_control(
233 'share_gutter_hr',
234 [
235 'label' => esc_html__('Horizontal Gutter', 'king-addons'),
236 'type' => Controls_Manager::SLIDER,
237 'default' => [
238 'size' => 10,
239 ],
240 'range' => [
241 'px' => [
242 'min' => 0,
243 'max' => 25,
244 ],
245 ],
246 'selectors' => [
247 '{{WRAPPER}}:not(.elementor-grid-0) .elementor-grid' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
248 '{{WRAPPER}}.elementor-grid-0 .king-addons-share-buttons a' => 'margin-right: calc({{SIZE}}{{UNIT}} / 2); margin-left: calc({{SIZE}}{{UNIT}} / 2)',
249 '(tablet) {{WRAPPER}}.elementor-grid-tablet-0 .king-addons-share-buttons a' => 'margin-right: calc({{SIZE}}{{UNIT}} / 2); margin-left: calc({{SIZE}}{{UNIT}} / 2)',
250 '(mobile) {{WRAPPER}}.elementor-grid-mobile-0 .king-addons-share-buttons a' => 'margin-right: calc({{SIZE}}{{UNIT}} / 2); margin-left: calc({{SIZE}}{{UNIT}} / 2)',
251 '{{WRAPPER}}.elementor-grid-0 .elementor-grid' => 'margin-right: calc(-{{SIZE}}{{UNIT}} / 2); margin-left: calc(-{{SIZE}}{{UNIT}} / 2)',
252 '(tablet) {{WRAPPER}}.elementor-grid-tablet-0 .elementor-grid' => 'margin-right: calc(-{{SIZE}}{{UNIT}} / 2); margin-left: calc(-{{SIZE}}{{UNIT}} / 2)',
253 '(mobile) {{WRAPPER}}.elementor-grid-mobile-0 .elementor-grid' => 'margin-right: calc(-{{SIZE}}{{UNIT}} / 2); margin-left: calc(-{{SIZE}}{{UNIT}} / 2)',
254 ],
255 ]
256 );
257
258 $this->add_responsive_control(
259 'share_gutter_vr',
260 [
261 'label' => esc_html__('Vertical Gutter', 'king-addons'),
262 'type' => Controls_Manager::SLIDER,
263 'default' => [
264 'size' => 10,
265 ],
266 'range' => [
267 'px' => [
268 'min' => 0,
269 'max' => 25,
270 ],
271 ],
272 'selectors' => [
273 '{{WRAPPER}}:not(.elementor-grid-0) .elementor-grid' => 'grid-row-gap: {{SIZE}}{{UNIT}}',
274 '{{WRAPPER}}.elementor-grid-0 .king-addons-share-buttons a' => 'margin-bottom: {{SIZE}}{{UNIT}}',
275 '(tablet) {{WRAPPER}}.elementor-grid-tablet-0 .king-addons-share-buttons a' => 'margin-bottom: {{SIZE}}{{UNIT}}',
276 '(mobile) {{WRAPPER}}.elementor-grid-mobile-0 .king-addons-share-buttons a' => 'margin-bottom: {{SIZE}}{{UNIT}}',
277 ],
278 ]
279 );
280
281 $this->add_responsive_control(
282 'share_icon_width',
283 [
284 'label' => esc_html__('Icon Width', 'king-addons'),
285 'type' => Controls_Manager::SLIDER,
286 'default' => [
287 'size' => 45,
288 ],
289 'range' => [
290 'px' => [
291 'min' => 15,
292 'max' => 200,
293 ],
294 ],
295 'selectors' => [
296 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'width: {{SIZE}}{{UNIT}};',
297 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon svg' => 'width: {{SIZE}}{{UNIT}};',
298 ],
299 'separator' => 'before'
300 ]
301 );
302
303 $this->add_responsive_control(
304 'share_icon_height',
305 [
306 'label' => esc_html__('Icon Height', 'king-addons'),
307 'type' => Controls_Manager::SLIDER,
308 'default' => [
309 'size' => 45,
310 ],
311 'range' => [
312 'px' => [
313 'min' => 15,
314 'max' => 100,
315 ],
316 ],
317 'selectors' => [
318 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}}',
319 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon svg' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}}',
320 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}}',
321 ],
322 ]
323 );
324
325 $this->add_responsive_control(
326 'share_icon_size',
327 [
328 'label' => esc_html__('Icon Size', 'king-addons'),
329 'type' => Controls_Manager::SLIDER,
330 'default' => [
331 'size' => 18,
332 ],
333 'range' => [
334 'px' => [
335 'min' => 10,
336 'max' => 100,
337 ],
338 ],
339 'selectors' => [
340 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
341 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};'
342 ],
343 ]
344 );
345
346 $this->add_responsive_control(
347 'share_label_spacing',
348 [
349 'label' => esc_html__('Label Spacing', 'king-addons'),
350 'type' => Controls_Manager::SLIDER,
351 'range' => [
352 'px' => [
353 'min' => 0,
354 'max' => 100,
355 ],
356 ],
357 'default' => [
358 'size' => 20,
359 ],
360 'selectors' => [
361 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label' => 'padding: 0 {{SIZE}}{{UNIT}};',
362 ],
363 'separator' => 'before',
364 'condition' => [
365 'share_show_label' => 'yes',
366 ]
367 ]
368 );
369
370 $this->add_group_control(
371 Group_Control_Typography::get_type(),
372 [
373 'name' => 'share_label_typography',
374 'selector' => '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label',
375 'condition' => [
376 'share_show_label' => 'yes',
377 ]
378 ]
379 );
380
381 $this->add_responsive_control(
382 'share_border_width',
383 [
384 'label' => esc_html__('Border Width', 'king-addons'),
385 'type' => Controls_Manager::SLIDER,
386 'default' => [
387 'size' => 0,
388 ],
389 'range' => [
390 'px' => [
391 'min' => 0,
392 'max' => 10,
393 ],
394 ],
395 'selectors' => [
396 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon' => 'border-width: {{SIZE}}{{UNIT}}; border-style: solid;',
397 ],
398 'separator' => 'before'
399 ]
400 );
401
402 $this->add_control_share_icon_border_radius();
403
404 $this->add_control(
405 'share_button_border_radius',
406 [
407 'label' => esc_html__('Button Border Radius', 'king-addons'),
408 'type' => Controls_Manager::DIMENSIONS,
409 'size_units' => ['px', '%'],
410 'default' => [
411 'top' => 0,
412 'right' => 0,
413 'bottom' => 0,
414 'left' => 0,
415 ],
416 'selectors' => [
417 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
418 ]
419 ]
420 );
421
422 $this->add_responsive_control(
423 'share_button_align',
424 [
425 'label' => esc_html__('Alignment', 'king-addons'),
426 'type' => Controls_Manager::CHOOSE,
427 'options' => [
428 'flex-start' => [
429 'title' => esc_html__('Left', 'king-addons'),
430 'icon' => 'eicon-text-align-left',
431 ],
432 'center' => [
433 'title' => esc_html__('Center', 'king-addons'),
434 'icon' => 'eicon-text-align-center',
435 ],
436 'flex-end' => [
437 'title' => esc_html__('Right', 'king-addons'),
438 'icon' => 'eicon-text-align-right',
439 ],
440 'space-between' => [
441 'title' => esc_html__('Justified', 'king-addons'),
442 'icon' => 'eicon-text-align-justify',
443 ],
444 ],
445 'default' => 'flex-start',
446 'selectors' => [
447 '{{WRAPPER}} .king-addons-share-buttons' => 'justify-content: {{VALUE}};',
448 ],
449 'separator' => 'before',
450 ]
451 );
452
453 $this->end_controls_section();
454
455 $this->start_controls_section(
456 'section_styles_share_styles',
457 [
458 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Styles', 'king-addons'),
459 'tab' => Controls_Manager::TAB_STYLE,
460 ]
461 );
462
463 $this->add_control(
464 'share_custom_colors',
465 [
466 'label' => esc_html__('Use Custom Colors', 'king-addons'),
467 'type' => Controls_Manager::SWITCHER,
468 'separator' => 'after'
469 ]
470 );
471
472 $this->add_control(
473 'share_icon_bg_tr',
474 [
475 'label' => esc_html__('Icon Background Color', 'king-addons'),
476 'type' => Controls_Manager::SWITCHER,
477 'default' => 'yes',
478 'condition' => [
479 'share_custom_colors' => '',
480 ]
481 ]
482 );
483
484 $this->add_control(
485 'share_label_bg',
486 [
487 'label' => esc_html__('Label Background Color', 'king-addons'),
488 'type' => Controls_Manager::SWITCHER,
489 'default' => 'yes',
490 'condition' => [
491 'share_show_label' => 'yes',
492 'share_custom_colors' => '',
493 ]
494 ]
495 );
496
497 $this->add_control(
498 'share_label_bg_tr',
499 [
500 'label' => esc_html__('Label Background Transparency', 'king-addons'),
501 'type' => Controls_Manager::SWITCHER,
502 'default' => 'yes',
503 'selectors_dictionary' => [
504 '' => '1',
505 'yes' => '0.92'
506 ],
507 'selectors' => [
508 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label' => 'opacity: {{VALUE}};',
509 ],
510 'condition' => [
511 'share_show_label' => 'yes',
512 'share_custom_colors' => '',
513 'share_label_bg' => 'yes',
514 ]
515 ]
516 );
517
518 $this->start_controls_tabs(
519 'tabs_share_custom_colors', [
520 'condition' => [
521 'share_custom_colors' => 'yes',
522 ]
523 ]
524 );
525
526 $this->start_controls_tab(
527 'tab_share_custom_normal',
528 [
529 'label' => esc_html__('Normal', 'king-addons'),
530 ]
531 );
532
533 $this->add_control(
534 'share_icon_color',
535 [
536 'label' => esc_html__('Icon Color', 'king-addons'),
537 'type' => Controls_Manager::COLOR,
538 'default' => '#ffffff',
539 'selectors' => [
540 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'color: {{VALUE}}',
541 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon svg' => 'fill: {{VALUE}}'
542 ],
543 ]
544 );
545
546 $this->add_control(
547 'share_icon_bg_color',
548 [
549 'label' => esc_html__('Icon Background Color', 'king-addons'),
550 'type' => Controls_Manager::COLOR,
551 'default' => '#4D02D8',
552 'selectors' => [
553 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'background-color: {{VALUE}}',
554 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon svg' => 'background-color: {{VALUE}}',
555 ],
556 ]
557 );
558
559 $this->add_control(
560 'share_label_color',
561 [
562 'label' => esc_html__('Label Color', 'king-addons'),
563 'type' => Controls_Manager::COLOR,
564 'default' => '#ffffff',
565 'selectors' => [
566 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label' => 'color: {{VALUE}}',
567 ],
568 'condition' => [
569 'share_show_label' => 'yes',
570 ]
571 ]
572 );
573
574 $this->add_control(
575 'share_label_bg_color',
576 [
577 'label' => esc_html__('Label Background Color', 'king-addons'),
578 'type' => Controls_Manager::COLOR,
579 'default' => '#5B03FF',
580 'selectors' => [
581 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-label' => 'background-color: {{VALUE}}',
582 ],
583 'condition' => [
584 'share_show_label' => 'yes',
585 ]
586 ]
587 );
588
589 $this->add_control(
590 'share_label_border_color',
591 [
592 'label' => esc_html__('Border Color', 'king-addons'),
593 'type' => Controls_Manager::COLOR,
594 'default' => '#E8E8E8',
595 'selectors' => [
596 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon' => 'border-color: {{VALUE}}',
597 ],
598 ]
599 );
600
601 $this->end_controls_tab();
602
603 $this->start_controls_tab(
604 'tab_share_custom_hover',
605 [
606 'label' => esc_html__('Hover', 'king-addons'),
607 ]
608 );
609
610 $this->add_control(
611 'share_icon_color_hr',
612 [
613 'label' => esc_html__('Icon Color', 'king-addons'),
614 'type' => Controls_Manager::COLOR,
615 'default' => '#ffffff',
616 'selectors' => [
617 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover i' => 'color: {{VALUE}}',
618 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover svg' => 'fill: {{VALUE}}',
619 ],
620 ]
621 );
622
623 $this->add_control(
624 'share_icon_bg_color_hr',
625 [
626 'label' => esc_html__('Icon Background Color', 'king-addons'),
627 'type' => Controls_Manager::COLOR,
628 'default' => '#5B03FF',
629 'selectors' => [
630 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover i' => 'background-color: {{VALUE}}',
631 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover svg' => 'background-color: {{VALUE}}',
632 ],
633 ]
634 );
635
636 $this->add_control(
637 'share_label_color_hr',
638 [
639 'label' => esc_html__('Label Color', 'king-addons'),
640 'type' => Controls_Manager::COLOR,
641 'default' => '#ffffff',
642 'selectors' => [
643 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover .king-addons-share-label' => 'color: {{VALUE}}',
644 ],
645 'condition' => [
646 'share_show_label' => 'yes',
647 ]
648 ]
649 );
650
651 $this->add_control(
652 'share_label_bg_color_hr',
653 [
654 'label' => esc_html__('Label Background Color', 'king-addons'),
655 'type' => Controls_Manager::COLOR,
656 'default' => '#4D02D8',
657 'selectors' => [
658 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover .king-addons-share-label' => 'background-color: {{VALUE}}',
659 ],
660 'condition' => [
661 'share_show_label' => 'yes',
662 ]
663 ]
664 );
665
666 $this->add_control(
667 'share_label_border_color_hr',
668 [
669 'label' => esc_html__('Border Color', 'king-addons'),
670 'type' => Controls_Manager::COLOR,
671 'default' => '#E8E8E8',
672 'selectors' => [
673 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon:hover' => 'border-color: {{VALUE}}',
674 ],
675 ]
676 );
677
678 $this->end_controls_tab();
679
680 $this->end_controls_tabs();
681
682 $this->add_control(
683 'share_transition_duration',
684 [
685 'label' => esc_html__('Transition Duration (ms)', 'king-addons'),
686 'type' => Controls_Manager::NUMBER,
687 'default' => 100,
688 'min' => 0,
689 'step' => 50,
690 'selectors' => [
691 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon' => 'transition-duration: {{VALUE}}ms',
692 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon i' => 'transition-duration: {{VALUE}}ms',
693 '{{WRAPPER}} .king-addons-share-buttons .king-addons-share-icon span' => 'transition-duration: {{VALUE}}ms',
694 ],
695 'separator' => 'before',
696 ]
697 );
698
699
700
701
702 $this->end_controls_section();
703
704
705
706 }
707
708 protected function render()
709 {
710 $settings = $this->get_settings();
711
712 if (!king_addons_freemius()->can_use_premium_code__premium_only()) {
713 $settings['share_custom_colors'] = '';
714 $settings['share_show_label'] = '';
715 $settings['share_label_bg'] = '';
716 $settings['share_show_icon'] = 'yes';
717 }
718
719 $class = '' === $settings['share_custom_colors'] ? ' king-addons-share-official' : '';
720 $class .= '' === $settings['share_show_label'] ? ' king-addons-share-label-off' : '';
721 $class .= '' === $settings['share_icon_bg_tr'] ? ' king-addons-share-icon-tr' : '';
722 $class .= '' === $settings['share_label_bg'] ? ' king-addons-share-label-tr' : '';
723
724 echo '<div class="king-addons-share-buttons elementor-grid' . esc_attr($class) . '">';
725
726 $count = 0;
727 foreach ($settings['share_buttons'] as $button) {
728 if (!king_addons_freemius()->can_use_premium_code__premium_only() && $count === 3) {
729 break;
730 }
731
732 $share_icon = str_replace('fab ', '', $button['share_icon']);
733 $share_icon = str_replace('fas ', '', $share_icon);
734 $share_icon = str_replace('fa-', '', $share_icon);
735
736 $args = [
737 'icons' => $settings['share_show_icon'],
738 'network' => $share_icon,
739 'labels' => $settings['share_show_label'],
740 'custom_label' => $button['share_custom_label'],
741 'tooltip' => 'no',
742 'url' => esc_url(get_the_permalink()),
743 'title' => esc_html(get_the_title()),
744 'text' => esc_html(get_the_excerpt()),
745 'image' => esc_url(get_the_post_thumbnail_url())
746 ];
747
748 if (isset($button['show_whatsapp_excerpt']) && isset($button['show_whatsapp_title'])) {
749 $args['show_whatsapp_title'] = $button['show_whatsapp_title'];
750 $args['show_whatsapp_excerpt'] = $button['show_whatsapp_excerpt'];
751 }
752
753 echo '<div class="elementor-grid-item">';
754 echo Core::getShareIcon($args); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
755 echo '</div>';
756
757 $count++;
758 }
759
760 echo '</div>';
761 }
762 }