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

Version Description

  • Option to show or hide share buttons for search pages
  • Option to use custom title and url for sharing (useful if you want counters to show sharing stats for your whole website, not for each page individually)
Download this release

Release Info

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

Code changes from version 3.7 to 3.8

Files changed (2) hide show
  1. readme.txt +11 -2
  2. share-buttons-hupso.php +103 -12
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: kasal
3
  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.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -34,6 +34,7 @@ These services are used by millions of people every day, so sharing your content
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.
@@ -91,6 +92,10 @@ Yes, you can. Just include [hupso] anywhere in widget text area and share button
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,6 +146,10 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
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)
3
  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.1
7
+ Stable tag: 3.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
34
  * Hide "Share" image or use translated image (20+ languages available)
35
  * Sidebar widget
36
  * Use of shortcodes inside template files
37
+ * Display staring stats for whole website or for each page individually
38
 
39
 
40
  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.
92
 
93
  Add Hupso share buttons widget, then go to Hupso plugin settings and clear all fields in "Show buttons on" section.
94
 
95
+ = Can I set share buttons in such a way that it counts the entire site instead of just that specific page? =
96
+
97
+ Yes, you can. Enter your website root under "Custom url" in Settings. After that counters will show sharing stats for your whole website, not for each page individually.
98
+
99
  = Buttons are not working properly. What can I do? =
100
 
101
  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).
146
 
147
  == Changelog ==
148
 
149
+ = 3.8 =
150
+ * Option to show or hide share buttons for search pages
151
+ * Option to use custom title and url for sharing (useful if you want counters to show sharing stats for your whole website, not for each page individually)
152
+
153
  = 3.7 =
154
  * Option to display share buttons on password protected pages
155
  * Fixed: you can now display share buttons only in widget (just clear all fields in "Show buttons on" section)
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.7
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -77,6 +77,7 @@ function hupso_plugin_uninstall() {
77
  delete_option( 'hupso_show_pages' );
78
  delete_option( 'hupso_show_frontpage' );
79
  delete_option( 'hupso_show_category' );
 
80
  delete_option( 'hupso_twitter_tweet' );
81
  delete_option( 'hupso_facebook_like' );
82
  delete_option( 'hupso_facebook_send' );
@@ -98,6 +99,8 @@ function hupso_plugin_uninstall() {
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() {
@@ -110,7 +113,7 @@ function hupso_plugin_activation() {
110
  }
111
 
112
  function hupso_admin_menu() {
113
- add_options_page('', '', 'manage_options', __FILE__, 'hupso_admin_settings_show', '', 6);
114
  }
115
 
116
  function hupso_admin_head() {
@@ -254,7 +257,6 @@ function hupso_admin_settings_show() {
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;"/>
@@ -508,19 +510,30 @@ function hupso_admin_settings_show() {
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>
@@ -582,7 +595,7 @@ function hupso_admin_settings_show() {
582
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
583
 
584
  ?>
585
- @<input type="text" name="hupso_twitter_via" onclick="hupso_create_code()" onchange="hupso_create_code()" onmouseout="hupso_create_code()" value="<?php echo $hupso_twitter_via; ?>" /> <span style="padding-left:30px;"><?php _e('Add "via @yourprofile" to tweets', 'share_buttons_hupso');?>.</span><br/>
586
  </td>
587
  </tr>
588
 
@@ -617,6 +630,30 @@ function hupso_admin_settings_show() {
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>
@@ -737,7 +774,11 @@ function hupso_admin_settings_save() {
737
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
738
 
739
  $hupso_show_category = @$_POST[ 'hupso_show_category' ];
740
- update_option( 'hupso_show_category', $hupso_show_category );
 
 
 
 
741
  }
742
 
743
  /* save options for counters */
@@ -776,6 +817,18 @@ function hupso_admin_settings_save() {
776
  update_option( 'hupso_css_style', $hupso_css_style );
777
  }
778
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  /* Save hupso_widget_text */
780
  if ( $post ) {
781
  $hupso_widget_text = @$_POST[ 'hupso_widget_text' ];
@@ -843,6 +896,14 @@ function hupso_the_content( $content ) {
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);
@@ -889,8 +950,26 @@ function hupso_the_content( $content ) {
889
  $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
890
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
891
  $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
 
892
  $post_url = get_permalink($GLOBALS['post']->ID);
893
  $post_title = @$GLOBALS['post']->post_title;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
 
895
 
896
  /* default code */
@@ -946,15 +1025,21 @@ function hupso_the_content( $content ) {
946
  }
947
 
948
  if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
 
 
 
 
 
 
949
  switch ( $button_type ) {
950
  case 'share_button':
951
- $code .= 'var hupso_url="' . $post_url . '";';
952
  break;
953
  case 'share_toolbar':
954
- $code .= 'var hupso_url_t="' . $post_url . '";';
955
  break;
956
  case 'counters':
957
- $code .= 'var hupso_url_c="' . $post_url . '";';
958
  break;
959
  }
960
 
@@ -962,15 +1047,21 @@ function hupso_the_content( $content ) {
962
 
963
  if ( $hupso_title_text == 'post' ) {
964
  $ptitle = strip_tags($post_title);
 
 
 
 
 
 
965
  switch ( $button_type ) {
966
  case 'share_button':
967
- $code .= 'var hupso_title="' . str_replace('"', '&quot;', $ptitle) . '";';
968
  break;
969
  case 'share_toolbar':
970
- $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $ptitle) . '";';
971
  break;
972
  case 'counters':
973
- $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $ptitle) . '";';
974
  break;
975
  }
976
  }
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.8
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
77
  delete_option( 'hupso_show_pages' );
78
  delete_option( 'hupso_show_frontpage' );
79
  delete_option( 'hupso_show_category' );
80
+ delete_option( 'hupso_show_search' );
81
  delete_option( 'hupso_twitter_tweet' );
82
  delete_option( 'hupso_facebook_like' );
83
  delete_option( 'hupso_facebook_send' );
99
  delete_option( 'hupso_css_style' );
100
  delete_option( 'hupso_widget_text' );
101
  delete_option( 'hupso_password_protected' );
102
+ delete_option( 'hupso_page_url' );
103
+ delete_option( 'hupso_page_title' );
104
  }
105
 
106
  function hupso_plugin_activation() {
113
  }
114
 
115
  function hupso_admin_menu() {
116
+ add_options_page('Hupso Share Buttons Settings', 'Hupso Share Buttons', 'manage_options', __FILE__, 'hupso_admin_settings_show', '', 6);
117
  }
118
 
119
  function hupso_admin_head() {
257
  <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>
258
  <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>
259
  <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>
 
260
  <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>
261
  </table>
262
  <hr style="height:1px; width:500px;"/>
510
  else
511
  $hupso_show_category_checked = '';
512
 
513
+ /* search pages */
514
+ $hupso_show_search = get_option( 'hupso_show_search', '1');
515
+ if ( $hupso_show_search == '1' )
516
+ $hupso_show_search_checked = $checked;
517
+ else
518
+ $hupso_show_search_checked = '';
519
+
520
  /* password protected posts */
521
  $hupso_password_protected = get_option( 'hupso_password_protected', '0');
522
  if ( $hupso_password_protected == '1' )
523
  $hupso_password_protected_checked = $checked;
524
  else
525
+ $hupso_password_protected_checked = '';
526
+
527
+
528
 
529
  ?>
530
  <input type="checkbox" name="hupso_show_posts" value="1" <?php echo $hupso_show_posts_checked; ?> /> <?php _e('Posts', 'share_buttons_hupso'); ?><br/>
531
  <input type="checkbox" name="hupso_show_pages" value="1" <?php echo $hupso_show_pages_checked; ?> /> <?php _e('Pages', 'share_buttons_hupso'); ?><br/>
532
  <input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page', 'share_buttons_hupso'); ?><br/>
533
  <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/>
534
+ <input type="checkbox" name="hupso_show_search" value="1" <?php echo $hupso_show_search_checked; ?> /> <?php _e('Search pages', 'share_buttons_hupso'); ?><br/>
535
  <input type="checkbox" name="hupso_password_protected" value="1" <?php echo $hupso_password_protected_checked; ?> /> <?php _e('Password protected posts', 'share_buttons_hupso'); ?><br/>
536
+
537
  </td>
538
  </tr>
539
  <tr>
595
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
596
 
597
  ?>
598
+ @<input type="text" name="hupso_twitter_via" onclick="hupso_create_code()" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="30" value="<?php echo $hupso_twitter_via; ?>" /> <span style="padding-left:30px;"><?php _e('Add "via @yourprofile" to tweets', 'share_buttons_hupso');?>.</span><br/>
599
  </td>
600
  </tr>
601
 
630
  </td>
631
  </tr>
632
 
633
+ <tr>
634
+ <td style="width:100px;"><?php _e('Custom title', 'share_buttons_hupso'); ?></td>
635
+ <td><hr style="height:1px; width:400px;" align="left"/>
636
+ <?php
637
+ /* page_title */
638
+ $checked = ' checked="checked" ';
639
+ $hupso_page_title = get_option( 'hupso_page_title', '');
640
+ ?>
641
+ <input type="text" name="page_title" value="<?php echo $hupso_page_title;?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" /><br/><?php _e('Enter custom text that will always be used for sharing.', 'share_buttons_hupso'); ?><br/><?php _e('Leave this blank to use title of current page as text for sharing. [Default]', 'share_buttons_hupso'); ?>
642
+ </td>
643
+ </tr>
644
+
645
+ <tr>
646
+ <td style="width:100px;"><?php _e('Custom url', 'share_buttons_hupso'); ?></td>
647
+ <td><hr style="height:1px; width:400px;" align="left"/>
648
+ <?php
649
+ /* page_url */
650
+ $checked = ' checked="checked" ';
651
+ $hupso_page_url = get_option( 'hupso_page_url', '');
652
+ ?>
653
+ <input type="text" name="page_url" value="<?php echo $hupso_page_url;?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" /><br/><?php _e('Enter custom url that will always be used for sharing. You can enter your root website here (e.g.: http://www.example.com or http://example.blogspot.com, so counters will show statistics for your whole website, not for each page individually.', 'share_buttons_hupso'); ?><br/><?php _e('Leave this blank to use url of current page for sharing. [Default]', 'share_buttons_hupso'); ?>
654
+ </td>
655
+ </tr>
656
+
657
  </table>
658
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'share_buttons_hupso'); ?>" />
659
  </form>
774
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
775
 
776
  $hupso_show_category = @$_POST[ 'hupso_show_category' ];
777
+ update_option( 'hupso_show_category', $hupso_show_category );
778
+
779
+ $hupso_show_search = @$_POST[ 'hupso_show_search' ];
780
+ update_option( 'hupso_show_search', $hupso_show_search );
781
+
782
  }
783
 
784
  /* save options for counters */
817
  update_option( 'hupso_css_style', $hupso_css_style );
818
  }
819
 
820
+ /* Save page_url */
821
+ if ( $post ) {
822
+ $hupso_page_url = @$_POST[ 'page_url' ];
823
+ update_option( 'hupso_page_url', $hupso_page_url );
824
+ }
825
+
826
+ /* Save page_title */
827
+ if ( $post ) {
828
+ $hupso_page_title = @$_POST[ 'page_title' ];
829
+ update_option( 'hupso_page_title', $hupso_page_title );
830
+ }
831
+
832
  /* Save hupso_widget_text */
833
  if ( $post ) {
834
  $hupso_widget_text = @$_POST[ 'hupso_widget_text' ];
896
  }
897
  }
898
 
899
+
900
+ $hupso_show_search = get_option( 'hupso_show_search' , '1' );
901
+ if ( ($hupso_state == 'normal') && (is_search()) && ($hupso_show_search != 1) ) {
902
+ $content = str_ireplace('[hupso_hide]', '', $content);
903
+ $content = str_ireplace('[hupso]', '', $content);
904
+ return $content;
905
+ }
906
+
907
  $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
908
  if ( ($hupso_state == 'normal') && (is_single()) && ($hupso_show_posts != 1) ) {
909
  $content = str_ireplace('[hupso_hide]', '', $content);
950
  $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
951
  $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
952
  $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
953
+
954
  $post_url = get_permalink($GLOBALS['post']->ID);
955
  $post_title = @$GLOBALS['post']->post_title;
956
+
957
+ if ( ( $hupso_state == 'widget' ) || ( $hupso_state == 'shortcodes' ) ) {
958
+ if ( isset($_SERVER['HTTPS']) ) {
959
+ $protocol = 'https://';
960
+ }
961
+ else {
962
+ $protocol = 'http://';
963
+ }
964
+ $post_url = $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
965
+ $post_title = '';
966
+ }
967
+
968
+
969
+
970
+
971
+ $hupso_page_url = get_option( 'hupso_page_url', '' );
972
+ $hupso_page_title = get_option( 'hupso_page_title', '' );
973
 
974
 
975
  /* default code */
1025
  }
1026
 
1027
  if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
1028
+ if ( $hupso_page_url != '' ) {
1029
+ $new_url = $hupso_page_url;
1030
+ }
1031
+ else {
1032
+ $new_url = $post_url;
1033
+ }
1034
  switch ( $button_type ) {
1035
  case 'share_button':
1036
+ $code .= 'var hupso_url="' . $new_url . '";';
1037
  break;
1038
  case 'share_toolbar':
1039
+ $code .= 'var hupso_url_t="' . $new_url . '";';
1040
  break;
1041
  case 'counters':
1042
+ $code .= 'var hupso_url_c="' . $new_url . '";';
1043
  break;
1044
  }
1045
 
1047
 
1048
  if ( $hupso_title_text == 'post' ) {
1049
  $ptitle = strip_tags($post_title);
1050
+ if ( $hupso_page_title != '' ) {
1051
+ $new_title = $hupso_page_title;
1052
+ }
1053
+ else {
1054
+ $new_title = $ptitle;
1055
+ }
1056
  switch ( $button_type ) {
1057
  case 'share_button':
1058
+ $code .= 'var hupso_title="' . str_replace('"', '&quot;', $new_title) . '";';
1059
  break;
1060
  case 'share_toolbar':
1061
+ $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $new_title) . '";';
1062
  break;
1063
  case 'counters':
1064
+ $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $new_title) . '";';
1065
  break;
1066
  }
1067
  }