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

Version Description

  • Sidebar widget
  • Shortcodes can now be used directly from template files (see FAQ)
  • Option to show share buttons above and below your posts
  • Share buttons are not shown on password protected pages
  • Czech "Share" image
  • Bugfix: Share image is shown/hidden properly
Download this release

Release Info

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

Code changes from version 3.5 to 3.6

js/create_button.js CHANGED
@@ -331,15 +331,15 @@ function hupso_create_code() {
331
 
332
  switch ( toolbar_size ) {
333
  case 'big':
334
- hupso_services += "var hupso_toolbar_size_t='big';";
335
  toolbar_share = 'share';
336
  break;
337
  case 'medium':
338
- hupso_services += "var hupso_toolbar_size_t='medium';";
339
  toolbar_share = 'share-medium';
340
  break;
341
  case 'small':
342
- hupso_services += "var hupso_toolbar_size_t='small';";
343
  toolbar_share = 'share-small';
344
  break;
345
  }
@@ -371,7 +371,7 @@ switch ( button_type ) {
371
  break;
372
  case 'counters':
373
  var share_url = 'share-small';
374
- if ( share_image == 'none' ) {
375
  share_url = 'dot';
376
  share_image_lang = '';
377
  }
331
 
332
  switch ( toolbar_size ) {
333
  case 'big':
334
+ hupso_services += 'var hupso_toolbar_size_t="big";';
335
  toolbar_share = 'share';
336
  break;
337
  case 'medium':
338
+ hupso_services += 'var hupso_toolbar_size_t="medium";';
339
  toolbar_share = 'share-medium';
340
  break;
341
  case 'small':
342
+ hupso_services += 'var hupso_toolbar_size_t="small";';
343
  toolbar_share = 'share-small';
344
  break;
345
  }
371
  break;
372
  case 'counters':
373
  var share_url = 'share-small';
374
+ if ( share_image == 'hide' ) {
375
  share_url = 'dot';
376
  share_image_lang = '';
377
  }
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.5
7
- Stable tag: 3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -32,6 +32,8 @@ These services are used by millions of people every day, so sharing your content
32
  * Localized counters: Tweet, Facebook Like, Facebook Share, Google +1 buttons can use translated versions (support for 73 languages)
33
  * Hide share buttons for specific categories
34
  * Hide "Share" image or use translated image (20+ languages available)
 
 
35
 
36
 
37
  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.
@@ -39,8 +41,12 @@ Buttons will appear below your articles or on top of them as you choose.
39
 
40
  **Shortcodes**
41
 
42
- Use [hupso_hide] anywhere in post's text to hide buttons for specific post.
43
- Use [hupso] anywhere in post's text to show buttons at custom position inside the post. Buttons will be shown exactly where this shortcode appears.
 
 
 
 
44
 
45
  [Share Buttons Demo](http://www.hupso.com/share/) | [FAQ](http://wordpress.org/extend/plugins/hupso-share-buttons-for-twitter-facebook-google/faq/) | [Feedback](http://www.hupso.com/share/feedback/)
46
 
@@ -67,6 +73,20 @@ You can show share buttons for specific post at custom position using shortcode
67
 
68
  All major social networks are supported: Twitter, Facebook, Google+, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicious.
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  = Buttons are not working properly. What can I do? =
71
 
72
  Please upgrade the plugin to the latest version. If that does not help then try to reinstall the plugin (uninstall it and install it again).
@@ -111,11 +131,22 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
111
  4. Share Buttons with drop down menu (icons and service names)
112
  5. Share Buttons with drop down menu (icons only)
113
  6. Settings in Wordpress Administration (with real-time button preview)
114
-
 
 
115
 
116
  == Changelog ==
117
 
118
- = 3.5
 
 
 
 
 
 
 
 
 
119
  * Option to add "via @yourprofile" to tweets (Twitter)
120
  * Localized counters: Tweet, Facebook Like, Facebook Share, Google +1 buttons can now use translated versions (support for 73 languages)
121
  * Chinese "Share" image
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.5
7
+ Stable tag: 3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
32
  * Localized counters: Tweet, Facebook Like, Facebook Share, Google +1 buttons can use translated versions (support for 73 languages)
33
  * Hide share buttons for specific categories
34
  * Hide "Share" image or use translated image (20+ languages available)
35
+ * Sidebar widget
36
+ * Use of shortcodes inside template files
37
 
38
 
39
  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.
41
 
42
  **Shortcodes**
43
 
44
+ * Use [hupso_hide] anywhere in post's text to hide buttons for specific post.
45
+ * Use [hupso] anywhere in post's text to show buttons at custom position inside the post. Buttons will be shown exactly where this shortcode appears.
46
+ * Shortcodes inside template files: Add this PHP code inside template files at position where you want to show share buttons:
47
+ echo do_shortcode('[hupso]');
48
+ You can configure share buttons in plugin settings.
49
+ * Shortcodes inside widget text: Just include [hupso] anywhere in widget text area and share buttons will be displayed there.
50
 
51
  [Share Buttons Demo](http://www.hupso.com/share/) | [FAQ](http://wordpress.org/extend/plugins/hupso-share-buttons-for-twitter-facebook-google/faq/) | [Feedback](http://www.hupso.com/share/feedback/)
52
 
73
 
74
  All major social networks are supported: Twitter, Facebook, Google+, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicious.
75
 
76
+ = Can I show share buttons in sidebar? =
77
+
78
+ Yes. There is a sidebar widget included with the plugin. Go to WP Administration then click on "Widgets" under "Appearance" menu.
79
+ Then drag Hupso Share Buttons Widget from left and drop it on the sidebar on the right.
80
+
81
+ = How can I show share buttons inside template files? =
82
+
83
+ Add this PHP code inside template files at position where you want to show share buttons: echo do_shortcode('[hupso]');
84
+ You can configure share buttons in plugin settings.
85
+
86
+ = Can I use shortcodes inside widget text? =
87
+
88
+ Yes, you can. Just include [hupso] anywhere in widget text area and share buttons will be displayed there.
89
+
90
  = Buttons are not working properly. What can I do? =
91
 
92
  Please upgrade the plugin to the latest version. If that does not help then try to reinstall the plugin (uninstall it and install it again).
131
  4. Share Buttons with drop down menu (icons and service names)
132
  5. Share Buttons with drop down menu (icons only)
133
  6. Settings in Wordpress Administration (with real-time button preview)
134
+ 7. Share buttons under post, sidebar widget and text widget - English version (73 languages available)
135
+ 8. Share buttons under post, sidebar widget and text widget - Spanish version (73 languages available)
136
+ 9. Share buttons under post, sidebar widget and text widget - Chinese version (73 languages available)
137
 
138
  == Changelog ==
139
 
140
+
141
+ = 3.6 =
142
+ * Sidebar widget
143
+ * Shortcodes can now be used directly from template files (see FAQ)
144
+ * Option to show share buttons above and below your posts
145
+ * Share buttons are not shown on password protected pages
146
+ * Czech "Share" image
147
+ * Bugfix: Share image is shown/hidden properly
148
+
149
+ = 3.5 =
150
  * Option to add "via @yourprofile" to tweets (Twitter)
151
  * Localized counters: Tweet, Facebook Like, Facebook Share, Google +1 buttons can now use translated versions (support for 73 languages)
152
  * Chinese "Share" image
share-buttons-hupso-widget.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adds Hupso_Widget widget.
5
+ */
6
+ class Hupso_Widget extends WP_Widget {
7
+
8
+ /**
9
+ * Register widget with WordPress.
10
+ */
11
+ public function __construct() {
12
+ parent::__construct(
13
+ 'hupso_widget', // Base ID
14
+ 'Hupso Share Buttons Widget', // Name
15
+ array( 'description' => __( 'Help visitors share your posts on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit and others', 'share_buttons_hupso' ), ) // Args
16
+ );
17
+ }
18
+
19
+ /**
20
+ * Front-end display of widget.
21
+ *
22
+ * @see WP_Widget::widget()
23
+ *
24
+ * @param array $args Widget arguments.
25
+ * @param array $instance Saved values from database.
26
+ */
27
+ public function widget( $args, $instance ) {
28
+ extract( $args );
29
+ $title = apply_filters( 'widget_title', $instance['title'] );
30
+
31
+ echo $before_widget;
32
+ if ( ! empty( $title ) )
33
+ echo $before_title . $title . $after_title;
34
+ echo hupso_the_widget('');
35
+ echo $after_widget;
36
+ }
37
+
38
+ /**
39
+ * Sanitize widget form values as they are saved.
40
+ *
41
+ * @see WP_Widget::update()
42
+ *
43
+ * @param array $new_instance Values just sent to be saved.
44
+ * @param array $old_instance Previously saved values from database.
45
+ *
46
+ * @return array Updated safe values to be saved.
47
+ */
48
+ public function update( $new_instance, $old_instance ) {
49
+ $instance = array();
50
+ $instance['title'] = strip_tags( $new_instance['title'] );
51
+
52
+ return $instance;
53
+ }
54
+
55
+ /**
56
+ * Back-end widget form.
57
+ *
58
+ * @see WP_Widget::form()
59
+ *
60
+ * @param array $instance Previously saved values from database.
61
+ */
62
+ public function form( $instance ) {
63
+ if ( isset( $instance[ 'title' ] ) ) {
64
+ $title = $instance[ 'title' ];
65
+ }
66
+ else {
67
+ $title = __( 'Share', 'share_buttons_hupso' );
68
+ }
69
+ ?>
70
+ <p>
71
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title' ); ?>:</label>
72
+ <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( $title ); ?>" />
73
+ </p>
74
+ <p>
75
+ <a href="options-general.php?page=hupso-share-buttons-for-twitter-facebook-google/share-buttons-hupso.php"><?php _e('Settings', 'share_buttons_hupso');?></a>
76
+ </p>
77
+ <?php
78
+ }
79
+
80
+ } // class Hupso_Widget
81
+
82
+ ?>
share-buttons-hupso.php CHANGED
@@ -3,7 +3,7 @@
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.5
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,6 +12,7 @@ Domain Path: /languages
12
  */
13
 
14
  $hupso_dev = '';
 
15
 
16
  $hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
17
  add_filter( 'the_content', 'hupso_the_content', 10 );
@@ -35,6 +36,27 @@ $hupso_default_services = array(
35
  'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
36
  );
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  if ( function_exists('register_activation_hook') )
40
  register_activation_hook( __FILE__, 'hupso_plugin_activation' );
@@ -74,6 +96,7 @@ function hupso_plugin_uninstall() {
74
  delete_option( 'hupso_title_text' );
75
  delete_option( 'hupso_twitter_via' );
76
  delete_option( 'hupso_css_style' );
 
77
  }
78
 
79
  function hupso_plugin_activation() {
@@ -147,6 +170,8 @@ function hupso_admin_settings_show() {
147
  echo '<p><b>' . __('Shortcodes', 'share_buttons_hupso') . '</b></p>';
148
  echo '<p>Use <b>[hupso_hide]</b> anywhere in post\'s text to hide buttons for specific post.</p>';
149
  echo '<p>Use <b>[hupso]</b> anywhere in post\'s text to show buttons for specific post at custom position.</p>';
 
 
150
  echo '</div>';
151
  echo '<div id="feedback" style="background: #C7FFA3; padding: 10px 10px 10px 10px; margin-top:30px; ">';
152
  echo '<p><b>Bugs? Comments?</b></p>';
@@ -310,7 +335,8 @@ function hupso_admin_settings_show() {
310
  <option value="pl" <?php if ($hupso_share_image_lang == 'pl') echo ' selected ';?>>Polish</option>
311
  <option value="bs" <?php if ($hupso_share_image_lang == 'bs') echo ' selected ';?>>Bosnian</option>
312
  <option value="ms" <?php if ($hupso_share_image_lang == 'ms') echo ' selected ';?>>Malay</option>
313
- <option value="zh" <?php if ($hupso_share_image_lang == 'zh') echo ' selected ';?>>Chinese</option>
 
314
  </select><br/>
315
  <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="hide" <?php echo $hupso_share_image_hide_checked; ?>/> <?php _e('Hide', 'share_buttons_hupso'); ?><br/>
316
  <hr style="height:1px; width:500px;"/>
@@ -429,15 +455,18 @@ function hupso_admin_settings_show() {
429
  $checked = ' checked="checked" ';
430
  $hupso_below_checked = '';
431
  $hupso_above_checked = '';
 
432
  switch ( $button_position ) {
433
  case 'below': $hupso_below_checked = $checked; break;
434
  case 'above' : $hupso_above_checked = $checked; break;
 
435
  default: $hupso_below_checked = $checked;
436
  }
437
  ?>
438
  <td><hr style="height:1px; width:500px;" align="left"/>
439
  <input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post', 'share_buttons_hupso'); ?><br/>
440
- <input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post', 'share_buttons_hupso'); ?><br/></td>
 
441
  </tr>
442
  <tr>
443
  <td style="width:100px;"><?php _e('Show buttons on', 'share_buttons_hupso'); ?></td>
@@ -559,6 +588,24 @@ function hupso_admin_settings_show() {
559
  </td>
560
  </tr>
561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
 
563
 
564
 
@@ -722,6 +769,12 @@ function hupso_admin_settings_save() {
722
  update_option( 'hupso_css_style', $hupso_css_style );
723
  }
724
 
 
 
 
 
 
 
725
  /* save hupso_hide_categories */
726
  if ( $post ) {
727
  $hupso_hide_categories = @$_POST['hupso_hide_categories'];
@@ -737,10 +790,15 @@ function hupso_admin_settings_save() {
737
  }
738
 
739
 
 
 
 
 
 
 
740
  function hupso_the_content( $content ) {
741
 
742
- global $hupso_plugin_url, $wp_version, $hupso_dev;
743
-
744
 
745
  /* Do now show share buttons when [hupso_hide] is used */
746
  if ( stripos($content, '[hupso_hide]') !== false ) {
@@ -756,6 +814,12 @@ function hupso_the_content( $content ) {
756
  return $content;
757
  }
758
 
 
 
 
 
 
 
759
  $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
760
  if ( is_single() && $hupso_show_posts != 1 ) {
761
  $content = str_ireplace('[hupso_hide]', '', $content);
@@ -788,7 +852,7 @@ function hupso_the_content( $content ) {
788
 
789
  /* Check if we are inside category where buttons are hidden */
790
  $cats = get_the_category();
791
- $current_category = $cats[0]->slug;
792
  $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
793
  if ( $hupso_hide_categories == '' ) {
794
  $hupso_hide_categories = array();
@@ -803,7 +867,7 @@ function hupso_the_content( $content ) {
803
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
804
  $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
805
  $post_url = get_permalink($GLOBALS['post']->ID);
806
- $post_title = $GLOBALS['post']->post_title;
807
 
808
 
809
  /* default code */
@@ -874,15 +938,16 @@ function hupso_the_content( $content ) {
874
  }
875
 
876
  if ( $hupso_title_text == 'post' ) {
 
877
  switch ( $button_type ) {
878
  case 'share_button':
879
- $code .= 'var hupso_title="' . $post_title . '";';
880
  break;
881
  case 'share_toolbar':
882
- $code .= 'var hupso_title_t="' . $post_title . '";';
883
  break;
884
  case 'counters':
885
- $code .= 'var hupso_title_c="' . $post_title . '";';
886
  break;
887
  }
888
  }
@@ -918,11 +983,25 @@ function hupso_the_content( $content ) {
918
  $new_content = str_ireplace('[hupso]', '<div' . $hupso_css_out. '>' . $code . '</div>', $content);
919
  }
920
  else {
921
- if ( $position == 'below' ) {
922
- $new_content = $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
923
- }
924
- else {
925
- $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
926
  }
927
  }
928
 
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.6
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
  $hupso_dev = '';
15
+ $hupso_state = 'normal';
16
 
17
  $hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
18
  add_filter( 'the_content', 'hupso_the_content', 10 );
36
  'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
37
  );
38
 
39
+ add_action('widgets_init', 'hupso_widget_init');
40
+ add_shortcode( 'hupso', 'hupso_shortcodes' );
41
+
42
+ /* Use shortcodes in text widgets */
43
+ $hupso_widget_text = get_option( 'hupso_widget_text', '1');
44
+ if ( $hupso_widget_text == '1' ) {
45
+ add_filter('widget_text', 'do_shortcode');
46
+ }
47
+
48
+ function hupso_widget_init() {
49
+ include_once(plugin_dir_path( __FILE__ ) . '/share-buttons-hupso-widget.php');
50
+ register_widget('Hupso_Widget');
51
+ }
52
+
53
+ function hupso_shortcodes( $atts ) {
54
+ global $hupso_state;
55
+ $hupso_state = 'shortcodes';
56
+ if ($atts == '') {
57
+ return hupso_the_content('');
58
+ }
59
+ }
60
 
61
  if ( function_exists('register_activation_hook') )
62
  register_activation_hook( __FILE__, 'hupso_plugin_activation' );
96
  delete_option( 'hupso_title_text' );
97
  delete_option( 'hupso_twitter_via' );
98
  delete_option( 'hupso_css_style' );
99
+ delete_option( 'hupso_widget_text' );
100
  }
101
 
102
  function hupso_plugin_activation() {
170
  echo '<p><b>' . __('Shortcodes', 'share_buttons_hupso') . '</b></p>';
171
  echo '<p>Use <b>[hupso_hide]</b> anywhere in post\'s text to hide buttons for specific post.</p>';
172
  echo '<p>Use <b>[hupso]</b> anywhere in post\'s text to show buttons for specific post at custom position.</p>';
173
+ echo '<p>Use <b>Hupso Share Buttons Widget</b> to show share buttons in sidebar or footer.</p>';
174
+ echo '<p>Use <b>echo do_shortcode( \'[hupso]\' ); </b> to show share buttons anywhere inside template files.</p>';
175
  echo '</div>';
176
  echo '<div id="feedback" style="background: #C7FFA3; padding: 10px 10px 10px 10px; margin-top:30px; ">';
177
  echo '<p><b>Bugs? Comments?</b></p>';
335
  <option value="pl" <?php if ($hupso_share_image_lang == 'pl') echo ' selected ';?>>Polish</option>
336
  <option value="bs" <?php if ($hupso_share_image_lang == 'bs') echo ' selected ';?>>Bosnian</option>
337
  <option value="ms" <?php if ($hupso_share_image_lang == 'ms') echo ' selected ';?>>Malay</option>
338
+ <option value="zh" <?php if ($hupso_share_image_lang == 'zh') echo ' selected ';?>>Chinese</option>
339
+ <option value="cs" <?php if ($hupso_share_image_lang == 'cs') echo ' selected ';?>>Czech</option>
340
  </select><br/>
341
  <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="hide" <?php echo $hupso_share_image_hide_checked; ?>/> <?php _e('Hide', 'share_buttons_hupso'); ?><br/>
342
  <hr style="height:1px; width:500px;"/>
455
  $checked = ' checked="checked" ';
456
  $hupso_below_checked = '';
457
  $hupso_above_checked = '';
458
+ $hupso_both_checked = '';
459
  switch ( $button_position ) {
460
  case 'below': $hupso_below_checked = $checked; break;
461
  case 'above' : $hupso_above_checked = $checked; break;
462
+ case 'both': $hupso_both_checked = $checked; break;
463
  default: $hupso_below_checked = $checked;
464
  }
465
  ?>
466
  <td><hr style="height:1px; width:500px;" align="left"/>
467
  <input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post', 'share_buttons_hupso'); ?><br/>
468
+ <input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post', 'share_buttons_hupso'); ?><br/>
469
+ <input type="radio" name="hupso_button_position" value="both" <?php echo $hupso_both_checked; ?> /> <?php _e('Above and below the post', 'share_buttons_hupso'); ?><br/></td>
470
  </tr>
471
  <tr>
472
  <td style="width:100px;"><?php _e('Show buttons on', 'share_buttons_hupso'); ?></td>
588
  </td>
589
  </tr>
590
 
591
+ <tr>
592
+ <td style="width:100px;"><?php _e('Widget Text', 'share_buttons_hupso'); ?></td>
593
+ <td><hr style="height:1px; width:400px;" align="left"/>
594
+ <?php
595
+
596
+ /* Widget Text */
597
+ $checked = ' checked="checked" ';
598
+ $hupso_widget_text = get_option( 'hupso_widget_text', '1');
599
+ if ( $hupso_widget_text == '1' )
600
+ $hupso_widget_text_checked = $checked;
601
+ else
602
+ $hupso_widget_text_checked = '';
603
+
604
+ ?>
605
+ <input type="checkbox" name="hupso_widget_text" value="1" <?php echo $hupso_widget_text_checked; ?> /> <?php _e('Use shortcodes in text widgets', 'share_buttons_hupso'); ?><br/><?php _e('If this is checked, you can use [hupso] shortcode inside text widgets and it will be replaced by share buttons', 'share_buttons_hupso'); ?>
606
+ </td>
607
+ </tr>
608
+
609
 
610
 
611
 
769
  update_option( 'hupso_css_style', $hupso_css_style );
770
  }
771
 
772
+ /* Save hupso_widget_text */
773
+ if ( $post ) {
774
+ $hupso_widget_text = @$_POST[ 'hupso_widget_text' ];
775
+ update_option( 'hupso_widget_text', $hupso_widget_text );
776
+ }
777
+
778
  /* save hupso_hide_categories */
779
  if ( $post ) {
780
  $hupso_hide_categories = @$_POST['hupso_hide_categories'];
790
  }
791
 
792
 
793
+ function hupso_the_widget( $content ) {
794
+ global $hupso_state;
795
+ $hupso_state = 'widget';
796
+ return hupso_the_content ( $content );
797
+ }
798
+
799
  function hupso_the_content( $content ) {
800
 
801
+ global $hupso_plugin_url, $wp_version, $hupso_dev, $hupso_state;
 
802
 
803
  /* Do now show share buttons when [hupso_hide] is used */
804
  if ( stripos($content, '[hupso_hide]') !== false ) {
814
  return $content;
815
  }
816
 
817
+ /* Do not show share buttons on password protected pages, but show it inside widget */
818
+ $pass = $GLOBALS['post']->post_password;
819
+ if ( ($hupso_state == 'normal') && ( ($pass != '') || (post_password_required()) ) ) {
820
+ return $content;
821
+ }
822
+
823
  $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
824
  if ( is_single() && $hupso_show_posts != 1 ) {
825
  $content = str_ireplace('[hupso_hide]', '', $content);
852
 
853
  /* Check if we are inside category where buttons are hidden */
854
  $cats = get_the_category();
855
+ $current_category = @$cats[0]->slug;
856
  $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
857
  if ( $hupso_hide_categories == '' ) {
858
  $hupso_hide_categories = array();
867
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
868
  $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
869
  $post_url = get_permalink($GLOBALS['post']->ID);
870
+ $post_title = @$GLOBALS['post']->post_title;
871
 
872
 
873
  /* default code */
938
  }
939
 
940
  if ( $hupso_title_text == 'post' ) {
941
+ $ptitle = strip_tags($post_title);
942
  switch ( $button_type ) {
943
  case 'share_button':
944
+ $code .= 'var hupso_title="' . str_replace('"', '&quot;', $ptitle) . '";';
945
  break;
946
  case 'share_toolbar':
947
+ $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $ptitle) . '";';
948
  break;
949
  case 'counters':
950
+ $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $ptitle) . '";';
951
  break;
952
  }
953
  }
983
  $new_content = str_ireplace('[hupso]', '<div' . $hupso_css_out. '>' . $code . '</div>', $content);
984
  }
985
  else {
986
+ switch ( $position ) {
987
+ case 'below':
988
+ $new_content = $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
989
+ break;
990
+ case 'above':
991
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content;
992
+ break;
993
+ case 'both':
994
+ if ( $hupso_state == 'normal' ) {
995
+ /* article */
996
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
997
+ }
998
+ else {
999
+ /* widget, shortcodes */
1000
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content;
1001
+ }
1002
+ break;
1003
+ default:
1004
+ $new_content = $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
1005
  }
1006
  }
1007