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 / share-widget.php
wp-social / inc Last commit date
elementor 3 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 3 years ago admin-custom-function.php 3 years ago admin-rest-api.php 4 years ago admin-settings.php 3 years ago admin-social-button.php 3 years ago admin-social-enque-script.php 5 years ago counter-widget.php 3 years ago counter.php 3 years ago custom-function.php 4 years ago login-widget.php 3 years ago login.php 5 years ago share-widget.php 3 years ago share.php 3 years ago
share-widget.php
179 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 esc_html_e((!did_action('wslu_social_pro/plugin_loaded')) && ($v['package'] == 'pro') ? ' (Pro Only) ' : ' ', 'wp-social');
108 ?>
109 </option>
110 <?php endforeach;?>
111 </select>
112 </p>
113
114
115 <?php
116
117 if(did_action('wslu_social_pro/plugin_loaded')):
118
119 if( method_exists( \WP_Social_Pro\Inc\Admin_Settings::class, 'share_hover_effects' ) ){
120
121 $this->hover_effect = \WP_Social_Pro\Inc\Admin_Settings::share_hover_effects();
122
123 }else{
124
125 $this->hover_effect = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects;
126
127 }
128
129 ?>
130 <p>
131 <label for="<?php echo esc_attr($this->get_field_id( 'hover_effect' )); ?>"><?php esc_html_e( 'Hover effect :' , 'wp-social' ) ?></label>
132 <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' )); ?>" >
133 <?php
134 foreach($this->hover_effect as $k => $v):
135 ?>
136 <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>
137 <?php endforeach;?>
138 </select>
139 </p>
140
141 <?php
142
143 endif;
144 ?>
145
146 <p>
147 <label for="<?php echo esc_attr($this->get_field_id( 'show_count' )); ?>"><?php esc_html_e( 'Show total count :' , 'wp-social' ) ?></label>
148 <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' )); ?>" >
149
150 <option value="No" <?php echo esc_attr((isset($instance['show_count']) && $instance['show_count'] == 'No' ) ? 'selected' : ''); ?>> <?php esc_html_e('No', 'wp-social'); ?> </option>
151 <option value="Yes" <?php echo esc_attr((isset($instance['show_count']) && $instance['show_count'] == 'Yes' ) ? 'selected' : ''); ?>> <?php esc_html_e('Yes', 'wp-social'); ?> </option>
152
153 </select>
154 </p>
155
156
157 <p>
158 <label for="<?php echo esc_attr($this->get_field_id( 'customclass' )); ?>"><?php esc_html_e( 'Custom Class :' , 'wp-social' ) ?> </label>
159 <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" />
160 </p>
161 <?php
162 }
163
164 public function update( $new_instance, $old_instance ) {
165
166 $instance = $old_instance;
167 $instance['layout'] = $new_instance['layout'] ;
168 $instance['title'] = $new_instance['title'] ;
169 $instance['box_only'] = isset($new_instance['box_only']) ? $new_instance['box_only'] : '' ;
170 $instance['customclass'] = $new_instance['customclass'] ;
171 $instance['hover_effect'] = $new_instance['hover_effect'] ;
172 $instance['vertical_effect'] = $new_instance['vertical_effect'] ;
173 $instance['show_count'] = $new_instance['show_count'] ;
174
175 return $instance;
176 }
177 }
178
179