Hupso Share Buttons for Twitter, Facebook & Google+ - Version 3.0

Version Description

  • New button type: Counters (support for Facebook Like, Facebook Send, Twitter Tweet, Google +1, Linkedin Share)
  • Featured post image (post thumbnail) is now used as Facebook thumbnail when sharing to Facebook
  • Fix for empty excerpts
Download this release

Release Info

Developer kasal
Plugin Icon 128x128 Hupso Share Buttons for Twitter, Facebook & Google+
Version 3.0
Comparing to
See all releases

Code changes from version 2.3 to 3.0

img/counters.png ADDED
Binary file
img/counters/facebook_like.png ADDED
Binary file
img/counters/facebook_send.png ADDED
Binary file
img/counters/google_plus_one.png ADDED
Binary file
img/counters/linkedin_share.png ADDED
Binary file
img/counters/twitter_tweet.png ADDED
Binary file
js/create_button.js CHANGED
@@ -42,6 +42,8 @@ function hupso_create_code() {
42
  $( "#show_icons" ).show();
43
  $( "#show_title" ).show();
44
  $( "#show_color" ).show();
 
 
45
  break;
46
  case 'share_toolbar':
47
  $( "#button_position" ).hide();
@@ -52,6 +54,8 @@ function hupso_create_code() {
52
  $( "#show_icons" ).hide();
53
  $( "#show_title" ).show();
54
  $( "#show_color" ).hide();
 
 
55
  break;
56
  case 'floating_toolbar':
57
  $( "#button_position" ).show();
@@ -62,9 +66,25 @@ function hupso_create_code() {
62
  $( "#show_icons" ).show();
63
  $( "#show_title" ).show();
64
  $( "#show_color" ).show();
 
 
65
  break;
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
 
 
68
  button_position = $("input:radio[name=button_position]:checked").val();
69
  toolbar_size = $("input:radio[name=select_toolbar_size]:checked").val();
70
  icon_type = $("input:radio[name=menu_type]:checked").val();
@@ -91,35 +111,84 @@ function hupso_create_code() {
91
  case 'share_toolbar':
92
  hupso_services = '<script type="text/javascript">var hupso_services_t=new Array(';
93
  break;
 
 
 
94
  }
95
-
96
- if ( $( "input:checkbox[name=twitter]:checked" ).val() == 1 )
97
- hupso_services += '"Twitter",';
98
- if ( $( "input:checkbox[name=facebook]:checked" ).val() == 1 )
99
- hupso_services += '"Facebook",';
100
- if ( $( "input:checkbox[name=googleplus]:checked" ).val() == 1 )
101
- hupso_services += '"Google Plus",';
102
- if ( $( "input:checkbox[name=linkedin]:checked" ).val() == 1 )
103
- hupso_services += '"Linkedin",';
104
- if ( $( "input:checkbox[name=stumbleupon]:checked" ).val() == 1 )
105
- hupso_services += '"StumbleUpon",';
106
- if ( $( "input:checkbox[name=digg]:checked" ).val() == 1 )
107
- hupso_services += '"Digg",';
108
- if ( $( "input:checkbox[name=reddit]:checked" ).val() == 1 )
109
- hupso_services += '"Reddit",';
110
- if ( $( "input:checkbox[name=bebo]:checked" ).val() == 1 )
111
- hupso_services += '"Bebo",';
112
- if ( $( "input:checkbox[name=delicious]:checked" ).val() == 1 )
113
- hupso_services += '"Delicious",';
 
 
 
 
 
 
 
 
 
 
114
 
115
- var none = hupso_services.substring(hupso_services.length - 1, hupso_services.length);
116
- hupso_services = hupso_services.substring(0, hupso_services.length - 1);
117
- if ( none != ',' ) {
118
- hupso_services += '();';
119
- } else {
 
 
 
120
  hupso_services += ');';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
 
123
  switch ( button_type ) {
124
  case 'share_button':
125
  hupso_services += 'var hupso_icon_type = "'+icon_type+'";';
@@ -143,6 +212,9 @@ function hupso_create_code() {
143
  case 'share_toolbar':
144
  hupso_services += 'var hupso_url_t="'+encodeURI(hupso_url)+'";';
145
  break;
 
 
 
146
  }
147
 
148
  }
@@ -158,6 +230,9 @@ function hupso_create_code() {
158
  case 'share_toolbar':
159
  hupso_services += 'var hupso_title_t="'+encodeURI(hupso_title)+'";';
160
  break;
 
 
 
161
  }
162
 
163
  }
@@ -228,7 +303,11 @@ function hupso_create_code() {
228
  toolbar_share = 'share-small';
229
  break;
230
  }
231
-
 
 
 
 
232
  }
233
 
234
  var code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
@@ -241,6 +320,9 @@ function hupso_create_code() {
241
  case 'share_toolbar':
242
  code += '<img src="http://static.hupso.com/share/buttons/'+toolbar_share+'.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/>';
243
  break;
 
 
 
244
  }
245
 
246
 
@@ -263,7 +345,13 @@ function hupso_create_code() {
263
  }
264
 
265
  // update preview
266
- $( "#button" ).html(code);
 
 
 
 
 
 
267
 
268
  });
269
  }
42
  $( "#show_icons" ).show();
43
  $( "#show_title" ).show();
44
  $( "#show_color" ).show();
45
+ $( "#counters_config" ).hide();
46
+ $( "#services" ).show();
47
  break;
48
  case 'share_toolbar':
49
  $( "#button_position" ).hide();
54
  $( "#show_icons" ).hide();
55
  $( "#show_title" ).show();
56
  $( "#show_color" ).hide();
57
+ $( "#counters_config" ).hide();
58
+ $( "#services" ).show();
59
  break;
60
  case 'floating_toolbar':
61
  $( "#button_position" ).show();
66
  $( "#show_icons" ).show();
67
  $( "#show_title" ).show();
68
  $( "#show_color" ).show();
69
+ $( "#counters_config" ).hide();
70
+ $( "#services" ).show();
71
  break;
72
+ case 'counters':
73
+ $( "#button_position" ).hide();
74
+ $( "#button_style" ).hide();
75
+ $( "#toolbar_size" ).hide();
76
+ $( "#button_preview" ).show();
77
+ $( "#move_mouse" ).hide();
78
+ $( "#show_icons" ).hide();
79
+ $( "#show_title" ).show();
80
+ $( "#show_color" ).hide();
81
+ $( "#counters_config" ).show();
82
+ $( "#services" ).hide();
83
+ break;
84
  }
85
 
86
+ counters_preview = '<img src="http://static.hupso.com/share/buttons/share-small.png"/>';
87
+
88
  button_position = $("input:radio[name=button_position]:checked").val();
89
  toolbar_size = $("input:radio[name=select_toolbar_size]:checked").val();
90
  icon_type = $("input:radio[name=menu_type]:checked").val();
111
  case 'share_toolbar':
112
  hupso_services = '<script type="text/javascript">var hupso_services_t=new Array(';
113
  break;
114
+ case 'counters':
115
+ hupso_services = '<script type="text/javascript">var hupso_services_c=new Array(';
116
+ break;
117
  }
118
+
119
+
120
+ if ( button_type == 'counters' ) {
121
+
122
+ // twitter
123
+ var twitter_tweet = $("input:checkbox[name=twitter_tweet]:checked").val();
124
+ if (twitter_tweet == 1) {
125
+ hupso_services += '"twitter"';
126
+ counters_preview += '<img src="http://static.hupso.com/share/img/counters/twitter_tweet.png" />';
127
+ }
128
+
129
+ // facebook
130
+ var facebook_like = $("input:checkbox[name=facebook_like]:checked").val();
131
+ var facebook_send = $("input:checkbox[name=facebook_send]:checked").val();
132
+ if (facebook_like == 1) {
133
+ hupso_services += '"facebook_like"';
134
+ counters_preview += '<span style="padding-left:20px;"><img src="http://static.hupso.com/share/img/counters/facebook_like.png" /></span>';
135
+ if (facebook_send == 1) {
136
+ hupso_services += '"facebook_send"';
137
+ counters_preview += ' <img src="http://static.hupso.com/share/img/counters/facebook_send.png" />';
138
+ }
139
+ }
140
+
141
+ // google +1
142
+ var google_plus_one = $("input:checkbox[name=google_plus_one]:checked").val();
143
+ if (google_plus_one == 1) {
144
+ hupso_services += '"google"';
145
+ counters_preview += '<span style="padding-left:20px;"><img src="http://static.hupso.com/share/img/counters/google_plus_one.png" /></span>';
146
+ }
147
 
148
+ // linkedin
149
+ var linkedin_share = $("input:checkbox[name=linkedin_share]:checked").val();
150
+ if (linkedin_share == 1) {
151
+ hupso_services += '"linkedin"';
152
+ counters_preview += '<span style="padding-left:20px;"><img src="http://static.hupso.com/share/img/counters/linkedin_share.png" /></span>';
153
+ }
154
+
155
+ hupso_services = hupso_services.replace(/""/gi, '","');
156
  hupso_services += ');';
157
+
158
+ }
159
+
160
+ else {
161
+
162
+ if ( $( "input:checkbox[name=twitter]:checked" ).val() == 1 )
163
+ hupso_services += '"Twitter",';
164
+ if ( $( "input:checkbox[name=facebook]:checked" ).val() == 1 )
165
+ hupso_services += '"Facebook",';
166
+ if ( $( "input:checkbox[name=googleplus]:checked" ).val() == 1 )
167
+ hupso_services += '"Google Plus",';
168
+ if ( $( "input:checkbox[name=linkedin]:checked" ).val() == 1 )
169
+ hupso_services += '"Linkedin",';
170
+ if ( $( "input:checkbox[name=stumbleupon]:checked" ).val() == 1 )
171
+ hupso_services += '"StumbleUpon",';
172
+ if ( $( "input:checkbox[name=digg]:checked" ).val() == 1 )
173
+ hupso_services += '"Digg",';
174
+ if ( $( "input:checkbox[name=reddit]:checked" ).val() == 1 )
175
+ hupso_services += '"Reddit",';
176
+ if ( $( "input:checkbox[name=bebo]:checked" ).val() == 1 )
177
+ hupso_services += '"Bebo",';
178
+ if ( $( "input:checkbox[name=delicious]:checked" ).val() == 1 )
179
+ hupso_services += '"Delicious",';
180
+
181
+
182
+ var none = hupso_services.substring(hupso_services.length - 1, hupso_services.length);
183
+ hupso_services = hupso_services.substring(0, hupso_services.length - 1);
184
+ if ( none != ',' ) {
185
+ hupso_services += '();';
186
+ } else {
187
+ hupso_services += ');';
188
+ }
189
  }
190
 
191
+
192
  switch ( button_type ) {
193
  case 'share_button':
194
  hupso_services += 'var hupso_icon_type = "'+icon_type+'";';
212
  case 'share_toolbar':
213
  hupso_services += 'var hupso_url_t="'+encodeURI(hupso_url)+'";';
214
  break;
215
+ case 'counters':
216
+ hupso_services += 'var hupso_url_c="'+encodeURI(hupso_url)+'";';
217
+ break;
218
  }
219
 
220
  }
230
  case 'share_toolbar':
231
  hupso_services += 'var hupso_title_t="'+encodeURI(hupso_title)+'";';
232
  break;
233
+ case 'counters':
234
+ hupso_services += 'var hupso_title_c="'+encodeURI(hupso_title)+'";';
235
+ break;
236
  }
237
 
238
  }
303
  toolbar_share = 'share-small';
304
  break;
305
  }
306
+ }
307
+
308
+ if (button_type == 'counters') {
309
+ hupso_class = 'hupso_counters';
310
+ hupso_js = 'counters.js';
311
  }
312
 
313
  var code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
320
  case 'share_toolbar':
321
  code += '<img src="http://static.hupso.com/share/buttons/'+toolbar_share+'.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/>';
322
  break;
323
+ case 'counters':
324
+ code += '<img src="http://static.hupso.com/share/buttons/share-small.png" border="0" style="padding-top:2px; float:left;" alt="Social Share Counters"/>';
325
+ break;
326
  }
327
 
328
 
345
  }
346
 
347
  // update preview
348
+ if ( button_type == 'counters') {
349
+ $( "#button" ).html(counters_preview);
350
+ }
351
+ else {
352
+ $( "#button" ).html(code);
353
+ }
354
+
355
 
356
  });
357
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.hupso.com/
4
  Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
5
  Requires at least: 2.8
6
  Tested up to: 3.4
7
- Stable tag: 2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -20,9 +20,12 @@ Main features / advantages:
20
 
21
  * Slick, minimalistic design.
22
  * Very small and fast. The code for sharing button is very small (only a few KB), so share buttons will not slow down your website - even on devices with slow network connections.
23
- * All major social networks are supported.
24
- * Real-time button preview in admin settings
25
- * Support for right-to-left (RTL) scripts/languages (Arabic, Persian, Urdu, Hebrew, Yiddish, Syriac, Thaana/Dhivehi, N'Ko, Chinese, Japanese)
 
 
 
26
 
27
  Share Buttons are very easy to configure. Just select button type, size, position and which social networking services do you want to offer to your visitors.
28
  Button will apear below your articles or on top of them as you choose.
@@ -50,18 +53,18 @@ All major social networks are supported: Twitter, Facebook, Google+, Linkedin, S
50
  = What settings are available? =
51
 
52
  From Settings screen you are able to choose:
53
- * button type (share button, share toolbar)
54
  * button size
55
  * social sharing services
56
  * menu type
57
  * button position (above or below your posts)
58
- * display options (options to hide buttons on frontpage and in categories)
59
 
60
  Please look at *Screenshots* for more information.
61
 
62
  = Are share buttons using Javascript? =
63
 
64
- Yes. Javascript is required for sharing buttons to function properly and it must be enabled. Menu/toolbar interface for share buttons is loaded at run-time from our servers so we can add minor enhancements and fix browser bugs the moment they are discovered without forcing you to upgrade the plugin all the time. Button images are loaded from your local Wordpress installation.
65
 
66
  = Are share buttons free? =
67
 
@@ -69,20 +72,34 @@ Yes. Thay are free and will always be free. And you do not need to open any acco
69
 
70
  = When will floating toolbars be available? =
71
 
72
- [Hupso Share Buttons](http://www.hupso.com/share/) provide other button types icluding flaoting toolbars. We plan to implement those in next versions of this plugin.
 
 
 
 
 
 
 
 
73
 
74
 
75
  == Screenshots ==
76
 
77
- 1. Share Toolbar and Share Button on the same page (demo)
78
- 2. Share Toolbar (big)
79
- 2. Share Buttons with drop down menu (icons and service names)
80
- 3. Share Buttons with drop down menu (icons only)
81
- 4. Settings in Wordpress Administration (with real-time button preview)
 
82
 
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
86
  = 2.3 =
87
  * Fixed diplay of excerpts (post summaries)
88
 
4
  Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
5
  Requires at least: 2.8
6
  Tested up to: 3.4
7
+ Stable tag: 3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
20
 
21
  * Slick, minimalistic design.
22
  * Very small and fast. The code for sharing button is very small (only a few KB), so share buttons will not slow down your website - even on devices with slow network connections.
23
+ * All major social networks are supported: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo, Delicious.
24
+ * Social media counters: Twitter Tweet, Facebook Like, Google +1, Linkedin Share.
25
+ * Compatible with all major web browsers: Firefox, Chrome, Internet Explorer, Safari, Opera.
26
+ * Share toolbar works with desktop and mobile devices (mobile phones and tablets). Tested with PC, Apple iOS / iPhone / iPad and Google Android devices.
27
+ * Real-time button preview in admin settings.
28
+ * Support for right-to-left (RTL) scripts/languages (Arabic, Persian, Urdu, Hebrew, Yiddish, Syriac, Thaana/Dhivehi, N'Ko, Chinese, Japanese).
29
 
30
  Share Buttons are very easy to configure. Just select button type, size, position and which social networking services do you want to offer to your visitors.
31
  Button will apear below your articles or on top of them as you choose.
53
  = What settings are available? =
54
 
55
  From Settings screen you are able to choose:
56
+ * button type (share button, share toolbar, counters)
57
  * button size
58
  * social sharing services
59
  * menu type
60
  * button position (above or below your posts)
61
+ * display options
62
 
63
  Please look at *Screenshots* for more information.
64
 
65
  = Are share buttons using Javascript? =
66
 
67
+ Yes. Javascript is required for sharing buttons to function properly and it must be enabled. Menu/toolbar/preview interface for share buttons is loaded at run-time from our servers so we can add minor enhancements and fix browser bugs the moment they are discovered without forcing you to upgrade the plugin all the time. Some button images are loaded from your local Wordpress installation and some from our servers. Counters load javascript code from Twitter, Facebook, Google and Linkedin.
68
 
69
  = Are share buttons free? =
70
 
72
 
73
  = When will floating toolbars be available? =
74
 
75
+ [Hupso Share Buttons](http://www.hupso.com/share/) provide other button types including floating toolbars. We plan to implement those in next versions of this plugin.
76
+
77
+ = Why is featured post image not used as thumbnail with Facebook on new posts? =
78
+
79
+ Please wait up to 24 hours for Facebook to fetch the new thumbnail. After that it should work.
80
+
81
+ = Found a bug? Have a suggestion? =
82
+
83
+ Please send bug reports and suggestion using [this feedback form](http://www.hupso.com/share/feedback/).
84
 
85
 
86
  == Screenshots ==
87
 
88
+ 1. Share Toolbar and Counters on the same page (demo)
89
+ 2. Counters (Twitter Tweet, Facebook Like, Google +1, Linkedin Share)
90
+ 3. Share Toolbar (big)
91
+ 4. Share Buttons with drop down menu (icons and service names)
92
+ 5. Share Buttons with drop down menu (icons only)
93
+ 6. Settings in Wordpress Administration (with real-time button preview)
94
 
95
 
96
  == Changelog ==
97
 
98
+ = 3.0 =
99
+ * New button type: Counters (support for Facebook Like, Facebook Send, Twitter Tweet, Google +1, Linkedin Share)
100
+ * Featured post image (post thumbnail) is now used as Facebook thumbnail when sharing to Facebook
101
+ * Fix for empty excerpts
102
+
103
  = 2.3 =
104
  * Fixed diplay of excerpts (post summaries)
105
 
share-buttons-hupso.php CHANGED
@@ -1,23 +1,22 @@
1
  <?php
2
  /*
3
  Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
4
- Plugin URI: http://www.hupso.com/share
5
  Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
6
- Version: 2.3
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
 
 
12
 
13
-
14
- $hupso_excerpt = false;
15
- $hupso_code = '';
16
 
17
  $hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
18
  add_filter( 'the_content', 'hupso_the_content', 10 );
19
  add_filter( 'get_the_excerpt', 'hupso_get_the_excerpt', 1);
20
- add_filter( 'the_excerpt', 'hupso_the_excerpt', 100 );
21
 
22
  load_plugin_textdomain( 'share_buttons_hupso', false, dirname( __FILE__ ) . '/languages' );
23
 
@@ -27,6 +26,8 @@ if ( is_admin() ) {
27
  }
28
 
29
  add_action( 'admin_head', 'hupso_admin_head' );
 
 
30
 
31
  $all_services = array(
32
  'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
@@ -49,17 +50,19 @@ function hupso_admin_head() {
49
  }
50
  }
51
 
52
- function hupso_get_the_excerpt($param) {
53
- global $hupso_excerpt;
54
- $hupso_excerpt = true;
 
 
 
 
 
55
  }
56
 
57
- function hupso_the_excerpt() {
58
- global $hupso_code;
59
-
60
- if ( $hupso_code != '' ) {
61
- echo $hupso_code;
62
- }
63
  }
64
 
65
  function hupso_admin_settings_show() {
@@ -70,18 +73,27 @@ function hupso_admin_settings_show() {
70
  }
71
 
72
  /* save settings */
73
- if ( $_POST[ 'size' ] != '' ) {
74
  hupso_admin_settings_save();
75
  }
76
 
77
  echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
78
  echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)').'</h2>';
79
  echo '<form name="hupso_settings_form" method="post" action="">';
80
- echo '<div id="button_preview" style="float:right; width:405px; padding: 10px 10px 10px 10px; margin-right:10px; margin-left:20px; margin-top:20px; background: #F7FFBF;"><h3>Preview:</h3><br/>';
 
 
81
  echo '<div id="button"></div>';
82
  echo '<div id="move_mouse"><p style="font-size:13px; padding-top: 15px;"><b>Move your mouse over the button to see the sharing menu.</b></p></div><br/><br/>';
83
- //echo '<input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings') . '" />';
84
- echo '</div>';
 
 
 
 
 
 
 
85
 
86
  $start = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
87
  $end = '<!-- Hupso Share Buttons -->';
@@ -123,14 +135,16 @@ function hupso_admin_settings_show() {
123
  switch ( $hupso_button_type ) {
124
  case 'share_button': $hupso_share_button_checked = $checked; break;
125
  case 'share_toolbar': $hupso_share_toolbar_checked = $checked; break;
 
126
  default: $hupso_share_toolbar_checked = $checked;
127
  }
128
  ?>
129
  <td><input type="radio" name="button_type" onclick="hupso_create_code()" value="share_button" <?php echo $hupso_share_button_checked; ?> /> Share Button <br/><img src="<?php echo $hupso_plugin_url.'/buttons/button100x23.png';?>" /><br/><br/>
130
- <input type="radio" name="button_type" onclick="hupso_create_code()" value="share_toolbar" <?php echo $hupso_share_toolbar_checked; ?> /> Share Toolbar<br/><img src="<?php echo $hupso_plugin_url.'/img/share_toolbar_short.png';?>" />
 
131
  </td>
132
  </tr>
133
- <tr><td></td><td><hr style="height:1px; width:200px;"/></td></tr>
134
  </table>
135
  </div>
136
 
@@ -173,15 +187,70 @@ function hupso_admin_settings_show() {
173
  </table>
174
  </div>
175
 
176
-
177
-
178
  <table border="0">
179
  <tr>
180
  <td style="width:100px;"><?php _e('Social networks'); ?></td>
181
  <td><hr style="height:1px; width:200px;"/><?php hupso_settings_print_services(); ?></td>
182
  </tr>
183
  </table>
184
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  <div id="show_icons">
186
  <table border="0">
187
  <tr>
@@ -253,7 +322,7 @@ function hupso_admin_settings_save() {
253
  global $all_services, $default_services, $hupso_plugin_url;
254
  update_option( 'hupso_custom', '1' );
255
 
256
- if ( $_POST[ 'size' ] != '' )
257
  $post = true;
258
  else
259
  $post = false;
@@ -268,7 +337,7 @@ function hupso_admin_settings_save() {
268
 
269
  /* save button size */
270
  if ( $post ) {
271
- $hupso_button_size = $_POST[ 'size' ];
272
  update_option( 'hupso_button_size', $hupso_button_size );
273
  } else {
274
  $hupso_button_size = get_option ( 'hupso_button_size', 'button100x23');
@@ -331,6 +400,24 @@ function hupso_admin_settings_save() {
331
  update_option( 'hupso_show_category', $hupso_show_category );
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  /* save button code */
335
  if ( $post ) {
336
  $code = stripslashes($_POST[ 'code' ]);
@@ -342,7 +429,7 @@ function hupso_admin_settings_save() {
342
 
343
  function hupso_the_content( $content ) {
344
 
345
- global $hupso_plugin_url, $wp_version, $hupso_excerpt, $hupso_code;
346
 
347
  /* Do not show share buttons in feeds */
348
  if ( is_feed() ) {
@@ -365,7 +452,7 @@ function hupso_the_content( $content ) {
365
 
366
 
367
  /* default code */
368
- $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="http://static.hupso.com/share/buttons/share-medium.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/></a><script type="text/javascript">var hupso_services_t=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon","Digg","Reddit","Bebo","Delicious"); var hupso_toolbar_size_t="medium";';
369
 
370
  $code = get_option( 'hupso_share_buttons_code', $share_code );
371
  $button_type = get_option( 'hupso_button_type', 'share_toolbar' );
@@ -417,6 +504,9 @@ function hupso_the_content( $content ) {
417
  case 'share_toolbar':
418
  $code .= 'var hupso_url_t="' . $post_url . '";';
419
  break;
 
 
 
420
  }
421
 
422
  }
@@ -430,37 +520,23 @@ function hupso_the_content( $content ) {
430
  case 'share_toolbar':
431
  $js_file = 'share_toolbar.js';
432
  break;
 
 
 
433
  }
434
 
435
- $static_server = 'http://static.hupso.com/share/js/' . $js_file;
436
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
437
 
438
  $position = get_option( 'hupso_button_position', 'below' );
439
 
440
- $excerpt = $GLOBALS['post']->post_excerpt;
441
-
442
- if ( $position == 'below' ) {
443
- $new_content = $content . $code;
 
 
444
 
445
- if ( $excerpt != '' ) {
446
- $new_excerpt = '<p>' . $excerpt . '</p>' . $code;
447
- }
448
- else {
449
- $new_excerpt = $code;
450
- }
451
- }
452
- else {
453
- $new_content = $code . '<br/>' . $content;
454
- $new_excerpt = $code . '<br/>' . $excerpt;
455
- }
456
-
457
- if ( $hupso_excerpt ) {
458
- $hupso_code = $new_excerpt;
459
- return $content;
460
- }
461
- else {
462
- return $new_content;
463
- }
464
  }
465
 
466
  function hupso_settings_print_services() {
1
  <?php
2
  /*
3
  Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
4
+ Plugin URI: http://www.hupso.com/share/
5
  Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
6
+ Version: 3.0
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
 
12
+ $hupso_dev = '';
13
 
14
+ $share_image = __('Share');
 
 
15
 
16
  $hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
17
  add_filter( 'the_content', 'hupso_the_content', 10 );
18
  add_filter( 'get_the_excerpt', 'hupso_get_the_excerpt', 1);
19
+ add_filter( 'the_excerpt', 'hupso_the_content', 100 );
20
 
21
  load_plugin_textdomain( 'share_buttons_hupso', false, dirname( __FILE__ ) . '/languages' );
22
 
26
  }
27
 
28
  add_action( 'admin_head', 'hupso_admin_head' );
29
+ add_action( 'wp_head', 'hupso_set_facebook_thumbnail', 1 );
30
+
31
 
32
  $all_services = array(
33
  'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
50
  }
51
  }
52
 
53
+ function hupso_set_facebook_thumbnail() {
54
+ global $post;
55
+ if ( !is_singular() )
56
+ return;
57
+ if ( ( function_exists('has_post_thumbnail') ) && ( has_post_thumbnail( $post->ID ) ) ) {
58
+ $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
59
+ echo '<meta property="og:image" content="' . esc_attr( $thumb_image[0] ) . '"/>';
60
+ }
61
  }
62
 
63
+ function hupso_get_the_excerpt($content) {
64
+ remove_filter('the_content', 'hupso_the_content');
65
+ return $content;
 
 
 
66
  }
67
 
68
  function hupso_admin_settings_show() {
73
  }
74
 
75
  /* save settings */
76
+ if ( $_POST[ 'button_type' ] != '' ) {
77
  hupso_admin_settings_save();
78
  }
79
 
80
  echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
81
  echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)').'</h2>';
82
  echo '<form name="hupso_settings_form" method="post" action="">';
83
+
84
+ echo '<div id="right" style="float:right; width:200px; margin-right:10px; margin-left:20px; margin-top:20px;">';
85
+ echo '<div id="button_preview" style="background: #F7FFBF; padding: 10px 10px 10px 10px; "><h3>Preview:</h3><br/>';
86
  echo '<div id="button"></div>';
87
  echo '<div id="move_mouse"><p style="font-size:13px; padding-top: 15px;"><b>Move your mouse over the button to see the sharing menu.</b></p></div><br/><br/>';
88
+ echo '<div style="padding-left:40px;"><input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings') . '" /></div>';
89
+ echo '</div>';
90
+ echo '<div id="feedback" style="background: #C7FFA3; padding: 10px 10px 10px 10px; margin-top:50px; ">';
91
+ echo '<p><b>Bugs? Comments?</b></p>';
92
+ echo '<p>We value your feedback. Please send comments, bug reports and suggestions, so we can make this plugin the best social sharing plugin for Wordpress.</p>';
93
+ echo '<p><a href="http://www.hupso.com/share/feedback/" target="_blank">Use this form</a> (opens in new window).</p>';
94
+ echo '</div>';
95
+ echo '</div>';
96
+
97
 
98
  $start = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
99
  $end = '<!-- Hupso Share Buttons -->';
135
  switch ( $hupso_button_type ) {
136
  case 'share_button': $hupso_share_button_checked = $checked; break;
137
  case 'share_toolbar': $hupso_share_toolbar_checked = $checked; break;
138
+ case 'counters': $hupso_share_counters_checked = $checked; break;
139
  default: $hupso_share_toolbar_checked = $checked;
140
  }
141
  ?>
142
  <td><input type="radio" name="button_type" onclick="hupso_create_code()" value="share_button" <?php echo $hupso_share_button_checked; ?> /> Share Button <br/><img src="<?php echo $hupso_plugin_url.'/buttons/button100x23.png';?>" /><br/><br/>
143
+ <input type="radio" name="button_type" onclick="hupso_create_code()" value="share_toolbar" <?php echo $hupso_share_toolbar_checked; ?> /> Share Toolbar <br/><img src="<?php echo $hupso_plugin_url.'/img/share_toolbar_short.png';?>" /><br/><br/>
144
+ <input type="radio" name="button_type" onclick="hupso_create_code()" value="counters" <?php echo $hupso_share_counters_checked; ?> /> Counters <br/><img src="<?php echo $hupso_plugin_url.'/img/counters.png';?>" /><br/><br/>
145
  </td>
146
  </tr>
147
+ <tr><td></td><td><hr style="height:1px; width:100%;"/></td></tr>
148
  </table>
149
  </div>
150
 
187
  </table>
188
  </div>
189
 
190
+ <div id="services">
 
191
  <table border="0">
192
  <tr>
193
  <td style="width:100px;"><?php _e('Social networks'); ?></td>
194
  <td><hr style="height:1px; width:200px;"/><?php hupso_settings_print_services(); ?></td>
195
  </tr>
196
  </table>
197
+ </div>
198
+ <?php
199
+ $checked = ' checked="checked" ';
200
+
201
+ $twitter_tweet = get_option( 'hupso_twitter_tweet', '1' );
202
+ if ( $twitter_tweet == 1 ) $twitter_tweet_checked = $checked;
203
+
204
+ $facebook_like = get_option( 'hupso_facebook_like', '1' );
205
+ if ( $facebook_like == 1 ) $facebook_like_checked = $checked;
206
+
207
+ $facebook_send = get_option( 'hupso_facebook_send', '1' );
208
+ if ( $facebook_send == 1 ) $facebook_send_checked = $checked;
209
+
210
+ $google_plus_one = get_option( 'hupso_google_plus_one', '1' );
211
+ if ( $google_plus_one == 1 ) $google_plus_one_checked = $checked;
212
+
213
+ $linkedin_share = get_option( 'hupso_linkedin_share', '1' );
214
+ if ( $linkedin_share == 1 ) $linkedin_share_checked = $checked;
215
+ ?>
216
+ <div id="counters_config" style="display:none;">
217
+ <table border="0">
218
+ <tr>
219
+ <td style="width:100px;"><?php _e('Social networks'); ?></td>
220
+ <td>
221
+ <table>
222
+ <tr>
223
+ <td><input type="checkbox" name="twitter_tweet" onclick="hupso_create_code()" value="1" <?php echo $twitter_tweet_checked;?> /></td>
224
+ <td><img src="<?php echo $hupso_plugin_url; ?>/img/counters/twitter_tweet.png" /></td>
225
+ <td></td>
226
+ </tr>
227
+ <tr>
228
+ <td><input type="checkbox" name="facebook_like" onclicke="hupso_create_code()" value="1" <?php echo $facebook_like_checked;?> /></td>
229
+ <td><img src="<?php echo $hupso_plugin_url; ?>/img/counters/facebook_like.png" /></td>
230
+ <td>
231
+ <table>
232
+ <tr>
233
+ <td><input type="checkbox" name="facebook_send" onclick="hupso_create_code()" value="1" <?php echo $facebook_send_checked;?> /></td>
234
+ <td><img src="<?php echo $hupso_plugin_url; ?>/img/counters/facebook_send.png" /></td>
235
+ </tr>
236
+ </table>
237
+ </tr>
238
+ <tr>
239
+ <td><input type="checkbox" name="google_plus_one" onclick="hupso_create_code()" value="1" <?php echo $google_plus_one_checked;?> /></td>
240
+ <td><img src="<?php echo $hupso_plugin_url; ?>/img/counters/google_plus_one.png" /></td>
241
+ <td></td>
242
+ </tr>
243
+ <tr>
244
+ <td><input type="checkbox" name="linkedin_share" onclick="hupso_create_code()" value="1" <?php echo $linkedin_share_checked;?> /></td>
245
+ <td><img src="<?php echo $hupso_plugin_url; ?>/img/counters/linkedin_share.png" /></td>
246
+ <td></td>
247
+ </tr>
248
+ </table>
249
+
250
+ </td>
251
+ </tr>
252
+ </table>
253
+ </div>
254
  <div id="show_icons">
255
  <table border="0">
256
  <tr>
322
  global $all_services, $default_services, $hupso_plugin_url;
323
  update_option( 'hupso_custom', '1' );
324
 
325
+ if ( $_POST[ 'button_type' ] != '' )
326
  $post = true;
327
  else
328
  $post = false;
337
 
338
  /* save button size */
339
  if ( $post ) {
340
+ $hupso_button_size = $_POST[ 'button_type' ];
341
  update_option( 'hupso_button_size', $hupso_button_size );
342
  } else {
343
  $hupso_button_size = get_option ( 'hupso_button_size', 'button100x23');
400
  update_option( 'hupso_show_category', $hupso_show_category );
401
  }
402
 
403
+ /* save options for counters */
404
+ if ( $post ) {
405
+ $twitter_tweet = $_POST[ 'twitter_tweet' ];
406
+ update_option( 'hupso_twitter_tweet', $twitter_tweet );
407
+
408
+ $facebook_like = $_POST[ 'facebook_like' ];
409
+ update_option( 'hupso_facebook_like', $facebook_like );
410
+
411
+ $facebook_send = $_POST[ 'facebook_send' ];
412
+ update_option( 'hupso_facebook_send', $facebook_send );
413
+
414
+ $google_plus_one = $_POST[ 'google_plus_one' ];
415
+ update_option( 'hupso_google_plus_one', $google_plus_one );
416
+
417
+ $linkedin_share = $_POST[ 'linkedin_share' ];
418
+ update_option( 'hupso_linkedin_share', $linkedin_share );
419
+ }
420
+
421
  /* save button code */
422
  if ( $post ) {
423
  $code = stripslashes($_POST[ 'code' ]);
429
 
430
  function hupso_the_content( $content ) {
431
 
432
+ global $hupso_plugin_url, $wp_version, $hupso_dev;
433
 
434
  /* Do not show share buttons in feeds */
435
  if ( is_feed() ) {
452
 
453
 
454
  /* default code */
455
+ $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="http://static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/></a><script type="text/javascript">var hupso_services_t=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon","Digg","Reddit","Bebo","Delicious"); var hupso_toolbar_size_t="medium";';
456
 
457
  $code = get_option( 'hupso_share_buttons_code', $share_code );
458
  $button_type = get_option( 'hupso_button_type', 'share_toolbar' );
504
  case 'share_toolbar':
505
  $code .= 'var hupso_url_t="' . $post_url . '";';
506
  break;
507
+ case 'counters':
508
+ $code .= 'var hupso_url_c="' . $post_url . '";';
509
+ break;
510
  }
511
 
512
  }
520
  case 'share_toolbar':
521
  $js_file = 'share_toolbar.js';
522
  break;
523
+ case 'counters':
524
+ $js_file = 'counters.js';
525
+ break;
526
  }
527
 
528
+ $static_server = 'http://static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
529
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
530
 
531
  $position = get_option( 'hupso_button_position', 'below' );
532
 
533
+ if ( $position == 'below' )
534
+ $new_content = $content . '<p>' . $code . '</p>';
535
+ else
536
+ $new_content = '<p>' . $code . '</p>' . $content;
537
+
538
+ return $new_content;
539
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
 
542
  function hupso_settings_print_services() {