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

Version Description

  • Option to show/hide share buttons for (all) posts/pages
  • Option to hide share buttons for specific categories
  • Option to select which title gets used when sharing (title of post or title of current web page)
Download this release

Release Info

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

Code changes from version 3.2 to 3.3

img/share_toolbar_big.png CHANGED
Binary file
img/share_toolbar_short.png CHANGED
Binary file
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,7 +16,7 @@ Add simple social sharing buttons to your articles. Your visitors will be able t
16
 
17
  These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
18
 
19
- ** 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.
@@ -25,17 +25,20 @@ These services are used by millions of people every day, so sharing your content
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
- * Hide or show buttons for specific posts (see shortcodes below)
 
 
 
30
 
31
  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.
32
  Buttons will appear below your articles or on top of them as you choose.
33
 
34
- ** Shortcodes **
35
- Use [hupso_hide] anywhere in post's text to hide buttons for specific post.
36
- Use [hupso] to show buttons for specific post at custom position using shortcode. They will be shown exactly where this shortcode appears.
37
 
38
- [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/)
39
 
40
 
41
  == Installation ==
@@ -67,13 +70,7 @@ If you still have problems then send bug report [using this feedback form](http:
67
 
68
  = What settings are available? =
69
 
70
- From Settings screen you are able to choose:
71
- * button type (share button, share toolbar, counters)
72
- * button size
73
- * social sharing services
74
- * menu type
75
- * button position (above or below your posts)
76
- * display options
77
 
78
  Please look at *Screenshots* for more information.
79
 
@@ -110,6 +107,11 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
113
  = 3.2 =
114
  * It is now possible to hide buttons for specific post using shortcode [hupso_hide]
115
  * It is now possible to show buttons for specific post at custom position using shortcode [hupso] (buttons will be displayed exactly where this shortcode appears)
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.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
18
 
19
+ **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.
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
+ * Hide or show buttons for specific posts / pages (see Shortcodes below)
30
+ * Hide or show buttons for posts / pages / front page / categories
31
+ * Hide share buttons for specific categories
32
+
33
 
34
  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.
35
  Buttons will appear below your articles or on top of them as you choose.
36
 
37
+ **Shortcodes**
38
+ Use [hupso_hide] anywhere in post's text to hide buttons for specific post.
39
+ 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.
40
 
41
+ [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/)
42
 
43
 
44
  == Installation ==
70
 
71
  = What settings are available? =
72
 
73
+ From Settings screen you are able to choose: button type (share button, share toolbar, counters), button size, social sharing services, menu type, button position (above or below your posts), display options.
 
 
 
 
 
 
74
 
75
  Please look at *Screenshots* for more information.
76
 
107
 
108
  == Changelog ==
109
 
110
+ = 3.3 =
111
+ * Option to show/hide share buttons for (all) posts/pages
112
+ * Option to hide share buttons for specific categories
113
+ * Option to select which title gets used when sharing (title of post or title of current web page)
114
+
115
  = 3.2 =
116
  * It is now possible to hide buttons for specific post using shortcode [hupso_hide]
117
  * It is now possible to show buttons for specific post at custom position using shortcode [hupso] (buttons will be displayed exactly where this shortcode appears)
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.2
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -49,6 +49,8 @@ function hupso_plugin_uninstall() {
49
  delete_option( 'hupso_toolbar_size' );
50
  delete_option( 'hupso_menu_type' );
51
  delete_option( 'hupso_button_position' );
 
 
52
  delete_option( 'hupso_show_frontpage' );
53
  delete_option( 'hupso_show_category' );
54
  delete_option( 'hupso_twitter_tweet' );
@@ -101,13 +103,17 @@ function hupso_set_facebook_thumbnail() {
101
  }
102
 
103
  function hupso_get_the_excerpt($content) {
 
 
104
  return $content;
105
  }
106
 
107
  function hupso_admin_settings_show() {
108
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
109
 
110
- $hupso_share_image = __('Share', 'share_buttons_hupso');
 
 
111
 
112
  if ( !current_user_can( 'manage_options' ) ) {
113
  wp_die( __( 'You do not have sufficient permissions to access this page.' , 'share_buttons_hupso') );
@@ -129,7 +135,7 @@ function hupso_admin_settings_show() {
129
  echo '<div style="padding-left:40px;"><input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings', 'share_buttons_hupso') . '" /></div>';
130
  echo '</div>';
131
  echo '<div id="tips" style="background: #CCCCFF; padding: 10px 10px 10px 10px; margin-top:30px; ">';
132
- echo '<p><b>Shortcodes</b></p>';
133
  echo '<p>Use <b>[hupso_hide]</b> anywhere in post\'s text to hide buttons for specific post.</p>';
134
  echo '<p>Use <b>[hupso]</b> anywhere in post\'s text to show buttons for specific post at custom position.</p>';
135
  echo '</div>';
@@ -187,7 +193,7 @@ function hupso_admin_settings_show() {
187
  }
188
  ?>
189
  <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/>
190
- <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/>
191
  <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/>
192
  </td>
193
  </tr>
@@ -335,33 +341,103 @@ function hupso_admin_settings_show() {
335
  <input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post', 'share_buttons_hupso'); ?><br/></td>
336
  </tr>
337
  <tr>
338
- <td style="width:100px;"><?php _e('Display options', 'share_buttons_hupso'); ?></td>
339
  <td><hr style="height:1px; width:200px;" align="left"/>
340
  <?php
341
  $checked = ' checked="checked" ';
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  $hupso_show_frontpage = get_option( 'hupso_show_frontpage', '1' );
344
  if ( $hupso_show_frontpage == 1 )
345
  $hupso_show_frontpage_checked = $checked;
346
  else
347
  $hupso_show_frontpage_checked = '';
348
 
 
349
  $hupso_show_category = get_option( 'hupso_show_category', '1' );
350
  if ( $hupso_show_category == 1 )
351
  $hupso_show_category_checked = $checked;
352
  else
353
  $hupso_show_category_checked = '';
354
  ?>
355
- <input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page - show social buttons in posts on front page', 'share_buttons_hupso'); ?><br/>
356
- <input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories - show social buttons in posts when viewing categories, tags or dates', 'share_buttons_hupso'); ?><br/>
 
 
357
  </td>
358
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  </table>
360
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'share_buttons_hupso'); ?>" />
361
  </form>
362
  </div>
363
 
364
- <?php
 
 
 
 
365
  }
366
 
367
  function hupso_admin_settings_save() {
@@ -440,6 +516,12 @@ function hupso_admin_settings_save() {
440
 
441
  /* save display options */
442
  if ( $post ) {
 
 
 
 
 
 
443
  $hupso_show_frontpage = $_POST[ 'hupso_show_frontpage' ];
444
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
445
 
@@ -465,6 +547,18 @@ function hupso_admin_settings_save() {
465
  update_option( 'hupso_linkedin_share', $linkedin_share );
466
  }
467
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  /* save button code */
469
  if ( $post ) {
470
  $code = stripslashes($_POST[ 'code' ]);
@@ -477,35 +571,70 @@ function hupso_admin_settings_save() {
477
  function hupso_the_content( $content ) {
478
 
479
  global $hupso_plugin_url, $wp_version, $hupso_dev;
 
 
 
 
 
 
 
 
480
 
481
  /* Do not show share buttons in feeds */
482
  if ( is_feed() ) {
 
 
483
  return $content;
484
  }
485
 
486
- /* Do now show share buttons when [hupso_hide] is used */
487
- if ( stripos($content, '[hupso_hide]') !== false ) {
488
  $content = str_ireplace('[hupso_hide]', '', $content);
489
  $content = str_ireplace('[hupso]', '', $content);
490
  return $content;
491
  }
492
-
493
- $post_url = get_permalink($GLOBALS['post']->ID);
494
- $post_title = $GLOBALS['post']->post_title;
495
-
 
 
 
 
496
  $hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
497
  $hupso_show_category = get_option( 'hupso_show_category' , '1' );
498
 
499
  /* Do not show share buttons if option is disabled */
500
  if ( is_home() && $hupso_show_frontpage != 1 ) {
 
 
501
  return $content;
502
  }
503
  /* Do not show share buttons if option is disabled */
504
  if ( is_archive() && $hupso_show_category != 1 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  return $content;
506
  }
507
 
508
-
 
 
 
 
509
  /* default code */
510
  $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="Share"/></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";';
511
 
@@ -549,11 +678,10 @@ function hupso_the_content( $content ) {
549
  $code = str_replace( 'float:left', 'float:right', $code );
550
  }
551
 
552
-
553
- if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
554
-
555
  switch ( $button_type ) {
556
- case 'share_button':
557
  $code .= 'var hupso_url="' . $post_url . '";';
558
  break;
559
  case 'share_toolbar':
@@ -566,17 +694,19 @@ function hupso_the_content( $content ) {
566
 
567
  }
568
 
569
- switch ( $button_type ) {
570
- case 'share_button':
571
- $code .= 'var hupso_title="' . $post_title . '";';
572
- break;
573
- case 'share_toolbar':
574
- $code .= 'var hupso_title_t="' . $post_title . '";';
575
- break;
576
- case 'counters':
577
- $code .= 'var hupso_title_c="' . $post_title . '";';
578
- break;
579
- }
 
 
580
 
581
  $code .= '</script>';
582
 
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.3
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
49
  delete_option( 'hupso_toolbar_size' );
50
  delete_option( 'hupso_menu_type' );
51
  delete_option( 'hupso_button_position' );
52
+ delete_option( 'hupso_show_posts' );
53
+ delete_option( 'hupso_show_pages' );
54
  delete_option( 'hupso_show_frontpage' );
55
  delete_option( 'hupso_show_category' );
56
  delete_option( 'hupso_twitter_tweet' );
103
  }
104
 
105
  function hupso_get_the_excerpt($content) {
106
+ $content = str_ireplace('[hupso_hide]', '', $content);
107
+ $content = str_ireplace('[hupso]', '', $content);
108
  return $content;
109
  }
110
 
111
  function hupso_admin_settings_show() {
112
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
113
 
114
+ $hupso_share_image = __('Share', 'share_buttons_hupso');
115
+ $hupso_excerpts = __('Excerpts', 'share_buttons_hupso');
116
+ $hupso_feeds = __('Feeds', 'share_buttons_hupso');
117
 
118
  if ( !current_user_can( 'manage_options' ) ) {
119
  wp_die( __( 'You do not have sufficient permissions to access this page.' , 'share_buttons_hupso') );
135
  echo '<div style="padding-left:40px;"><input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings', 'share_buttons_hupso') . '" /></div>';
136
  echo '</div>';
137
  echo '<div id="tips" style="background: #CCCCFF; padding: 10px 10px 10px 10px; margin-top:30px; ">';
138
+ echo '<p><b>' . __('Shortcodes', 'share_buttons_hupso') . '</b></p>';
139
  echo '<p>Use <b>[hupso_hide]</b> anywhere in post\'s text to hide buttons for specific post.</p>';
140
  echo '<p>Use <b>[hupso]</b> anywhere in post\'s text to show buttons for specific post at custom position.</p>';
141
  echo '</div>';
193
  }
194
  ?>
195
  <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/>
196
+ <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_big.png';?>" /><br/><br/>
197
  <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/>
198
  </td>
199
  </tr>
341
  <input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post', 'share_buttons_hupso'); ?><br/></td>
342
  </tr>
343
  <tr>
344
+ <td style="width:100px;"><?php _e('Show buttons on', 'share_buttons_hupso'); ?></td>
345
  <td><hr style="height:1px; width:200px;" align="left"/>
346
  <?php
347
  $checked = ' checked="checked" ';
348
 
349
+ /* posts */
350
+ $hupso_show_posts = get_option( 'hupso_show_posts', '1' );
351
+ if ( $hupso_show_posts == 1 )
352
+ $hupso_show_posts_checked = $checked;
353
+ else
354
+ $hupso_show_posts_checked = '';
355
+
356
+ /* pages */
357
+ $hupso_show_pages = get_option( 'hupso_show_pages', '1' );
358
+ if ( $hupso_show_pages == 1 )
359
+ $hupso_show_pages_checked = $checked;
360
+ else
361
+ $hupso_show_pages_checked = '';
362
+
363
+ /* frontpage */
364
  $hupso_show_frontpage = get_option( 'hupso_show_frontpage', '1' );
365
  if ( $hupso_show_frontpage == 1 )
366
  $hupso_show_frontpage_checked = $checked;
367
  else
368
  $hupso_show_frontpage_checked = '';
369
 
370
+ /* categories */
371
  $hupso_show_category = get_option( 'hupso_show_category', '1' );
372
  if ( $hupso_show_category == 1 )
373
  $hupso_show_category_checked = $checked;
374
  else
375
  $hupso_show_category_checked = '';
376
  ?>
377
+ <input type="checkbox" name="hupso_show_posts" value="1" <?php echo $hupso_show_posts_checked; ?> /> <?php _e('Posts', 'share_buttons_hupso'); ?><br/>
378
+ <input type="checkbox" name="hupso_show_pages" value="1" <?php echo $hupso_show_pages_checked; ?> /> <?php _e('Pages', 'share_buttons_hupso'); ?><br/>
379
+ <input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page', 'share_buttons_hupso'); ?><br/>
380
+ <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/>
381
  </td>
382
  </tr>
383
+ <tr>
384
+ <td style="width:100px;"><?php _e('Hide buttons for specific categories', 'share_buttons_hupso'); ?></td>
385
+ <td><hr style="height:1px; width:200px;" align="left"/>
386
+ <?php
387
+ /* hidden categories */
388
+ $hupso_hide_categories = get_option( 'hupso_hide_categories', array() );
389
+ ?>
390
+ <select multiple size="8" name="hupso_hide_categories[]">
391
+ <?php
392
+ $categories = get_categories();
393
+ foreach ($categories as $category) {
394
+ $option = '<option value="'.$category->category_nicename.'"';
395
+ if ( in_array($category->category_nicename, $hupso_hide_categories ) ) {
396
+ $option .= ' selected ';
397
+ }
398
+ $option .= '>';
399
+ $option .= $category->cat_name;
400
+ $option .= ' ('.$category->category_count.')';
401
+ $option .= '</option>';
402
+ echo $option;
403
+ }
404
+ ?>
405
+ <option value="hupso-option-always_show">--- <?php _e('Always show', 'share_buttons_hupso');?> ---</option>
406
+ </select>
407
+ <p><?php _e('Select categories where you want to hide share buttons.', 'share_buttons_hupso'); ?><br>
408
+ <?php _e('To select multiple categories, you need to hold down the Control Key for each selected category after the first one.', 'share_buttons_hupso');?><br />
409
+ <?php _e('Leave all options unselected or select just the last option to show buttons inside every category.', 'share_buttons_hupso');?>
410
+ </p>
411
+ </td>
412
+ </tr>
413
+ <tr>
414
+ <td style="width:100px;"><?php _e('Get title for sharing from', 'share_buttons_hupso'); ?></td>
415
+ <td><hr style="height:1px; width:200px;" align="left"/>
416
+ <?php
417
+ $checked = ' checked="checked" ';
418
+
419
+ /* posts */
420
+ $hupso_title_text = get_option( 'hupso_title_text', 'post' );
421
+ if ( $hupso_title_text == 'page' )
422
+ $hupso_title_text_page_checked = $checked;
423
+ else
424
+ $hupso_title_text_post_checked = $checked;;
425
+
426
+ ?>
427
+ <input type="radio" name="hupso_title_text" value="post" <?php echo $hupso_title_text_post_checked; ?> /> <?php _e('Title of post/page in Wordpress', 'share_buttons_hupso'); ?><br/>
428
+ <input type="radio" name="hupso_title_text" value="page" <?php echo $hupso_title_text_page_checked; ?> /> <?php _e('Title of current web page', 'share_buttons_hupso'); ?>
429
+ </td>
430
+ </tr>
431
  </table>
432
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'share_buttons_hupso'); ?>" />
433
  </form>
434
  </div>
435
 
436
+ <?php
437
+
438
+
439
+
440
+
441
  }
442
 
443
  function hupso_admin_settings_save() {
516
 
517
  /* save display options */
518
  if ( $post ) {
519
+ $hupso_show_posts = $_POST[ 'hupso_show_posts' ];
520
+ update_option( 'hupso_show_posts', $hupso_show_posts );
521
+
522
+ $hupso_show_pages = $_POST[ 'hupso_show_pages' ];
523
+ update_option( 'hupso_show_pages', $hupso_show_pages );
524
+
525
  $hupso_show_frontpage = $_POST[ 'hupso_show_frontpage' ];
526
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
527
 
547
  update_option( 'hupso_linkedin_share', $linkedin_share );
548
  }
549
 
550
+ /* Get title for sharing from */
551
+ if ( $post ) {
552
+ $hupso_title_text = $_POST[ 'hupso_title_text' ];
553
+ update_option( 'hupso_title_text', $hupso_title_text );
554
+ }
555
+
556
+ /* save hupso_hide_categories */
557
+ if ( $post ) {
558
+ $hupso_hide_categories = $_POST['hupso_hide_categories'];
559
+ update_option( 'hupso_hide_categories', $hupso_hide_categories );
560
+ }
561
+
562
  /* save button code */
563
  if ( $post ) {
564
  $code = stripslashes($_POST[ 'code' ]);
571
  function hupso_the_content( $content ) {
572
 
573
  global $hupso_plugin_url, $wp_version, $hupso_dev;
574
+
575
+
576
+ /* Do now show share buttons when [hupso_hide] is used */
577
+ if ( stripos($content, '[hupso_hide]') !== false ) {
578
+ $content = str_ireplace('[hupso_hide]', '', $content);
579
+ $content = str_ireplace('[hupso]', '', $content);
580
+ return $content;
581
+ }
582
 
583
  /* Do not show share buttons in feeds */
584
  if ( is_feed() ) {
585
+ $content = str_ireplace('[hupso_hide]', '', $content);
586
+ $content = str_ireplace('[hupso]', '', $content);
587
  return $content;
588
  }
589
 
590
+ $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
591
+ if ( is_single() && $hupso_show_posts != 1 ) {
592
  $content = str_ireplace('[hupso_hide]', '', $content);
593
  $content = str_ireplace('[hupso]', '', $content);
594
  return $content;
595
  }
596
+
597
+ $hupso_show_pages = get_option( 'hupso_show_pages' , '1' );
598
+ if ( is_page() && $hupso_show_pages != 1 ) {
599
+ $content = str_ireplace('[hupso_hide]', '', $content);
600
+ $content = str_ireplace('[hupso]', '', $content);
601
+ return $content;
602
+ }
603
+
604
  $hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
605
  $hupso_show_category = get_option( 'hupso_show_category' , '1' );
606
 
607
  /* Do not show share buttons if option is disabled */
608
  if ( is_home() && $hupso_show_frontpage != 1 ) {
609
+ $content = str_ireplace('[hupso_hide]', '', $content);
610
+ $content = str_ireplace('[hupso]', '', $content);
611
  return $content;
612
  }
613
  /* Do not show share buttons if option is disabled */
614
  if ( is_archive() && $hupso_show_category != 1 ) {
615
+ $content = str_ireplace('[hupso_hide]', '', $content);
616
+ $content = str_ireplace('[hupso]', '', $content);
617
+ return $content;
618
+ }
619
+
620
+ /* Check if we are inside category where buttons are hidden */
621
+ $cats = get_the_category();
622
+ $current_category = $cats[0]->slug;
623
+ $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
624
+ if ( $hupso_hide_categories == '' ) {
625
+ $hupso_hide_categories = array();
626
+ }
627
+ if ( @in_array($current_category, $hupso_hide_categories) ) {
628
+ $content = str_ireplace('[hupso_hide]', '', $content);
629
+ $content = str_ireplace('[hupso]', '', $content);
630
  return $content;
631
  }
632
 
633
+ $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
634
+ $post_url = get_permalink($GLOBALS['post']->ID);
635
+ $post_title = $GLOBALS['post']->post_title;
636
+
637
+
638
  /* default code */
639
  $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="Share"/></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";';
640
 
678
  $code = str_replace( 'float:left', 'float:right', $code );
679
  }
680
 
681
+
682
+ if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
 
683
  switch ( $button_type ) {
684
+ case 'share_button':
685
  $code .= 'var hupso_url="' . $post_url . '";';
686
  break;
687
  case 'share_toolbar':
694
 
695
  }
696
 
697
+ if ( $hupso_title_text == 'post' ) {
698
+ switch ( $button_type ) {
699
+ case 'share_button':
700
+ $code .= 'var hupso_title="' . $post_title . '";';
701
+ break;
702
+ case 'share_toolbar':
703
+ $code .= 'var hupso_title_t="' . $post_title . '";';
704
+ break;
705
+ case 'counters':
706
+ $code .= 'var hupso_title_c="' . $post_title . '";';
707
+ break;
708
+ }
709
+ }
710
 
711
  $code .= '</script>';
712