PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.4
Wp Social Login and Register Social Counter v2.2.4
trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / inc / elementor / widgets / share.php
wp-social / inc / elementor / widgets Last commit date
share.php 3 years ago
share.php
150 lines
1 <?php
2
3 namespace Elementor;
4
5 defined('ABSPATH') || exit;
6
7 use Elementor\Widget_Base;
8 use Elementor\Controls_Manager;
9 use \WP_Social\Inc\Admin_Settings;
10 use \WP_Social\Inc\Share;
11
12
13 class Wps_Share extends Widget_Base {
14
15 public $base;
16
17 public function get_name() {
18 return 'xs-wpsocial-share-button';
19 }
20
21 public function get_title() {
22 return esc_html__( 'Share Button', 'wp-social' );
23 }
24
25 public function get_icon() {
26 return 'eicon-button';
27 }
28
29 public function get_categories() {
30 return ['xs-wpsocial-login'];
31 }
32
33 public function __style(){
34 $styles = Admin_Settings::share_styles();
35
36 $option = [];
37
38 foreach ($styles as $k => $style) {
39 $option[$k] = $style['name'];
40 }
41
42 return $option;
43 }
44
45 public function __share_provider(){
46 $obj = New Share(false);
47
48 $link = $obj->social_share_link();
49 $provider = [];
50 foreach($link as $k=>$v):
51 $provider[$k] = isset($v['label']) ? $v['label'] : '';
52 endforeach;
53
54 return $provider;
55 }
56
57 protected function register_controls() {
58
59 // content of listing
60 $this->start_controls_section(
61 '__social_login_providers',
62 array(
63 'label' => esc_html__( 'Providers', 'wp-social' ),
64 )
65 );
66 $this->add_control(
67 'provider_styles',
68 [
69 'label' => esc_html__( 'Select Providers', 'wp-social' ),
70 'type' => Controls_Manager::SELECT2,
71 'multiple' => true,
72 'options' => $this->__share_provider(),
73 'default' => '',
74 ]
75 );
76 $this->add_control(
77 'select_styles',
78 [
79 'label' => esc_html__( 'Select Style', 'wp-social' ),
80 'type' => Controls_Manager::SELECT,
81 'multiple' => false,
82 'options' => $this->__style(),
83 'default' => '',
84 ]
85 );
86 $this->add_control(
87 'show_count',
88 [
89 'label' => esc_html__( 'Show Share Count', 'wp-social' ),
90 'type' => Controls_Manager::SWITCHER,
91 'label_on' => esc_html__('Yes', 'wp-social'),
92 'label_off' => esc_html__('No', 'wp-social'),
93 'default' => 'yes',
94 ]
95 );
96 $this->add_control(
97 'custom_class',
98 [
99 'label' => esc_html__( 'Custom Class', 'wp-social' ),
100 'type' => Controls_Manager::TEXT,
101 'default' => '',
102 ]
103 );
104
105 $this->end_controls_section();
106
107 $this->start_controls_section(
108 '__social_login_providers_styles',
109 array(
110 'label' => esc_html__( 'Providers', 'wp-social' ),
111 'tab' => Controls_Manager::TAB_STYLE,
112 )
113 );
114 $this->add_group_control(
115 Group_Control_Typography::get_type(), [
116 'name' => '__social_login_providers_typograghy',
117 'selector' => '{{WRAPPER}} .xs_social_share_widget .xs_share_url > li > a .xs-social-icon span',
118 ]
119 );
120 $this->end_controls_section();
121
122
123
124 }
125 // render files
126 protected function render( ) {
127 $settings = $this->get_settings_for_display();
128 extract($settings);
129
130 $provider = 'all';
131 $attr = [
132 'conf_type' => 'widget',
133 'style' => $select_styles,
134 'class' => $custom_class,
135 'show_count' => $show_count,
136 ];
137
138 if(!empty($provider_styles)){
139 $provider = array_values($provider_styles);
140 }
141
142 if( function_exists('__wp_social_share_pro_check') ){
143 if( __wp_social_share_pro_check() ){
144 echo __wp_social_share( $provider, $attr ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- It's already has been escaped from the /template/share/share-html.php
145 }
146 }
147 }
148 }
149
150