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

Version Description

  • Option to display share buttons on password protected pages
  • Fixed: you can now display share buttons only in widget (just clear all fields in "Show buttons on" section)
Download this release

Release Info

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

Code changes from version 3.6 to 3.7

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.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -87,6 +87,10 @@ You can configure share buttons in plugin settings.
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).
@@ -137,6 +141,9 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
137
 
138
  == Changelog ==
139
 
 
 
 
140
 
141
  = 3.6 =
142
  * Sidebar widget
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.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
87
 
88
  Yes, you can. Just include [hupso] anywhere in widget text area and share buttons will be displayed there.
89
 
90
+ = How can I display share buttons only inside widget and not under posts? =
91
+
92
+ Add Hupso share buttons widget, then go to Hupso plugin settings and clear all fields in "Show buttons on" section.
93
+
94
  = Buttons are not working properly. What can I do? =
95
 
96
  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).
141
 
142
  == Changelog ==
143
 
144
+ = 3.7 =
145
+ * Option to display share buttons on password protected pages
146
+ * Fixed: you can now display share buttons only in widget (just clear all fields in "Show buttons on" section)
147
 
148
  = 3.6 =
149
  * Sidebar widget
share-buttons-hupso-widget.php CHANGED
@@ -25,6 +25,7 @@ class Hupso_Widget extends WP_Widget {
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
 
25
  * @param array $instance Saved values from database.
26
  */
27
  public function widget( $args, $instance ) {
28
+ global $hupso_state;
29
  extract( $args );
30
  $title = apply_filters( 'widget_title', $instance['title'] );
31
 
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.6
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -97,6 +97,7 @@ function hupso_plugin_uninstall() {
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() {
@@ -253,6 +254,7 @@ function hupso_admin_settings_show() {
253
  <tr><td><input type="radio" name="size" value="button80x19" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button80_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_80_img ?></td></tr>
254
  <tr><td><input type="radio" name="size" value="button100x23" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button100_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_100_img ?></td></tr>
255
  <tr><td><input type="radio" name="size" value="button120x28" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button120_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_120_img ?></td></tr>
 
256
  <tr><td><input type="radio" name="size" value="button160x37" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button160_checked; ?>/></td><td style="padding-right:20px;"><?php echo $button_160_img ?></td></tr>
257
  </table>
258
  <hr style="height:1px; width:500px;"/>
@@ -504,12 +506,21 @@ function hupso_admin_settings_show() {
504
  if ( $hupso_show_category == 1 )
505
  $hupso_show_category_checked = $checked;
506
  else
507
- $hupso_show_category_checked = '';
 
 
 
 
 
 
 
 
508
  ?>
509
  <input type="checkbox" name="hupso_show_posts" value="1" <?php echo $hupso_show_posts_checked; ?> /> <?php _e('Posts', 'share_buttons_hupso'); ?><br/>
510
  <input type="checkbox" name="hupso_show_pages" value="1" <?php echo $hupso_show_pages_checked; ?> /> <?php _e('Pages', 'share_buttons_hupso'); ?><br/>
511
  <input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page', 'share_buttons_hupso'); ?><br/>
512
- <input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories (categories, tags, dates, authors)', 'share_buttons_hupso'); ?><br/>
 
513
  </td>
514
  </tr>
515
  <tr>
@@ -602,14 +613,10 @@ function hupso_admin_settings_show() {
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
-
612
-
613
  </table>
614
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'share_buttons_hupso'); ?>" />
615
  </form>
@@ -773,7 +780,13 @@ function hupso_admin_settings_save() {
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 ) {
@@ -801,14 +814,14 @@ function hupso_the_content( $content ) {
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 ) {
805
  $content = str_ireplace('[hupso_hide]', '', $content);
806
  $content = str_ireplace('[hupso]', '', $content);
807
  return $content;
808
  }
809
 
810
  /* Do not show share buttons in feeds */
811
- if ( is_feed() ) {
812
  $content = str_ireplace('[hupso_hide]', '', $content);
813
  $content = str_ireplace('[hupso]', '', $content);
814
  return $content;
@@ -816,19 +829,29 @@ function hupso_the_content( $content ) {
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);
826
  $content = str_ireplace('[hupso]', '', $content);
827
  return $content;
828
  }
829
 
830
  $hupso_show_pages = get_option( 'hupso_show_pages' , '1' );
831
- if ( is_page() && $hupso_show_pages != 1 ) {
832
  $content = str_ireplace('[hupso_hide]', '', $content);
833
  $content = str_ireplace('[hupso]', '', $content);
834
  return $content;
@@ -838,13 +861,13 @@ function hupso_the_content( $content ) {
838
  $hupso_show_category = get_option( 'hupso_show_category' , '1' );
839
 
840
  /* Do not show share buttons if option is disabled */
841
- if ( is_home() && $hupso_show_frontpage != 1 ) {
842
  $content = str_ireplace('[hupso_hide]', '', $content);
843
  $content = str_ireplace('[hupso]', '', $content);
844
  return $content;
845
  }
846
  /* Do not show share buttons if option is disabled */
847
- if ( is_archive() && $hupso_show_category != 1 ) {
848
  $content = str_ireplace('[hupso_hide]', '', $content);
849
  $content = str_ireplace('[hupso]', '', $content);
850
  return $content;
@@ -857,7 +880,7 @@ function hupso_the_content( $content ) {
857
  if ( $hupso_hide_categories == '' ) {
858
  $hupso_hide_categories = array();
859
  }
860
- if ( @in_array($current_category, $hupso_hide_categories) ) {
861
  $content = str_ireplace('[hupso_hide]', '', $content);
862
  $content = str_ireplace('[hupso]', '', $content);
863
  return $content;
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.7
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
97
  delete_option( 'hupso_twitter_via' );
98
  delete_option( 'hupso_css_style' );
99
  delete_option( 'hupso_widget_text' );
100
+ delete_option( 'hupso_password_protected' );
101
  }
102
 
103
  function hupso_plugin_activation() {
254
  <tr><td><input type="radio" name="size" value="button80x19" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button80_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_80_img ?></td></tr>
255
  <tr><td><input type="radio" name="size" value="button100x23" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button100_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_100_img ?></td></tr>
256
  <tr><td><input type="radio" name="size" value="button120x28" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button120_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_120_img ?></td></tr>
257
+
258
  <tr><td><input type="radio" name="size" value="button160x37" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $button160_checked; ?>/></td><td style="padding-right:20px;"><?php echo $button_160_img ?></td></tr>
259
  </table>
260
  <hr style="height:1px; width:500px;"/>
506
  if ( $hupso_show_category == 1 )
507
  $hupso_show_category_checked = $checked;
508
  else
509
+ $hupso_show_category_checked = '';
510
+
511
+ /* password protected posts */
512
+ $hupso_password_protected = get_option( 'hupso_password_protected', '0');
513
+ if ( $hupso_password_protected == '1' )
514
+ $hupso_password_protected_checked = $checked;
515
+ else
516
+ $hupso_password_protected_checked = '';
517
+
518
  ?>
519
  <input type="checkbox" name="hupso_show_posts" value="1" <?php echo $hupso_show_posts_checked; ?> /> <?php _e('Posts', 'share_buttons_hupso'); ?><br/>
520
  <input type="checkbox" name="hupso_show_pages" value="1" <?php echo $hupso_show_pages_checked; ?> /> <?php _e('Pages', 'share_buttons_hupso'); ?><br/>
521
  <input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page', 'share_buttons_hupso'); ?><br/>
522
+ <input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories (categories, tags, dates, authors)', 'share_buttons_hupso'); ?><br/>
523
+ <input type="checkbox" name="hupso_password_protected" value="1" <?php echo $hupso_password_protected_checked; ?> /> <?php _e('Password protected posts', 'share_buttons_hupso'); ?><br/>
524
  </td>
525
  </tr>
526
  <tr>
613
  $hupso_widget_text_checked = '';
614
 
615
  ?>
616
+ <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'); ?>.
617
  </td>
618
  </tr>
619
 
 
 
 
 
620
  </table>
621
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'share_buttons_hupso'); ?>" />
622
  </form>
780
  if ( $post ) {
781
  $hupso_widget_text = @$_POST[ 'hupso_widget_text' ];
782
  update_option( 'hupso_widget_text', $hupso_widget_text );
783
+ }
784
+
785
+ /* Save hupso_password_protected */
786
+ if ( $post ) {
787
+ $hupso_password_protected = @$_POST[ 'hupso_password_protected' ];
788
+ update_option( 'hupso_password_protected', $hupso_password_protected );
789
+ }
790
 
791
  /* save hupso_hide_categories */
792
  if ( $post ) {
814
  global $hupso_plugin_url, $wp_version, $hupso_dev, $hupso_state;
815
 
816
  /* Do now show share buttons when [hupso_hide] is used */
817
+ if ( ($hupso_state == 'normal') && ( stripos($content, '[hupso_hide]') !== false ) ) {
818
  $content = str_ireplace('[hupso_hide]', '', $content);
819
  $content = str_ireplace('[hupso]', '', $content);
820
  return $content;
821
  }
822
 
823
  /* Do not show share buttons in feeds */
824
+ if ( ($hupso_state == 'normal') && (is_feed()) ) {
825
  $content = str_ireplace('[hupso_hide]', '', $content);
826
  $content = str_ireplace('[hupso]', '', $content);
827
  return $content;
829
 
830
  /* Do not show share buttons on password protected pages, but show it inside widget */
831
  $pass = $GLOBALS['post']->post_password;
832
+ $hupso_password_protected = get_option( 'hupso_password_protected', '0');
833
+ if ( $hupso_state == 'normal' ) {
834
+ if ($pass != '') {
835
+ if (!$hupso_password_protected) {
836
+ return $content;
837
+ }
838
+ else {
839
+ if (post_password_required()) {
840
+ return $content;
841
+ }
842
+ }
843
+ }
844
  }
845
 
846
  $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
847
+ if ( ($hupso_state == 'normal') && (is_single()) && ($hupso_show_posts != 1) ) {
848
  $content = str_ireplace('[hupso_hide]', '', $content);
849
  $content = str_ireplace('[hupso]', '', $content);
850
  return $content;
851
  }
852
 
853
  $hupso_show_pages = get_option( 'hupso_show_pages' , '1' );
854
+ if ( ($hupso_state == 'normal') && (is_page()) && ($hupso_show_pages != 1) ) {
855
  $content = str_ireplace('[hupso_hide]', '', $content);
856
  $content = str_ireplace('[hupso]', '', $content);
857
  return $content;
861
  $hupso_show_category = get_option( 'hupso_show_category' , '1' );
862
 
863
  /* Do not show share buttons if option is disabled */
864
+ if ( ($hupso_state == 'normal') && (is_home()) && ($hupso_show_frontpage != 1) ) {
865
  $content = str_ireplace('[hupso_hide]', '', $content);
866
  $content = str_ireplace('[hupso]', '', $content);
867
  return $content;
868
  }
869
  /* Do not show share buttons if option is disabled */
870
+ if ( ($hupso_state == 'normal') && (is_archive()) && ($hupso_show_category != 1) ) {
871
  $content = str_ireplace('[hupso_hide]', '', $content);
872
  $content = str_ireplace('[hupso]', '', $content);
873
  return $content;
880
  if ( $hupso_hide_categories == '' ) {
881
  $hupso_hide_categories = array();
882
  }
883
+ if ( ($hupso_state == 'normal') && (@in_array($current_category, $hupso_hide_categories)) ) {
884
  $content = str_ireplace('[hupso_hide]', '', $content);
885
  $content = str_ireplace('[hupso]', '', $content);
886
  return $content;