PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 3.2.1
Wp Social Login and Register Social Counter v3.2.1
3.2.1 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 / share-widget.php
wp-social / inc Last commit date
elementor 3 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 1 week ago admin-custom-function.php 1 week ago admin-rest-api.php 1 week ago admin-settings.php 2 years ago admin-social-button.php 1 week ago admin-social-enque-script.php 5 years ago counter-widget.php 1 week ago counter.php 1 week ago custom-function.php 5 years ago login-widget.php 3 years ago login.php 5 years ago share-widget.php 1 week ago share.php 1 week ago
share-widget.php
182 lines
1 <?php
2
3 namespace WP_Social\Inc;
4
5 defined('ABSPATH') || exit;
6
7
8 /**
9 * Class Name : xs_social_widget;
10 * Class Details : Create Widget for XS Social Login Plugin
11 *
12 * @params : void
13 * @return : void
14 *
15 * @since : 1.0
16 */
17 class Share_Widget extends \WP_Widget {
18
19 public $styleArr;
20
21
22 public function __construct() {
23
24 $this->styleArr = Admin_Settings::share_styles();
25
26 parent::__construct(
27
28 'Share_Widget',
29
30 __('WSLU Social Share', 'wp-social'),
31
32 array( 'description' => __( 'Wp Social Share System for Facebook, Twitter, Linkedin, Pinterest & 13+ providers.', 'wp-social' ), )
33 );
34 }
35
36 public static function register(){
37 register_widget( 'WP_Social\Inc\Share_Widget' );
38 }
39
40
41 public function widget( $args, $instance ) {
42
43 extract( $args );
44
45 $title = isset($instance['title']) ? $instance['title'] : '';
46 $layout = isset($instance['layout']) ? $instance['layout'] : '';
47 $cusClass = isset($instance['customclass']) ? $instance['customclass'] : '';
48 $hover = isset($instance['hover_effect']) ? $instance['hover_effect'] : '';
49 $isHor = isset($instance['vertical_effect']) ? $instance['vertical_effect'] : '';
50 $showCount = isset($instance['show_count']) && $instance['show_count'] == 'Yes' ? true : false;
51
52 $share = New \WP_Social\Inc\Share(false);
53
54 $config = [];
55 $config['class'] = $cusClass;
56 $config['style'] = $layout;
57 $config['hover'] = $hover;
58 $config['hv_effect'] = $isHor;
59 $config['show_count'] = $showCount;
60 $config['conf_type'] = 'widget';
61
62
63 #AR do not know from where these variables are initiated!
64 #Guessing from arguments
65 echo wp_kses(($before_widget . $before_title . $title . $after_title), \WP_Social\Helper\Helper::get_kses_array());
66
67 echo $share->get_share_data( 'all' , $config); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- It's already has been escaped from the /template/share/share-html.php
68
69 echo wp_kses(($after_widget), \WP_Social\Helper\Helper::get_kses_array());
70 }
71
72
73 public function form( $instance ) {
74
75 $defaults = array( 'title' => __( 'SOCIAL SHARE' , 'wp-social' ) , 'layout' => 'floating' , 'box_only' => false, 'providers' => '', 'customclass' => '');
76 $instance = wp_parse_args( (array) $instance, $defaults );
77 $vertical_effect = \WP_Social\Inc\Admin_Settings::$horizontal_style;
78
79 ?>
80 <p>
81 <label for="<?php echo esc_attr($this->get_field_id( 'title')); ?>"><?php esc_html_e( 'Share Title:', 'wp-social' ); ?></label>
82 <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
83 </p>
84
85 <p>
86 <label for="<?php echo esc_attr($this->get_field_id( 'vertical_effect' )); ?>"><?php esc_html_e( 'Layout:' , 'wp-social' ) ?></label>
87 <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'vertical_effect' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'vertical_effect' )); ?>" >
88 <?php
89 foreach($vertical_effect as $k => $v):
90 ?>
91 <option value="<?php echo esc_attr($k);?>" <?php echo esc_attr((isset($instance['vertical_effect']) && $instance['vertical_effect'] == $k ) ? 'selected' : ''); ?>> <?php esc_html_e($k, 'wp-social'); ?> </option>
92 <?php endforeach;?>
93 </select>
94 </p>
95
96 <p>
97 <label for="<?php echo esc_attr($this->get_field_id( 'layout' )); ?>"><?php esc_html_e( 'Style :' , 'wp-social' ) ?></label>
98 <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'layout' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'layout' )); ?>" >
99 <?php
100 foreach($this->styleArr as $k => $v): ?>
101 <option
102 value="<?php echo esc_attr((!did_action('wslu_social_pro/plugin_loaded')) && ($v['package'] == 'pro') ? 'wslu-pro-only' : $k);?>"
103 <?php echo esc_attr(($instance['layout'] == $k ) ? 'selected' : ''); ?>
104 >
105 <?php
106 echo esc_html($v['name']);
107 if((!did_action('wslu_social_pro/plugin_loaded')) && ($v['package'] == 'pro')) {
108 echo ' ';
109 esc_html_e('(Pro Only)', 'wp-social');
110 }
111 ?>
112 </option>
113 <?php endforeach;?>
114 </select>
115 </p>
116
117
118 <?php
119
120 if(did_action('wslu_social_pro/plugin_loaded')):
121
122 if( method_exists( \WP_Social_Pro\Inc\Admin_Settings::class, 'share_hover_effects' ) ){
123
124 $this->hover_effect = \WP_Social_Pro\Inc\Admin_Settings::share_hover_effects();
125
126 }else{
127
128 $this->hover_effect = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects;
129
130 }
131
132 ?>
133 <p>
134 <label for="<?php echo esc_attr($this->get_field_id( 'hover_effect' )); ?>"><?php esc_html_e( 'Hover effect :' , 'wp-social' ) ?></label>
135 <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'hover_effect' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'hover_effect' )); ?>" >
136 <?php
137 foreach($this->hover_effect as $k => $v):
138 ?>
139 <option value="<?php echo esc_attr($k);?>" <?php echo esc_attr((isset($instance['hover_effect']) && $instance['hover_effect'] == $k ) ? 'selected' : ''); ?>> <?php esc_html_e($v['name'], 'wp-social'); ?> </option>
140 <?php endforeach;?>
141 </select>
142 </p>
143
144 <?php
145
146 endif;
147 ?>
148
149 <p>
150 <label for="<?php echo esc_attr($this->get_field_id( 'show_count' )); ?>"><?php esc_html_e( 'Show total count :' , 'wp-social' ) ?></label>
151 <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'show_count' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'show_count' )); ?>" >
152
153 <option value="No" <?php echo esc_attr((isset($instance['show_count']) && $instance['show_count'] == 'No' ) ? 'selected' : ''); ?>> <?php esc_html_e('No', 'wp-social'); ?> </option>
154 <option value="Yes" <?php echo esc_attr((isset($instance['show_count']) && $instance['show_count'] == 'Yes' ) ? 'selected' : ''); ?>> <?php esc_html_e('Yes', 'wp-social'); ?> </option>
155
156 </select>
157 </p>
158
159
160 <p>
161 <label for="<?php echo esc_attr($this->get_field_id( 'customclass' )); ?>"><?php esc_html_e( 'Custom Class :' , 'wp-social' ) ?> </label>
162 <input id="<?php echo esc_attr($this->get_field_id( 'customclass' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'customclass' )); ?>" value="<?php echo esc_attr($instance['customclass']); ?>" class="widefat" type="text" />
163 </p>
164 <?php
165 }
166
167 public function update( $new_instance, $old_instance ) {
168
169 $instance = $old_instance;
170 $instance['layout'] = $new_instance['layout'] ;
171 $instance['title'] = $new_instance['title'] ;
172 $instance['box_only'] = isset($new_instance['box_only']) ? $new_instance['box_only'] : '' ;
173 $instance['customclass'] = $new_instance['customclass'] ;
174 $instance['hover_effect'] = $new_instance['hover_effect'] ;
175 $instance['vertical_effect'] = $new_instance['vertical_effect'] ;
176 $instance['show_count'] = $new_instance['show_count'] ;
177
178 return $instance;
179 }
180 }
181
182