PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 1.8.2
Wp Social Login and Register Social Counter v1.8.2
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 4 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 4 years ago admin-custom-function.php 4 years ago admin-rest-api.php 4 years ago admin-settings.php 4 years ago admin-social-button.php 4 years ago admin-social-enque-script.php 5 years ago counter-widget.php 4 years ago counter.php 4 years ago custom-function.php 4 years ago login-widget.php 4 years ago login.php 5 years ago share-widget.php 4 years ago share.php 4 years ago
share-widget.php
170 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 $before_widget . $before_title . $title . $after_title;
66
67 echo $share->get_share_data( 'all' , $config);
68
69 echo $after_widget;
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 $this->get_field_id( 'title' ); ?>"><?php _e( 'Share Title:', 'wp-social' ); ?></label>
82 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
83 </p>
84
85 <p>
86 <label for="<?php echo $this->get_field_id( 'vertical_effect' ); ?>"><?php _e( 'Layout:' , 'wp-social' ) ?></label>
87 <select class="widefat" id="<?php echo $this->get_field_id( 'vertical_effect' ); ?>" name="<?php echo $this->get_field_name( 'vertical_effect' ); ?>" >
88 <?php
89 foreach($vertical_effect as $k => $v):
90 ?>
91 <option value="<?php echo $k;?>" <?php echo (isset($instance['vertical_effect']) && $instance['vertical_effect'] == $k ) ? 'selected' : ''; ?>> <?php _e($k, 'wp-social'); ?> </option>
92 <?php endforeach;?>
93 </select>
94 </p>
95
96 <p>
97 <label for="<?php echo $this->get_field_id( 'layout' ); ?>"><?php _e( 'Style :' , 'wp-social' ) ?></label>
98 <select class="widefat" id="<?php echo $this->get_field_id( 'layout' ); ?>" name="<?php echo $this->get_field_name( 'layout' ); ?>" >
99 <?php
100 foreach($this->styleArr as $k => $v): ?>
101 <option
102 value="<?php echo (!did_action('wslu_social_pro/plugin_loaded')) && ($v['package'] == 'pro') ? 'wslu-pro-only' : $k;?>"
103 <?php echo ($instance['layout'] == $k ) ? 'selected' : ''; ?>
104 >
105 <?php
106 echo esc_html($v['name']);
107 echo ' ' . esc_html__((!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 $this->hover_effect = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects;
120 ?>
121 <p>
122 <label for="<?php echo $this->get_field_id( 'hover_effect' ); ?>"><?php _e( 'Hover effect :' , 'wp-social' ) ?></label>
123 <select class="widefat" id="<?php echo $this->get_field_id( 'hover_effect' ); ?>" name="<?php echo $this->get_field_name( 'hover_effect' ); ?>" >
124 <?php
125 foreach($this->hover_effect as $k => $v):
126 ?>
127 <option value="<?php echo $k;?>" <?php echo (isset($instance['hover_effect']) && $instance['hover_effect'] == $k ) ? 'selected' : ''; ?>> <?php _e($v['name'], 'wp-social'); ?> </option>
128 <?php endforeach;?>
129 </select>
130 </p>
131
132 <?php
133
134 endif;
135 ?>
136
137 <p>
138 <label for="<?php echo $this->get_field_id( 'show_count' ); ?>"><?php _e( 'Show total count :' , 'wp-social' ) ?></label>
139 <select class="widefat" id="<?php echo $this->get_field_id( 'show_count' ); ?>" name="<?php echo $this->get_field_name( 'show_count' ); ?>" >
140
141 <option value="No" <?php echo (isset($instance['show_count']) && $instance['show_count'] == 'No' ) ? 'selected' : ''; ?>> <?php _e('No', 'wp-social'); ?> </option>
142 <option value="Yes" <?php echo (isset($instance['show_count']) && $instance['show_count'] == 'Yes' ) ? 'selected' : ''; ?>> <?php _e('Yes', 'wp-social'); ?> </option>
143
144 </select>
145 </p>
146
147
148 <p>
149 <label for="<?php echo $this->get_field_id( 'customclass' ); ?>"><?php _e( 'Custom Class :' , 'wp-social' ) ?> </label>
150 <input id="<?php echo $this->get_field_id( 'customclass' ); ?>" name="<?php echo $this->get_field_name( 'customclass' ); ?>" value="<?php echo $instance['customclass']; ?>" class="widefat" type="text" />
151 </p>
152 <?php
153 }
154
155 public function update( $new_instance, $old_instance ) {
156
157 $instance = $old_instance;
158 $instance['layout'] = $new_instance['layout'] ;
159 $instance['title'] = $new_instance['title'] ;
160 $instance['box_only'] = isset($new_instance['box_only']) ? $new_instance['box_only'] : '' ;
161 $instance['customclass'] = $new_instance['customclass'] ;
162 $instance['hover_effect'] = $new_instance['hover_effect'] ;
163 $instance['vertical_effect'] = $new_instance['vertical_effect'] ;
164 $instance['show_count'] = $new_instance['show_count'] ;
165
166 return $instance;
167 }
168 }
169
170