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

Version Description

Download this release

Release Info

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

Code changes from version 4.0.5 to 4.0.6

Files changed (2) hide show
  1. readme.txt +1 -1
  2. share-buttons-hupso.php +165 -188
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.hupso.com/
4
  Tags: twitter, facebook, google, social sharing, share buttons, social share buttons, share icons, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, multisite, pinterest, print, tumblr, bebo, social media, social buttons, social share, email, print button, social plugin, social widget, email button, post, plus 1, vkontakte, vk.com, reddit, delicous, del.icio.us, linkedin, tumblr, pinterest, stumbleupon, digg, stumble upon, pinterest button, +1, google +1, tweet, like, share, sharing, shortcode
5
  Requires at least: 2.9
6
  Tested up to: 4.7.1
7
- Stable tag: 4.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
4
  Tags: twitter, facebook, google, social sharing, share buttons, social share buttons, share icons, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, multisite, pinterest, print, tumblr, bebo, social media, social buttons, social share, email, print button, social plugin, social widget, email button, post, plus 1, vkontakte, vk.com, reddit, delicous, del.icio.us, linkedin, tumblr, pinterest, stumbleupon, digg, stumble upon, pinterest button, +1, google +1, tweet, like, share, sharing, shortcode
5
  Requires at least: 2.9
6
  Tested up to: 4.7.1
7
+ Stable tag: 4.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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 share 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, Tumblr, Pinterest, StumbleUpon, Digg, Reddit, Bebo, VKontakte 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: 4.0.5
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,7 +12,7 @@ Domain Path: /languages
12
  */
13
 
14
  global $HUPSO_VERSION;
15
- $HUPSO_VERSION = '4.0.5';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
@@ -72,13 +72,13 @@ add_shortcode( 'hupso', 'hupso_shortcodes' );
72
 
73
 
74
  /* Use shortcodes in text widgets */
75
- $hupso_widget_text = hupso_sanitize(get_option( 'hupso_widget_text', '1'));
76
  if ( $hupso_widget_text == '1' ) {
77
  add_filter('widget_text', 'do_shortcode');
78
  }
79
 
80
  /* Meta box on "Edit Post" screen */
81
- $hupso_meta_box = hupso_sanitize(get_option( 'hupso_meta_box', '' ));
82
  if ($hupso_meta_box == "1") {
83
  include_once(plugin_dir_path( __FILE__ ) . '/share-buttons-hupso-meta.php');
84
  }
@@ -201,7 +201,7 @@ function hupso_plugin_uninstall() {
201
  function hupso_plugin_activation() {
202
 
203
  /* Fix for bug in version 3.0 */
204
- $size = hupso_sanitize(get_option( 'hupso_button_size', ''));
205
  if ( ($size == 'share_button') or ($size == 'share_toolbar') or ($size == 'counters') ) {
206
  @update_option( 'hupso_button_size', 'button100x23');
207
  }
@@ -226,8 +226,8 @@ function hupso_set_facebook_thumbnail() {
226
  */
227
 
228
  $thumb_image = '';
229
- $hupso_facebook_image = hupso_sanitize(get_option( 'hupso_facebook_image', 'fch' ));
230
- $hupso_facebook_custom_image = hupso_sanitize(get_option( 'hupso_facebook_custom_image', '' ));
231
 
232
  switch ( $hupso_facebook_image ) {
233
  case 'header':
@@ -261,7 +261,7 @@ function hupso_set_facebook_thumbnail() {
261
 
262
 
263
  if ( $thumb_image != '' ) {
264
- echo '<meta property="og:image" content="' . esc_attr( $thumb_image ) . '"/>';
265
  }
266
  }
267
 
@@ -306,7 +306,6 @@ function hupso_admin_settings_show() {
306
  }
307
  }
308
 
309
-
310
  echo '<div id="save_warning"></div>';
311
  echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
312
  echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)', 'hupso').'</h2>';
@@ -364,7 +363,7 @@ function hupso_admin_settings_show() {
364
 
365
 
366
  $checked = 'checked="checked"';
367
- $current_button_size = hupso_sanitize(get_option( 'hupso_button_size' , 'button100x23' ));
368
  $button60_checked = '';
369
  $button80_checked = '';
370
  $button100_checked = '';
@@ -392,8 +391,8 @@ function hupso_admin_settings_show() {
392
  <td style="width:100px;"><?php _e('Button type', 'hupso'); ?>
393
  </td>
394
  <?php
395
- $hupso_button_type = hupso_sanitize(get_option( 'hupso_button_type', 'share_toolbar' ));
396
- $hupso_button_image_custom_url = hupso_sanitize(get_option( 'hupso_button_image_custom_url', ''));
397
  $checked = ' checked="checked" ';
398
  $hupso_share_button_checked = '';
399
  $hupso_share_toolbar_checked = '';
@@ -425,7 +424,7 @@ function hupso_admin_settings_show() {
425
  <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>
426
  <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>
427
  <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>
428
- <tr><td><input type="radio" name="size" value="custom" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $share_button_custom_checked; ?> /></td><td style="padding-left:10px;"><?php _e('Custom image from URL', 'hupso'); ?>: <input type="text" name="hupso_button_image_custom_url" onchange="create_code()" style="width:300px;" value="<?php echo $hupso_button_image_custom_url; ?>"/><br/> See <a href="http://www.hupso.com/share/gallery.php" target="_blank">gallery of custom share buttons</a>.</td></tr>
429
  </table>
430
  <hr style="height:1px; width:500px;"/>
431
  </td>
@@ -439,7 +438,7 @@ function hupso_admin_settings_show() {
439
  <td style="width:100px;"><?php _e('Toolbar size', 'hupso'); ?></td>
440
  <td style="width:100px">
441
  <?php
442
- $hupso_toolbar_size = hupso_sanitize(get_option( 'hupso_toolbar_size', 'medium' ));
443
  $hupso_toolbar_size_big_checked = '';
444
  $hupso_toolbar_size_medium_checked = '';
445
  $hupso_toolbar_size_small_checked = '';
@@ -470,7 +469,7 @@ function hupso_admin_settings_show() {
470
 
471
  /* hupso_share_image */
472
  $checked = ' checked="checked" ';
473
- $hupso_share_image = hupso_sanitize(get_option( 'hupso_share_image', 'normal' ));
474
  $hupso_share_image_show_checked = '';
475
  $hupso_share_image_hide_checked = '';
476
  $hupso_share_image_lang_checked = '';
@@ -483,8 +482,8 @@ function hupso_admin_settings_show() {
483
  case 'custom': $hupso_share_image_custom_checked = $checked; break;
484
  }
485
 
486
- $hupso_share_image_lang = hupso_sanitize(get_option ( 'hupso_share_image_lang', '' ));
487
- $hupso_share_image_custom_url = hupso_sanitize(get_option ( 'hupso_share_image_custom_url', '' ));
488
 
489
  ?>
490
  <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="show" <?php echo $hupso_share_image_show_checked; ?>/> <?php _e('Show in language', 'hupso');?>:
@@ -516,7 +515,7 @@ function hupso_admin_settings_show() {
516
  <option value="tr" <?php if ($hupso_share_image_lang == 'tr') echo ' selected ';?>>Turkish</option>
517
  </select><br/>
518
  <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', 'hupso'); ?><br/>
519
- <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_share_image_custom_checked; ?>/> <?php _e('Custom image from URL', 'hupso'); ?>: <input name="hupso_share_image_custom_url" type="text" onmouseout="hupso_create_code()" onchange="hupso_create_code()" value="<?php echo $hupso_share_image_custom_url;?>" size="50" /><br/><span style="padding-left:30px; font-size:10px;">(<?php _e('Optimal image height: 32px - big, 24px - medium, 16px - small/counters', 'hupso'); ?>)</span><br/>
520
  <hr style="height:1px; width:500px;"/>
521
  </td>
522
  </tr>
@@ -525,13 +524,13 @@ function hupso_admin_settings_show() {
525
 
526
  <?php
527
  /* background & border color */
528
- $hupso_background_color = hupso_sanitize(get_option( 'hupso_background_color', 'EAF4FF'));
529
- $hupso_border_color = hupso_sanitize(get_option( 'hupso_border_color', '66CCFF'));
530
  ?>
531
  <div id="show_color">
532
  <table style="border: 0px;">
533
- <tr><td style="width:100px;"><?php _e('Background color');?></td><td><input class="color" type="text" id="background_color" name="background_color" value="#<?php echo $hupso_background_color; ?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" style="width: 100px;" /><input style="margin-left:30px;" type="button" value="Restore default" onclick="hupso_restore_background_color()" /></td></tr>
534
- <tr><td style="width:100px;"><?php _e('Border color');?></td><td><input class="color" type="text" id="border_color" name="border_color" value="#<?php echo $hupso_border_color; ?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" style="width: 100px;" /><input style="margin-left:30px;" type="button" value="Restore default" onclick="hupso_restore_border_color()" /> <hr style="height:1px; width:500px;"/></td></tr>
535
  </table>
536
  </div>
537
 
@@ -556,28 +555,28 @@ function hupso_admin_settings_show() {
556
  $print_button_checked = '';
557
  $linkedin_share_checked = '';
558
 
559
- $twitter_tweet = hupso_sanitize(get_option( 'hupso_twitter_tweet', '1' ));
560
  if ( $twitter_tweet == 1 ) $twitter_tweet_checked = $checked;
561
 
562
- $facebook_like = hupso_sanitize(get_option( 'hupso_facebook_like', '1' ));
563
  if ( $facebook_like == 1 ) $facebook_like_checked = $checked;
564
 
565
- $facebook_send = hupso_sanitize(get_option( 'hupso_facebook_send', '1' ));
566
  if ( $facebook_send == 1 ) $facebook_send_checked = $checked;
567
 
568
- $google_plus_one = hupso_sanitize(get_option( 'hupso_google_plus_one', '1' ));
569
  if ( $google_plus_one == 1 ) $google_plus_one_checked = $checked;
570
 
571
- $pinterest_pin = hupso_sanitize(get_option( 'hupso_pinterest_pin', '1' ));
572
  if ( $pinterest_pin == 1 ) $pinterest_pin_checked = $checked;
573
 
574
- $email_button = hupso_sanitize(get_option( 'hupso_email_button', '0' ));
575
  if ( $email_button == 1 ) $email_button_checked = $checked;
576
 
577
- $print_button = hupso_sanitize(get_option( 'hupso_print_button', '0' ));
578
  if ( $print_button == 1 ) $print_button_checked = $checked;
579
 
580
- $linkedin_share = hupso_sanitize(get_option( 'hupso_linkedin_share', '0' ));
581
  if ( $linkedin_share == 1 ) $linkedin_share_checked = $checked;
582
  ?>
583
  <div id="counters_config" style="display:none;">
@@ -648,7 +647,7 @@ function hupso_admin_settings_show() {
648
  <tr>
649
  <td style="width:100px;"><?php _e('Type of menu', 'hupso'); ?></td>
650
  <?php
651
- $menu_type = hupso_sanitize(get_option( 'hupso_menu_type', 'labels' ));
652
  $checked = ' checked="checked" ';
653
  $hupso_labels_checked = '';
654
  $hupso_icons_checked = '';
@@ -669,7 +668,7 @@ function hupso_admin_settings_show() {
669
  <tr>
670
  <td style="width:100px;"><?php _e('Button position', 'hupso'); ?></td>
671
  <?php
672
- $button_position = hupso_sanitize(get_option( 'hupso_button_position', 'below' ));
673
  $checked = ' checked="checked" ';
674
  $hupso_below_checked = '';
675
  $hupso_above_checked = '';
@@ -698,49 +697,49 @@ function hupso_admin_settings_show() {
698
  $hupso_show_excerpts_checked = '';
699
 
700
  /* posts */
701
- $hupso_show_posts = hupso_sanitize(get_option( 'hupso_show_posts', '1' ));
702
  if ( $hupso_show_posts == 1 )
703
  $hupso_show_posts_checked = $checked;
704
  else
705
  $hupso_show_posts_checked = '';
706
 
707
  /* pages */
708
- $hupso_show_pages = hupso_sanitize(get_option( 'hupso_show_pages', '1' ));
709
  if ( $hupso_show_pages == 1 )
710
  $hupso_show_pages_checked = $checked;
711
  else
712
  $hupso_show_pages_checked = '';
713
 
714
  /* frontpage */
715
- $hupso_show_frontpage = hupso_sanitize(get_option( 'hupso_show_frontpage', '1' ));
716
  if ( $hupso_show_frontpage == 1 )
717
  $hupso_show_frontpage_checked = $checked;
718
  else
719
  $hupso_show_frontpage_checked = '';
720
 
721
  /* archive pages (categories, tags, dates, authors) */
722
- $hupso_show_category = hupso_sanitize(get_option( 'hupso_show_category', '1' ));
723
  if ( $hupso_show_category == 1 )
724
  $hupso_show_category_checked = $checked;
725
  else
726
  $hupso_show_category_checked = '';
727
 
728
  /* excerpts */
729
- $hupso_show_excerpts = hupso_sanitize(get_option( 'hupso_show_excerpts', '1' ));
730
  if ( $hupso_show_excerpts == 1 )
731
  $hupso_show_excerpts_checked = $checked;
732
  else
733
  $hupso_show_excerpts_checked = '';
734
 
735
  /* search pages */
736
- $hupso_show_search = hupso_sanitize(get_option( 'hupso_show_search', '1'));
737
  if ( $hupso_show_search == '1' )
738
  $hupso_show_search_checked = $checked;
739
  else
740
  $hupso_show_search_checked = '';
741
 
742
  /* password protected posts */
743
- $hupso_password_protected = hupso_sanitize(get_option( 'hupso_password_protected', '0'));
744
  if ( $hupso_password_protected == '1' )
745
  $hupso_password_protected_checked = $checked;
746
  else
@@ -769,15 +768,16 @@ function hupso_admin_settings_show() {
769
  echo '<p>' . __('Custom post types:', 'hupso') . '</p>';
770
 
771
  foreach ( $post_types as $post_type ) {
 
772
  $name = 'hupso_custom_post_' . $post_type;
773
- $val = hupso_sanitize(get_option( $name, '1' ));
774
  if ($val == '1') {
775
  $checked = ' checked="checked" ';
776
  }
777
  else {
778
  $checked = '';
779
  }
780
- echo '<input type="checkbox" name="' . $name .'" value="1" ' . $checked.' > ' . $post_type . '<br/>';
781
  }
782
  }
783
 
@@ -786,7 +786,7 @@ function hupso_admin_settings_show() {
786
  <br/><?php echo __('If you want to show share buttons just on some posts/pages do this:', 'hupso') . ' ' . __('1. Clear options for posts/pages above', 'hupso') . ', ' . __('2. Enable Add share buttons option to "Edit Post" screen - below', 'hupso') . ', ' . __('3. Edit any post or page and configure display of share buttons at the bottom of right sidebar (on "Edit Post" screen)', 'hupso') . '<br/>';
787
  /* add meta box */
788
  $checked = ' checked="checked" ';
789
- $hupso_meta_box = hupso_sanitize(get_option( 'hupso_meta_box', '' ));
790
  if ( $hupso_meta_box == 1 )
791
  $hupso_meta_box_checked = $checked;
792
  else
@@ -834,7 +834,7 @@ function hupso_admin_settings_show() {
834
  $hupso_title_text_post_checked = '';
835
 
836
  /* posts */
837
- $hupso_title_text = hupso_sanitize(get_option( 'hupso_title_text', 'post' ));
838
  if ( $hupso_title_text == 'page' )
839
  $hupso_title_text_page_checked = $checked;
840
  else
@@ -851,10 +851,10 @@ function hupso_admin_settings_show() {
851
  <?php
852
 
853
  /* Twitter via */
854
- $hupso_twitter_via = hupso_sanitize(get_option( 'hupso_twitter_via', '' ));
855
 
856
  ?>
857
- @<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', 'hupso', 'hupso');?>.</span><br/>
858
  </td>
859
  </tr>
860
 
@@ -872,7 +872,7 @@ function hupso_admin_settings_show() {
872
  $hupso_facebook_image_none_checked = '';
873
  $hupso_facebook_image_fch_checked = '';
874
 
875
- $hupso_facebook_image = hupso_sanitize(get_option( 'hupso_facebook_image', 'fch' ));
876
 
877
  switch ( $hupso_facebook_image ) {
878
  case 'header':
@@ -893,7 +893,7 @@ function hupso_admin_settings_show() {
893
  }
894
 
895
  /* Facebook custom image */
896
- $hupso_facebook_custom_image = hupso_sanitize(get_option( 'hupso_facebook_custom_image', '' ));
897
 
898
  /* Other */
899
  $header_image = trim(get_header_image());
@@ -901,9 +901,9 @@ function hupso_admin_settings_show() {
901
  ?>
902
  <span style="font-size:10px"><?php _e('All images for Facebook should be at least 200px in both dimensions (Facebook limitation)', 'hupso');?>.<br/><?php _e('After you change settings here, please wait 24 hours (or more) for Facebook to fetch new thumbnails', 'hupso');?>.<br/><?php _e('"og:image" meta tag with image url will be added to head of HTML. Select "None" to disable this feature', 'hupso');?>.<br/></span><br/>
903
 
904
- <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="header" <?php echo $hupso_facebook_image_header_checked; ?>/> <?php _e('Header image', 'hupso'); ?> <?php if ( $header_image != '' ) { echo '(<a href="' . $header_image . '" title="' . __( 'Click here to see full header image', 'hupso' ) . '" target="_blank">' . __( 'preview', 'hupso' ) . '</a>)'; } ?><br/>
905
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="featured" <?php echo $hupso_facebook_image_featured_checked; ?>/> <?php _e('Featured image of post', 'hupso'); ?><br/>
906
- <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_facebook_image_custom_checked; ?>/> <?php _e('Custom image from URL', 'hupso'); ?>: <input type="text" name="hupso_facebook_custom_image" onclick="hupso_create_code()" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" value="<?php echo $hupso_facebook_custom_image; ?>" /><br/>
907
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="none" <?php echo $hupso_facebook_image_none_checked; ?>/> <?php _e('None', 'hupso'); ?><br/>
908
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="fch" <?php echo $hupso_facebook_image_fch_checked; ?>/> <?php _e('FCH - use Featured image of post (if available), then use Custom image (if available), then use Header image (if available)', 'hupso'); ?><br/>
909
  </td>
@@ -915,10 +915,10 @@ function hupso_admin_settings_show() {
915
  <?php
916
 
917
  /* CSS Style */
918
- $hupso_css_style = hupso_sanitize(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
919
 
920
  ?>
921
- <input type="text" name="hupso_css_style" style="width:400px;" value="<?php echo $hupso_css_style;?>" /><br/><span><?php _e('Use CSS to style share buttons. For example: you can increase padding to have more free space above or below the buttons', 'hupso');?>.</span><br/>
922
  </td>
923
  </tr>
924
 
@@ -929,7 +929,7 @@ function hupso_admin_settings_show() {
929
 
930
  /* Widget Text */
931
  $checked = ' checked="checked" ';
932
- $hupso_widget_text = hupso_sanitize(get_option( 'hupso_widget_text', '1'));
933
  if ( $hupso_widget_text == '1' )
934
  $hupso_widget_text_checked = $checked;
935
  else
@@ -946,10 +946,10 @@ function hupso_admin_settings_show() {
946
  <?php
947
  /* page_title */
948
  $checked = ' checked="checked" ';
949
- $hupso_page_title = stripslashes(hupso_sanitize(get_option( 'hupso_page_title', '')));
950
  $hupso_page_title = htmlentities($hupso_page_title);
951
  ?>
952
- <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.', 'hupso'); ?><br/><?php _e('Leave this blank to use title of current page as text for sharing. [Default]', 'hupso'); ?>
953
  </td>
954
  </tr>
955
 
@@ -959,7 +959,7 @@ function hupso_admin_settings_show() {
959
  <?php
960
  /* page_url */
961
  $checked = ' checked="checked" ';
962
- $hupso_page_url = hupso_sanitize(get_option( 'hupso_page_url', ''));
963
  ?>
964
  <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.', 'hupso'); ?><br/><?php _e('Leave this blank to use url of current page for sharing. [Default]', 'hupso'); ?>
965
  </td>
@@ -974,12 +974,12 @@ function hupso_admin_settings_show() {
974
  $hupso_custom_icons_no_checked = '';
975
  $hupso_custom_icons_local_checked = '';
976
  $hupso_custom_icons_custom_checked = '';
977
- $hupso_custom_icons = hupso_sanitize(get_option( 'hupso_custom_icons', 'no'));
978
- $hupso_image_folder_url = hupso_sanitize(get_option( 'hupso_image_folder_url', ''));
979
- switch ( $hupso_custom_icons ) {
980
- case 'no': $hupso_custom_icons_no_checked = $checked; break;
981
- case 'local': $hupso_custom_icons_local_checked = $checked; break;
982
- case 'custom': $hupso_custom_icons_custom_checked = $checked; break;
983
  }
984
  $image_url = plugins_url('/hupso-share-buttons-for-twitter-facebook-google/img/services/');
985
  ?>
@@ -987,7 +987,7 @@ function hupso_admin_settings_show() {
987
  <input type="radio" name="hupso_custom_icons" onclick="hupso_create_code()" onchange="hupso_create_code()" value="local" <?php echo $hupso_custom_icons_local_checked; ?>/> <?php _e('Yes, serve images from local Wordpress folder. ', 'hupso'); ?>
988
  [<?php echo $image_url;?>]<br/>
989
  <input type="radio" name="hupso_custom_icons" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_custom_icons_custom_checked; ?>/> <?php _e('Yes, serve images from remote URL: ', 'hupso'); ?><br/>
990
- <input type="text" name="hupso_image_folder_url" value="<?php echo $hupso_image_folder_url;?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" /><br/><input type="hidden" name="hupso_image_folder_local" value="<?php echo $image_url;?>" /><?php _e('Enter URL to folder with custom social images. Include "/" at the end of the URL. If you would like to use custom icons, make sure you <a href="http://www.hupso.com/share/custom-social-icons.php" target="_blank">read instructions</a>.', 'hupso'); ?> <?php _e('This setting has no effect when using Counters.', 'hupso'); ?>
991
  </td>
992
  </tr>
993
  </div>
@@ -996,7 +996,7 @@ function hupso_admin_settings_show() {
996
  <?php
997
  $token = md5(microtime()) . rand();
998
  $_SESSION['h_settings_token'] = $token;
999
- echo '<input type="hidden" name="h_settings_token" value="' . $token . '">';
1000
  ?>
1001
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'hupso'); ?>" />
1002
  </form>
@@ -1010,30 +1010,6 @@ function hupso_admin_settings_show() {
1010
  }
1011
 
1012
 
1013
- function hupso_sanitize($text) {
1014
- $text = sanitize_text_field($text);
1015
- $text = str_ireplace('>', '', $text);
1016
- $text = str_ireplace('<', '', $text);
1017
- return $text;
1018
- }
1019
-
1020
- function hupso_sanitize_array($arr) {
1021
- if ($arr == NULL) return NULL;
1022
-
1023
- $new_array = array();
1024
- foreach ($arr as $key=>$val) {
1025
- $key = sanitize_text_field($key);
1026
- $key = str_ireplace('>', '', $key);
1027
- $key = str_ireplace('<', '', $key);
1028
-
1029
- $val = sanitize_text_field($val);
1030
- $val = str_ireplace('>', '', $val);
1031
- $val = str_ireplace('<', '', $val);
1032
- $new_array[$key] = $val;
1033
- }
1034
- return $new_array;
1035
- }
1036
-
1037
  function hupso_admin_settings_save() {
1038
  if ( !current_user_can( 'manage_options' ) ) {
1039
  wp_die( __( 'You do not have sufficient permissions to access this page.' , 'hupso') );
@@ -1049,18 +1025,18 @@ function hupso_admin_settings_save() {
1049
 
1050
  /* save button type */
1051
  if ( $post ) {
1052
- $hupso_button_type = hupso_sanitize(@$_POST[ 'button_type' ]);
1053
  update_option( 'hupso_button_type', $hupso_button_type );
1054
  } else {
1055
- $hupso_button_type = hupso_sanitize(get_option ( 'hupso_button_type', 'share_toolbar'));
1056
  }
1057
 
1058
  /* save button size */
1059
  if ( $post ) {
1060
- $hupso_button_size = hupso_sanitize(@$_POST[ 'size' ]);
1061
  update_option( 'hupso_button_size', $hupso_button_size );
1062
  } else {
1063
- $hupso_button_size = hupso_sanitize(get_option ( 'hupso_button_size', 'button100x23'));
1064
  }
1065
  $b_size = str_replace( 'button', '', $hupso_button_size);
1066
  if ($b_size != 'custom') {
@@ -1069,76 +1045,76 @@ function hupso_admin_settings_save() {
1069
 
1070
  /* save share button custom URL */
1071
  if ( $post ) {
1072
- $hupso_button_image_custom_url = hupso_sanitize(@$_POST[ 'hupso_button_image_custom_url' ]);
1073
  update_option( 'hupso_button_image_custom_url', $hupso_button_image_custom_url );
1074
  }
1075
 
1076
  /* save background & border color */
1077
  if ( $post ) {
1078
- $hupso_background_color = hupso_sanitize(@$_POST[ 'background_color' ]);
1079
  update_option( 'hupso_background_color', $hupso_background_color );
1080
 
1081
- $hupso_border_color = hupso_sanitize(@$_POST[ 'border_color' ]);
1082
  update_option( 'hupso_border_color', $hupso_border_color );
1083
  }
1084
 
1085
  /* save custom icons */
1086
  if ( $post ) {
1087
- $hupso_custom_icons = hupso_sanitize(@$_POST[ 'hupso_custom_icons' ]);
1088
  update_option( 'hupso_custom_icons', $hupso_custom_icons );
1089
 
1090
- $hupso_image_folder_url = hupso_sanitize(@$_POST[ 'hupso_image_folder_url' ]);
1091
  update_option( 'hupso_image_folder_url ', $hupso_image_folder_url );
1092
  }
1093
 
1094
  /* save toolbar size */
1095
  if ( $post ) {
1096
- $hupso_toolbar_size = hupso_sanitize(@$_POST[ 'select_toolbar_size' ]);
1097
  update_option( 'hupso_toolbar_size', $hupso_toolbar_size );
1098
  } else {
1099
- $hupso_button_size = hupso_sanitize(get_option ( 'hupso_toolbar_size', 'medium'));
1100
  }
1101
 
1102
  /* save share_image */
1103
  if ( $post ) {
1104
- $hupso_share_image = hupso_sanitize(@$_POST[ 'hupso_share_image' ]);
1105
  update_option( 'hupso_share_image', $hupso_share_image );
1106
  } else {
1107
- $hupso_share_image = hupso_sanitize(get_option ( 'hupso_share_image', 'normal'));
1108
  }
1109
 
1110
  /* save share_image_lang */
1111
  if ( $post ) {
1112
- $hupso_share_image_lang = hupso_sanitize(@$_POST[ 'share_image_lang' ]);
1113
  update_option( 'hupso_share_image_lang', $hupso_share_image_lang );
1114
  } else {
1115
- $hupso_share_image_lang = hupso_sanitize(get_option ( 'hupso_share_image_lang', ''));
1116
  }
1117
 
1118
  /* save share_image_custom_url */
1119
  if ( $post ) {
1120
- $hupso_share_image_custom_url = hupso_sanitize(@$_POST[ 'hupso_share_image_custom_url' ]);
1121
  update_option( 'hupso_share_image_custom_url', $hupso_share_image_custom_url );
1122
  } else {
1123
- $hupso_share_image_custom_url = hupso_sanitize(get_option ( 'hupso_share_image_custom_url', ''));
1124
  }
1125
 
1126
 
1127
  /* save services */
1128
  $hupso_vars = 'var hupso_services=new Array(';
1129
  foreach ( $hupso_all_services as $service_text ) {
1130
- $service_text = hupso_sanitize($service_text);
1131
  $service_name = strtolower( $service_text );
1132
  $service_name = str_replace( ' ', '', $service_name );
1133
  if ( $post ) {
1134
- $value = hupso_sanitize(@$_POST[ $service_name ]);
1135
  update_option( 'hupso_' . $service_name, $value );
1136
  }
1137
  else {
1138
- $value = hupso_sanitize(get_option ( 'hupso_' . $service_name, in_array( $service_text, (array) $hupso_default_services ) ));
1139
  }
1140
  if ( $value == '1' ) {
1141
- $hupso_vars .= '"' . hupso_sanitize($service_text) .'",';
1142
  }
1143
  }
1144
  $hupso_vars .= ');';
@@ -1146,135 +1122,135 @@ function hupso_admin_settings_save() {
1146
 
1147
  /* save hupso_counters_lang*/
1148
  if ( $post ) {
1149
- $hupso_counters_lang = hupso_sanitize(@$_POST[ 'hupso_counters_lang' ]);
1150
  update_option( 'hupso_counters_lang', $hupso_counters_lang );
1151
  }
1152
 
1153
  /* save menu type */
1154
  if ( $post ) {
1155
- $hupso_menu_type = hupso_sanitize(@$_POST[ 'menu_type' ]);
1156
  update_option( 'hupso_menu_type', $hupso_menu_type );
1157
  }
1158
  else {
1159
- $hupso_menu_type = hupso_sanitize(get_option ( 'hupso_menu_type', 'labels' ));
1160
  }
1161
- $hupso_vars .= 'var hupso_icon_type = "' . hupso_sanitize($hupso_menu_type) . '";';
1162
 
1163
  /* save button position */
1164
  if ( $post ) {
1165
- $hupso_button_position = hupso_sanitize(@$_POST[ 'hupso_button_position' ]);
1166
  update_option( 'hupso_button_position', $hupso_button_position );
1167
  }
1168
  else {
1169
- $hupso_button_position = hupso_sanitize(get_option( 'hupso_button_position', 'below' ));
1170
  }
1171
 
1172
  /* save display options */
1173
  if ( $post ) {
1174
- $hupso_show_posts = hupso_sanitize(@$_POST[ 'hupso_show_posts' ]);
1175
  update_option( 'hupso_show_posts', $hupso_show_posts );
1176
 
1177
- $hupso_show_pages = hupso_sanitize(@$_POST[ 'hupso_show_pages' ]);
1178
  update_option( 'hupso_show_pages', $hupso_show_pages );
1179
 
1180
- $hupso_show_frontpage = hupso_sanitize(@$_POST[ 'hupso_show_frontpage' ]);
1181
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
1182
 
1183
- $hupso_show_category = hupso_sanitize(@$_POST[ 'hupso_show_category' ]);
1184
  update_option( 'hupso_show_category', $hupso_show_category );
1185
 
1186
- $hupso_show_excerpts = hupso_sanitize(@$_POST[ 'hupso_show_excerpts' ]);
1187
  update_option( 'hupso_show_excerpts', $hupso_show_excerpts );
1188
 
1189
- $hupso_show_search = hupso_sanitize(@$_POST[ 'hupso_show_search' ]);
1190
  update_option( 'hupso_show_search', $hupso_show_search );
1191
 
1192
  }
1193
 
1194
  /* save options for counters */
1195
  if ( $post ) {
1196
- $twitter_tweet = hupso_sanitize(@$_POST[ 'twitter_tweet' ]);
1197
  update_option( 'hupso_twitter_tweet', $twitter_tweet );
1198
 
1199
- $facebook_like = hupso_sanitize(@$_POST[ 'facebook_like' ]);
1200
  update_option( 'hupso_facebook_like', $facebook_like );
1201
 
1202
- $facebook_send = hupso_sanitize(@$_POST[ 'facebook_send' ]);
1203
  update_option( 'hupso_facebook_send', $facebook_send );
1204
 
1205
- $google_plus_one = hupso_sanitize(@$_POST[ 'google_plus_one' ]);
1206
  update_option( 'hupso_google_plus_one', $google_plus_one );
1207
 
1208
- $pinterest_pin = hupso_sanitize(@$_POST[ 'pinterest_pin' ]);
1209
  update_option( 'hupso_pinterest_pin', $pinterest_pin );
1210
 
1211
- $email_button = hupso_sanitize(@$_POST[ 'email_button' ]);
1212
  update_option( 'hupso_email_button', $email_button );
1213
 
1214
- $print_button = hupso_sanitize(@$_POST[ 'print_button' ]);
1215
  update_option( 'hupso_print_button', $print_button );
1216
 
1217
- $linkedin_share = hupso_sanitize(@$_POST[ 'linkedin_share' ]);
1218
  update_option( 'hupso_linkedin_share', $linkedin_share );
1219
  }
1220
 
1221
  /* Get title for sharing from */
1222
  if ( $post ) {
1223
- $hupso_title_text = hupso_sanitize(@$_POST[ 'hupso_title_text' ]);
1224
  update_option( 'hupso_title_text', $hupso_title_text );
1225
  }
1226
 
1227
  /* Save twitter_via */
1228
  if ( $post ) {
1229
- $hupso_twitter_via = hupso_sanitize(@$_POST[ 'hupso_twitter_via' ]);
1230
  update_option( 'hupso_twitter_via', $hupso_twitter_via );
1231
  }
1232
 
1233
  /* Save Facebook image */
1234
  if ( $post ) {
1235
- $hupso_facebook_image = hupso_sanitize(@$_POST[ 'hupso_facebook_image' ]);
1236
  update_option( 'hupso_facebook_image', $hupso_facebook_image );
1237
  }
1238
 
1239
  /* Save Facebook custom image */
1240
  if ( $post ) {
1241
- $hupso_facebook_custom_image = hupso_sanitize(@$_POST[ 'hupso_facebook_custom_image' ]);
1242
  update_option( 'hupso_facebook_custom_image', $hupso_facebook_custom_image );
1243
  }
1244
 
1245
  /* Save CSS style */
1246
  if ( $post ) {
1247
- $hupso_css_style = hupso_sanitize(@$_POST[ 'hupso_css_style' ]);
1248
  update_option( 'hupso_css_style', $hupso_css_style );
1249
  }
1250
 
1251
  /* Save page_url */
1252
  if ( $post ) {
1253
- $hupso_page_url = hupso_sanitize(@$_POST[ 'page_url' ]);
1254
  update_option( 'hupso_page_url', $hupso_page_url );
1255
  }
1256
 
1257
  /* Save page_title */
1258
  if ( $post ) {
1259
- $hupso_page_title = hupso_sanitize(@$_POST[ 'page_title' ]);
1260
  update_option( 'hupso_page_title', $hupso_page_title );
1261
  }
1262
 
1263
  /* Save hupso_widget_text */
1264
  if ( $post ) {
1265
- $hupso_widget_text = hupso_sanitize(@$_POST[ 'hupso_widget_text' ]);
1266
  update_option( 'hupso_widget_text', $hupso_widget_text );
1267
  }
1268
 
1269
  /* Save hupso_password_protected */
1270
  if ( $post ) {
1271
- $hupso_password_protected = hupso_sanitize(@$_POST[ 'hupso_password_protected' ]);
1272
  update_option( 'hupso_password_protected', $hupso_password_protected );
1273
  }
1274
 
1275
  /* save hupso_hide_categories */
1276
  if ( $post ) {
1277
- $hupso_hide_categories = hupso_sanitize_array(@$_POST['hupso_hide_categories']);
1278
  update_option( 'hupso_hide_categories', $hupso_hide_categories );
1279
  }
1280
 
@@ -1286,7 +1262,7 @@ function hupso_admin_settings_save() {
1286
 
1287
  /* save hupso_meta_box */
1288
  if ( $post ) {
1289
- $hupso_meta_box = hupso_sanitize(@$_POST[ 'hupso_meta_box' ]);
1290
  update_option( 'hupso_meta_box', $hupso_meta_box );
1291
  }
1292
 
@@ -1299,9 +1275,9 @@ function hupso_admin_settings_save() {
1299
  $operator = 'and'; // 'and' or 'or'
1300
  $post_types = get_post_types( $args, $output, $operator );
1301
  foreach ( $post_types as $post_type ) {
1302
- $post_type = hupso_sanitize($post_type);
1303
  $name = 'hupso_custom_post_' . $post_type;
1304
- $val = hupso_sanitize(@$_POST[$name]);
1305
  if ($val == '') {
1306
  update_option ( $name, '0' );
1307
  }
@@ -1331,7 +1307,7 @@ function hupso_the_excerpt( $content ) {
1331
  $hupso_state = 'normal';
1332
 
1333
 
1334
- $hupso_show_excerpts = hupso_sanitize(get_option( 'hupso_show_excerpts' , '1' ));
1335
  if ( ( $hupso_show_excerpts == 1 ) && ( $post->post_type != 'attachment' ) ) {
1336
  return hupso_the_content ( $content );
1337
  }
@@ -1345,7 +1321,7 @@ function hupso_the_content_shortcodes( $content ) {
1345
  global $post_url, $post_title, $hupso_shortcode_params;
1346
 
1347
  $value = '';
1348
- $hupso_meta_box = hupso_sanitize(get_option( 'hupso_meta_box', '' ));
1349
  if ($hupso_meta_box != "1") {
1350
  $value = '';
1351
  } else {
@@ -1389,17 +1365,17 @@ function hupso_the_content_shortcodes( $content ) {
1389
  else {
1390
  $current_category = '';
1391
  }
1392
- $hupso_hide_categories = hupso_sanitize(get_option( 'hupso_hide_categories' , array() ));
1393
  if ( $hupso_hide_categories == '' ) {
1394
  $hupso_hide_categories = array();
1395
  }
1396
 
1397
- $hupso_title_text = hupso_sanitize(get_option( 'hupso_title_text' , 'post' ));
1398
- $hupso_twitter_via = hupso_sanitize(get_option( 'hupso_twitter_via', '' ));
1399
- $hupso_counters_lang = hupso_sanitize(get_option( 'hupso_counters_lang', 'en_US' ));
1400
 
1401
- $hupso_page_url = hupso_sanitize(get_option( 'hupso_page_url', '' ));
1402
- $hupso_page_title = stripslashes(hupso_sanitize(get_option( 'hupso_page_title', '' )));
1403
 
1404
 
1405
  /* default code */
@@ -1410,7 +1386,7 @@ function hupso_the_content_shortcodes( $content ) {
1410
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1411
  }
1412
 
1413
- $button_type = hupso_sanitize(get_option( 'hupso_button_type', 'share_toolbar' ));
1414
 
1415
  /* Check for old saved button code, prior to version 1.3 */
1416
  if ( get_option( 'hupso_custom', '0' ) == 0 ) {
@@ -1451,7 +1427,7 @@ function hupso_the_content_shortcodes( $content ) {
1451
 
1452
  /* Twitter via @ */
1453
  if ( $hupso_twitter_via != '') {
1454
- $code .= 'var hupso_twitter_via="' . $hupso_twitter_via . '";';
1455
  }
1456
 
1457
  /* Get shortcode params (if they exist) */
@@ -1482,13 +1458,13 @@ function hupso_the_content_shortcodes( $content ) {
1482
 
1483
  switch ( $button_type ) {
1484
  case 'share_button':
1485
- $code .= 'var hupso_url="' . $new_url . '";';
1486
  break;
1487
  case 'share_toolbar':
1488
- $code .= 'var hupso_url_t="' . $new_url . '";';
1489
  break;
1490
  case 'counters':
1491
- $code .= 'var hupso_url_c="' . $new_url . '";';
1492
  break;
1493
  }
1494
 
@@ -1512,13 +1488,13 @@ function hupso_the_content_shortcodes( $content ) {
1512
 
1513
  switch ( $button_type ) {
1514
  case 'share_button':
1515
- $code .= 'var hupso_title="' . str_replace('"', '&quot;', $new_title) . '";';
1516
  break;
1517
  case 'share_toolbar':
1518
- $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $new_title) . '";';
1519
  break;
1520
  case 'counters':
1521
- $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $new_title) . '";';
1522
  break;
1523
  }
1524
  }
@@ -1540,11 +1516,11 @@ function hupso_the_content_shortcodes( $content ) {
1540
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1541
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1542
 
1543
- $position = hupso_sanitize(get_option( 'hupso_button_position', 'below' ));
1544
 
1545
- $hupso_css_style = hupso_sanitize(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
1546
  if ($hupso_css_style != '') {
1547
- $hupso_css_out = ' style="' . $hupso_css_style . '"';
1548
  }
1549
  else {
1550
  $hupso_css_out = '';
@@ -1590,7 +1566,7 @@ function hupso_the_content( $content ) {
1590
  }
1591
 
1592
  $value = '';
1593
- $hupso_meta_box = hupso_sanitize(get_option( 'hupso_meta_box', '' ));
1594
  if ($hupso_meta_box != "1") {
1595
  $value = '';
1596
  } else {
@@ -1623,7 +1599,7 @@ function hupso_the_content( $content ) {
1623
  else {
1624
  $name = '';
1625
  }
1626
- $val = hupso_sanitize(get_option( $name, '1' ));
1627
  if ($val == '0') {
1628
  $content = str_ireplace('[hupso_hide]', '', $content);
1629
  $content = str_ireplace('[hupso]', '', $content);
@@ -1649,7 +1625,7 @@ function hupso_the_content( $content ) {
1649
 
1650
  /* Do not show share buttons on password protected pages, but show it inside widget */
1651
  $pass = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_password : '' );
1652
- $hupso_password_protected = hupso_sanitize(get_option( 'hupso_password_protected', '0'));
1653
  if ( $hupso_state == 'normal' ) {
1654
  if ($pass != '') {
1655
  if (!$hupso_password_protected) {
@@ -1665,7 +1641,7 @@ function hupso_the_content( $content ) {
1665
  }
1666
  }
1667
 
1668
- $hupso_show_search = hupso_sanitize(get_option( 'hupso_show_search' , '1' ));
1669
  if ( ($hupso_state == 'normal') && (is_search()) && ($hupso_show_search != 1) ) {
1670
  $content = str_ireplace('[hupso_hide]', '', $content);
1671
  $content = str_ireplace('[hupso]', '', $content);
@@ -1673,7 +1649,7 @@ function hupso_the_content( $content ) {
1673
  return $content;
1674
  }
1675
 
1676
- $hupso_show_posts = hupso_sanitize(get_option( 'hupso_show_posts' , '1' ));
1677
  if ( ($hupso_state == 'normal') && (is_single()) && ($hupso_show_posts != 1) ) {
1678
  $content = str_ireplace('[hupso_hide]', '', $content);
1679
  $content = str_ireplace('[hupso]', '', $content);
@@ -1682,7 +1658,7 @@ function hupso_the_content( $content ) {
1682
 
1683
  }
1684
 
1685
- $hupso_show_pages = hupso_sanitize(get_option( 'hupso_show_pages' , '1' ));
1686
  if ( ($hupso_state == 'normal') && (is_page()) && ($hupso_show_pages != 1) ) {
1687
  $content = str_ireplace('[hupso_hide]', '', $content);
1688
  $content = str_ireplace('[hupso]', '', $content);
@@ -1691,8 +1667,8 @@ function hupso_the_content( $content ) {
1691
 
1692
  }
1693
 
1694
- $hupso_show_frontpage = hupso_sanitize(get_option( 'hupso_show_frontpage' , '1' ));
1695
- $hupso_show_category = hupso_sanitize(get_option( 'hupso_show_category' , '1' ));
1696
 
1697
  /* Do not show share buttons if option is disabled */
1698
  if ( ($hupso_state == 'normal') && (is_home()) && ($hupso_show_frontpage != 1) ) {
@@ -1719,7 +1695,7 @@ function hupso_the_content( $content ) {
1719
  else {
1720
  $current_category = '';
1721
  }
1722
- $hupso_hide_categories = hupso_sanitize(get_option( 'hupso_hide_categories' , array() ));
1723
  if ( $hupso_hide_categories == '' ) {
1724
  $hupso_hide_categories = array();
1725
  }
@@ -1731,9 +1707,9 @@ function hupso_the_content( $content ) {
1731
 
1732
  }
1733
 
1734
- $hupso_title_text = hupso_sanitize(get_option( 'hupso_title_text' , 'post' ));
1735
- $hupso_twitter_via = hupso_sanitize(get_option( 'hupso_twitter_via', '' ));
1736
- $hupso_counters_lang = hupso_sanitize(get_option( 'hupso_counters_lang', 'en_US' ));
1737
 
1738
  $post_url = ( isset($GLOBALS['post']) ? get_permalink($GLOBALS['post']->ID) : get_permalink() );
1739
  $post_title = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_title : '' );
@@ -1749,8 +1725,8 @@ function hupso_the_content( $content ) {
1749
  $post_title = '';
1750
  }
1751
 
1752
- $hupso_page_url = hupso_sanitize(get_option( 'hupso_page_url', '' ));
1753
- $hupso_page_title = stripslashes(hupso_sanitize(get_option( 'hupso_page_title', '' )));
1754
 
1755
 
1756
  /* default code */
@@ -1761,7 +1737,7 @@ function hupso_the_content( $content ) {
1761
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1762
  }
1763
 
1764
- $button_type = get_option( 'hupso_button_type', 'share_toolbar' );
1765
 
1766
  /* Check for old saved button code, prior to version 1.3 */
1767
  if ( get_option( 'hupso_custom', '0' ) == 0 ) {
@@ -1802,7 +1778,7 @@ function hupso_the_content( $content ) {
1802
 
1803
  /* Twitter via @ */
1804
  if ( $hupso_twitter_via != '') {
1805
- $code .= 'var hupso_twitter_via="' . $hupso_twitter_via . '";';
1806
  }
1807
 
1808
  /* Get shortcode params (if they exist) */
@@ -1841,13 +1817,13 @@ function hupso_the_content( $content ) {
1841
 
1842
  switch ( $button_type ) {
1843
  case 'share_button':
1844
- $code .= 'var hupso_url="' . $new_url . '";';
1845
  break;
1846
  case 'share_toolbar':
1847
- $code .= 'var hupso_url_t="' . $new_url . '";';
1848
  break;
1849
  case 'counters':
1850
- $code .= 'var hupso_url_c="' . $new_url . '";';
1851
  break;
1852
  }
1853
 
@@ -1868,13 +1844,13 @@ function hupso_the_content( $content ) {
1868
 
1869
  switch ( $button_type ) {
1870
  case 'share_button':
1871
- $code .= 'var hupso_title="' . str_replace('"', '&quot;', $new_title) . '";';
1872
  break;
1873
  case 'share_toolbar':
1874
- $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $new_title) . '";';
1875
  break;
1876
  case 'counters':
1877
- $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $new_title) . '";';
1878
  break;
1879
  }
1880
  }
@@ -1896,11 +1872,11 @@ function hupso_the_content( $content ) {
1896
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1897
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1898
 
1899
- $position = hupso_sanitize(get_option( 'hupso_button_position', 'below' ));
1900
 
1901
- $hupso_css_style = hupso_sanitize(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
1902
  if ($hupso_css_style != '') {
1903
- $hupso_css_out = ' style="' . $hupso_css_style . '"';
1904
  }
1905
  else {
1906
  $hupso_css_out = '';
@@ -1943,11 +1919,12 @@ function hupso_settings_print_services() {
1943
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
1944
 
1945
  foreach ( $hupso_all_services as $service_text ) {
 
1946
  $service_name = strtolower( $service_text );
1947
  $service_name = str_replace( ' ', '', $service_name );
1948
 
1949
  $checked = '';
1950
- $value = hupso_sanitize(get_option( 'hupso_' . $service_name , in_array( $service_text, (array) $hupso_default_services ) ));
1951
  if ( $value == "1" ) {
1952
  $checked = 'checked="checked"';
1953
  }
@@ -2052,7 +2029,7 @@ function hupso_counters_lang_list() {
2052
 
2053
  asort($languages);
2054
  echo '<option value="en_US">English (US)</option>';
2055
- $hupso_counters_lang = hupso_sanitize(get_option( 'hupso_counters_lang', 'en_US' ));
2056
  if ($hupso_counters_lang == '') {
2057
  $hupso_counters_lang = 'en_US';
2058
  }
@@ -2062,7 +2039,7 @@ function hupso_counters_lang_list() {
2062
  $sel_lang = ' selected ';
2063
  else
2064
  $sel_lang = '';
2065
- echo '<option value="' . $lang_code . '"'. $sel_lang .'>' . $lang_name . '</option>';
2066
  }
2067
 
2068
  }
3
  Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
4
  Plugin URI: http://www.hupso.com/share/
5
  Description: Add simple social share 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, Tumblr, Pinterest, StumbleUpon, Digg, Reddit, Bebo, VKontakte 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: 4.0.6
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
  global $HUPSO_VERSION;
15
+ $HUPSO_VERSION = '4.0.6';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
72
 
73
 
74
  /* Use shortcodes in text widgets */
75
+ $hupso_widget_text = get_option( 'hupso_widget_text', '1');
76
  if ( $hupso_widget_text == '1' ) {
77
  add_filter('widget_text', 'do_shortcode');
78
  }
79
 
80
  /* Meta box on "Edit Post" screen */
81
+ $hupso_meta_box = get_option( 'hupso_meta_box', '' );
82
  if ($hupso_meta_box == "1") {
83
  include_once(plugin_dir_path( __FILE__ ) . '/share-buttons-hupso-meta.php');
84
  }
201
  function hupso_plugin_activation() {
202
 
203
  /* Fix for bug in version 3.0 */
204
+ $size = get_option( 'hupso_button_size', '');
205
  if ( ($size == 'share_button') or ($size == 'share_toolbar') or ($size == 'counters') ) {
206
  @update_option( 'hupso_button_size', 'button100x23');
207
  }
226
  */
227
 
228
  $thumb_image = '';
229
+ $hupso_facebook_image = sanitize_text_field(get_option( 'hupso_facebook_image', 'fch' ));
230
+ $hupso_facebook_custom_image = esc_url(get_option( 'hupso_facebook_custom_image', '' ));
231
 
232
  switch ( $hupso_facebook_image ) {
233
  case 'header':
261
 
262
 
263
  if ( $thumb_image != '' ) {
264
+ echo '<meta property="og:image" content="' . esc_url($thumb_image) . '"/>';
265
  }
266
  }
267
 
306
  }
307
  }
308
 
 
309
  echo '<div id="save_warning"></div>';
310
  echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
311
  echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)', 'hupso').'</h2>';
363
 
364
 
365
  $checked = 'checked="checked"';
366
+ $current_button_size = sanitize_text_field(get_option( 'hupso_button_size' , 'button100x23' ));
367
  $button60_checked = '';
368
  $button80_checked = '';
369
  $button100_checked = '';
391
  <td style="width:100px;"><?php _e('Button type', 'hupso'); ?>
392
  </td>
393
  <?php
394
+ $hupso_button_type = sanitize_text_field(get_option( 'hupso_button_type', 'share_toolbar' ));
395
+ $hupso_button_image_custom_url = esc_url(get_option( 'hupso_button_image_custom_url', ''));
396
  $checked = ' checked="checked" ';
397
  $hupso_share_button_checked = '';
398
  $hupso_share_toolbar_checked = '';
424
  <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>
425
  <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>
426
  <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>
427
+ <tr><td><input type="radio" name="size" value="custom" onclick="hupso_create_code()" onchange="hupso_create_code()" <?php echo $share_button_custom_checked; ?> /></td><td style="padding-left:10px;"><?php _e('Custom image from URL', 'hupso'); ?>: <input type="text" name="hupso_button_image_custom_url" onchange="create_code()" style="width:300px;" value="<?php echo esc_url($hupso_button_image_custom_url); ?>"/><br/> See <a href="http://www.hupso.com/share/gallery.php" target="_blank">gallery of custom share buttons</a>.</td></tr>
428
  </table>
429
  <hr style="height:1px; width:500px;"/>
430
  </td>
438
  <td style="width:100px;"><?php _e('Toolbar size', 'hupso'); ?></td>
439
  <td style="width:100px">
440
  <?php
441
+ $hupso_toolbar_size = sanitize_text_field(get_option( 'hupso_toolbar_size', 'medium' ));
442
  $hupso_toolbar_size_big_checked = '';
443
  $hupso_toolbar_size_medium_checked = '';
444
  $hupso_toolbar_size_small_checked = '';
469
 
470
  /* hupso_share_image */
471
  $checked = ' checked="checked" ';
472
+ $hupso_share_image = sanitize_text_field(get_option( 'hupso_share_image', 'normal' ));
473
  $hupso_share_image_show_checked = '';
474
  $hupso_share_image_hide_checked = '';
475
  $hupso_share_image_lang_checked = '';
482
  case 'custom': $hupso_share_image_custom_checked = $checked; break;
483
  }
484
 
485
+ $hupso_share_image_lang = sanitize_text_field(get_option ( 'hupso_share_image_lang', '' ));
486
+ $hupso_share_image_custom_url = esc_url(get_option ( 'hupso_share_image_custom_url', '' ));
487
 
488
  ?>
489
  <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="show" <?php echo $hupso_share_image_show_checked; ?>/> <?php _e('Show in language', 'hupso');?>:
515
  <option value="tr" <?php if ($hupso_share_image_lang == 'tr') echo ' selected ';?>>Turkish</option>
516
  </select><br/>
517
  <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', 'hupso'); ?><br/>
518
+ <input type="radio" name="hupso_share_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_share_image_custom_checked; ?>/> <?php _e('Custom image from URL', 'hupso'); ?>: <input name="hupso_share_image_custom_url" type="text" onmouseout="hupso_create_code()" onchange="hupso_create_code()" value="<?php echo esc_url($hupso_share_image_custom_url);?>" size="50" /><br/><span style="padding-left:30px; font-size:10px;">(<?php _e('Optimal image height: 32px - big, 24px - medium, 16px - small/counters', 'hupso'); ?>)</span><br/>
519
  <hr style="height:1px; width:500px;"/>
520
  </td>
521
  </tr>
524
 
525
  <?php
526
  /* background & border color */
527
+ $hupso_background_color = sanitize_hex_color_no_hash(get_option( 'hupso_background_color', 'EAF4FF'));
528
+ $hupso_border_color = sanitize_hex_color_no_hash(get_option( 'hupso_border_color', '66CCFF'));
529
  ?>
530
  <div id="show_color">
531
  <table style="border: 0px;">
532
+ <tr><td style="width:100px;"><?php _e('Background color');?></td><td><input class="color" type="text" id="background_color" name="background_color" value="#<?php echo esc_attr($hupso_background_color); ?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" style="width: 100px;" /><input style="margin-left:30px;" type="button" value="Restore default" onclick="hupso_restore_background_color()" /></td></tr>
533
+ <tr><td style="width:100px;"><?php _e('Border color');?></td><td><input class="color" type="text" id="border_color" name="border_color" value="#<?php echo esc_attr($hupso_border_color); ?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" style="width: 100px;" /><input style="margin-left:30px;" type="button" value="Restore default" onclick="hupso_restore_border_color()" /> <hr style="height:1px; width:500px;"/></td></tr>
534
  </table>
535
  </div>
536
 
555
  $print_button_checked = '';
556
  $linkedin_share_checked = '';
557
 
558
+ $twitter_tweet = get_option( 'hupso_twitter_tweet', '1' );
559
  if ( $twitter_tweet == 1 ) $twitter_tweet_checked = $checked;
560
 
561
+ $facebook_like = get_option( 'hupso_facebook_like', '1' );
562
  if ( $facebook_like == 1 ) $facebook_like_checked = $checked;
563
 
564
+ $facebook_send = get_option( 'hupso_facebook_send', '1' );
565
  if ( $facebook_send == 1 ) $facebook_send_checked = $checked;
566
 
567
+ $google_plus_one = get_option( 'hupso_google_plus_one', '1' );
568
  if ( $google_plus_one == 1 ) $google_plus_one_checked = $checked;
569
 
570
+ $pinterest_pin = get_option( 'hupso_pinterest_pin', '1' );
571
  if ( $pinterest_pin == 1 ) $pinterest_pin_checked = $checked;
572
 
573
+ $email_button = get_option( 'hupso_email_button', '0' );
574
  if ( $email_button == 1 ) $email_button_checked = $checked;
575
 
576
+ $print_button = get_option( 'hupso_print_button', '0' );
577
  if ( $print_button == 1 ) $print_button_checked = $checked;
578
 
579
+ $linkedin_share = get_option( 'hupso_linkedin_share', '0' );
580
  if ( $linkedin_share == 1 ) $linkedin_share_checked = $checked;
581
  ?>
582
  <div id="counters_config" style="display:none;">
647
  <tr>
648
  <td style="width:100px;"><?php _e('Type of menu', 'hupso'); ?></td>
649
  <?php
650
+ $menu_type = sanitize_text_field(get_option( 'hupso_menu_type', 'labels' ));
651
  $checked = ' checked="checked" ';
652
  $hupso_labels_checked = '';
653
  $hupso_icons_checked = '';
668
  <tr>
669
  <td style="width:100px;"><?php _e('Button position', 'hupso'); ?></td>
670
  <?php
671
+ $button_position = sanitize_text_field(get_option( 'hupso_button_position', 'below' ));
672
  $checked = ' checked="checked" ';
673
  $hupso_below_checked = '';
674
  $hupso_above_checked = '';
697
  $hupso_show_excerpts_checked = '';
698
 
699
  /* posts */
700
+ $hupso_show_posts = get_option( 'hupso_show_posts', '1' );
701
  if ( $hupso_show_posts == 1 )
702
  $hupso_show_posts_checked = $checked;
703
  else
704
  $hupso_show_posts_checked = '';
705
 
706
  /* pages */
707
+ $hupso_show_pages = get_option( 'hupso_show_pages', '1' );
708
  if ( $hupso_show_pages == 1 )
709
  $hupso_show_pages_checked = $checked;
710
  else
711
  $hupso_show_pages_checked = '';
712
 
713
  /* frontpage */
714
+ $hupso_show_frontpage = get_option( 'hupso_show_frontpage', '1' );
715
  if ( $hupso_show_frontpage == 1 )
716
  $hupso_show_frontpage_checked = $checked;
717
  else
718
  $hupso_show_frontpage_checked = '';
719
 
720
  /* archive pages (categories, tags, dates, authors) */
721
+ $hupso_show_category = get_option( 'hupso_show_category', '1' );
722
  if ( $hupso_show_category == 1 )
723
  $hupso_show_category_checked = $checked;
724
  else
725
  $hupso_show_category_checked = '';
726
 
727
  /* excerpts */
728
+ $hupso_show_excerpts = get_option( 'hupso_show_excerpts', '1' );
729
  if ( $hupso_show_excerpts == 1 )
730
  $hupso_show_excerpts_checked = $checked;
731
  else
732
  $hupso_show_excerpts_checked = '';
733
 
734
  /* search pages */
735
+ $hupso_show_search = get_option( 'hupso_show_search', '1');
736
  if ( $hupso_show_search == '1' )
737
  $hupso_show_search_checked = $checked;
738
  else
739
  $hupso_show_search_checked = '';
740
 
741
  /* password protected posts */
742
+ $hupso_password_protected = get_option( 'hupso_password_protected', '0');
743
  if ( $hupso_password_protected == '1' )
744
  $hupso_password_protected_checked = $checked;
745
  else
768
  echo '<p>' . __('Custom post types:', 'hupso') . '</p>';
769
 
770
  foreach ( $post_types as $post_type ) {
771
+ $post_type = sanitize_text_field($post_type);
772
  $name = 'hupso_custom_post_' . $post_type;
773
+ $val = get_option( $name, '1' );
774
  if ($val == '1') {
775
  $checked = ' checked="checked" ';
776
  }
777
  else {
778
  $checked = '';
779
  }
780
+ echo '<input type="checkbox" name="' . esc_attr($name) . '" value="1" ' . $checked . ' > ' . esc_attr($post_type) . '<br/>';
781
  }
782
  }
783
 
786
  <br/><?php echo __('If you want to show share buttons just on some posts/pages do this:', 'hupso') . ' ' . __('1. Clear options for posts/pages above', 'hupso') . ', ' . __('2. Enable Add share buttons option to "Edit Post" screen - below', 'hupso') . ', ' . __('3. Edit any post or page and configure display of share buttons at the bottom of right sidebar (on "Edit Post" screen)', 'hupso') . '<br/>';
787
  /* add meta box */
788
  $checked = ' checked="checked" ';
789
+ $hupso_meta_box = get_option( 'hupso_meta_box', '' );
790
  if ( $hupso_meta_box == 1 )
791
  $hupso_meta_box_checked = $checked;
792
  else
834
  $hupso_title_text_post_checked = '';
835
 
836
  /* posts */
837
+ $hupso_title_text = get_option( 'hupso_title_text', 'post' );
838
  if ( $hupso_title_text == 'page' )
839
  $hupso_title_text_page_checked = $checked;
840
  else
851
  <?php
852
 
853
  /* Twitter via */
854
+ $hupso_twitter_via = sanitize_text_field(get_option( 'hupso_twitter_via', '' ));
855
 
856
  ?>
857
+ @<input type="text" name="hupso_twitter_via" onclick="hupso_create_code()" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="30" value="<?php echo esc_attr($hupso_twitter_via); ?>" /> <span style="padding-left:30px;"><?php _e('Add "via @yourprofile" to tweets', 'hupso', 'hupso');?>.</span><br/>
858
  </td>
859
  </tr>
860
 
872
  $hupso_facebook_image_none_checked = '';
873
  $hupso_facebook_image_fch_checked = '';
874
 
875
+ $hupso_facebook_image = get_option( 'hupso_facebook_image', 'fch' );
876
 
877
  switch ( $hupso_facebook_image ) {
878
  case 'header':
893
  }
894
 
895
  /* Facebook custom image */
896
+ $hupso_facebook_custom_image = esc_url(get_option( 'hupso_facebook_custom_image', '' ));
897
 
898
  /* Other */
899
  $header_image = trim(get_header_image());
901
  ?>
902
  <span style="font-size:10px"><?php _e('All images for Facebook should be at least 200px in both dimensions (Facebook limitation)', 'hupso');?>.<br/><?php _e('After you change settings here, please wait 24 hours (or more) for Facebook to fetch new thumbnails', 'hupso');?>.<br/><?php _e('"og:image" meta tag with image url will be added to head of HTML. Select "None" to disable this feature', 'hupso');?>.<br/></span><br/>
903
 
904
+ <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="header" <?php echo $hupso_facebook_image_header_checked; ?>/> <?php _e('Header image', 'hupso'); ?> <?php if ( $header_image != '' ) { echo '(<a href="' . esc_url($header_image) . '" title="' . __( 'Click here to see full header image', 'hupso' ) . '" target="_blank">' . __( 'preview', 'hupso' ) . '</a>)'; } ?><br/>
905
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="featured" <?php echo $hupso_facebook_image_featured_checked; ?>/> <?php _e('Featured image of post', 'hupso'); ?><br/>
906
+ <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_facebook_image_custom_checked; ?>/> <?php _e('Custom image from URL', 'hupso'); ?>: <input type="text" name="hupso_facebook_custom_image" onclick="hupso_create_code()" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" value="<?php echo esc_url($hupso_facebook_custom_image); ?>" /><br/>
907
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="none" <?php echo $hupso_facebook_image_none_checked; ?>/> <?php _e('None', 'hupso'); ?><br/>
908
  <input type="radio" name="hupso_facebook_image" onclick="hupso_create_code()" onchange="hupso_create_code()" value="fch" <?php echo $hupso_facebook_image_fch_checked; ?>/> <?php _e('FCH - use Featured image of post (if available), then use Custom image (if available), then use Header image (if available)', 'hupso'); ?><br/>
909
  </td>
915
  <?php
916
 
917
  /* CSS Style */
918
+ $hupso_css_style = sanitize_text_field(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
919
 
920
  ?>
921
+ <input type="text" name="hupso_css_style" style="width:400px;" value="<?php echo esc_attr($hupso_css_style);?>" /><br/><span><?php _e('Use CSS to style share buttons. For example: you can increase padding to have more free space above or below the buttons', 'hupso');?>.</span><br/>
922
  </td>
923
  </tr>
924
 
929
 
930
  /* Widget Text */
931
  $checked = ' checked="checked" ';
932
+ $hupso_widget_text = get_option( 'hupso_widget_text', '1');
933
  if ( $hupso_widget_text == '1' )
934
  $hupso_widget_text_checked = $checked;
935
  else
946
  <?php
947
  /* page_title */
948
  $checked = ' checked="checked" ';
949
+ $hupso_page_title = stripslashes(sanitize_text_field(get_option( 'hupso_page_title', '')));
950
  $hupso_page_title = htmlentities($hupso_page_title);
951
  ?>
952
+ <input type="text" name="page_title" value="<?php echo esc_attr($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.', 'hupso'); ?><br/><?php _e('Leave this blank to use title of current page as text for sharing. [Default]', 'hupso'); ?>
953
  </td>
954
  </tr>
955
 
959
  <?php
960
  /* page_url */
961
  $checked = ' checked="checked" ';
962
+ $hupso_page_url = esc_url(get_option( 'hupso_page_url', ''));
963
  ?>
964
  <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.', 'hupso'); ?><br/><?php _e('Leave this blank to use url of current page for sharing. [Default]', 'hupso'); ?>
965
  </td>
974
  $hupso_custom_icons_no_checked = '';
975
  $hupso_custom_icons_local_checked = '';
976
  $hupso_custom_icons_custom_checked = '';
977
+ $hupso_custom_icons = get_option( 'hupso_custom_icons', 'no');
978
+ $hupso_image_folder_url = esc_url(get_option( 'hupso_image_folder_url', ''));
979
+ switch ($hupso_custom_icons ) {
980
+ case 'no': $hupso_custom_icons_no_checked = $checked; break;
981
+ case 'local': $hupso_custom_icons_local_checked = $checked; break;
982
+ case 'custom': $hupso_custom_icons_custom_checked = $checked; break;
983
  }
984
  $image_url = plugins_url('/hupso-share-buttons-for-twitter-facebook-google/img/services/');
985
  ?>
987
  <input type="radio" name="hupso_custom_icons" onclick="hupso_create_code()" onchange="hupso_create_code()" value="local" <?php echo $hupso_custom_icons_local_checked; ?>/> <?php _e('Yes, serve images from local Wordpress folder. ', 'hupso'); ?>
988
  [<?php echo $image_url;?>]<br/>
989
  <input type="radio" name="hupso_custom_icons" onclick="hupso_create_code()" onchange="hupso_create_code()" value="custom" <?php echo $hupso_custom_icons_custom_checked; ?>/> <?php _e('Yes, serve images from remote URL: ', 'hupso'); ?><br/>
990
+ <input type="text" name="hupso_image_folder_url" value="<?php echo esc_url($hupso_image_folder_url);?>" onchange="hupso_create_code()" onmouseout="hupso_create_code()" size="50" /><br/><input type="hidden" name="hupso_image_folder_local" value="<?php echo esc_url($image_url);?>" /><?php _e('Enter URL to folder with custom social images. Include "/" at the end of the URL. If you would like to use custom icons, make sure you <a href="http://www.hupso.com/share/custom-social-icons.php" target="_blank">read instructions</a>.', 'hupso'); ?> <?php _e('This setting has no effect when using Counters.', 'hupso'); ?>
991
  </td>
992
  </tr>
993
  </div>
996
  <?php
997
  $token = md5(microtime()) . rand();
998
  $_SESSION['h_settings_token'] = $token;
999
+ echo '<input type="hidden" name="h_settings_token" value="' . esc_attr($token) . '">';
1000
  ?>
1001
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'hupso'); ?>" />
1002
  </form>
1010
  }
1011
 
1012
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013
  function hupso_admin_settings_save() {
1014
  if ( !current_user_can( 'manage_options' ) ) {
1015
  wp_die( __( 'You do not have sufficient permissions to access this page.' , 'hupso') );
1025
 
1026
  /* save button type */
1027
  if ( $post ) {
1028
+ $hupso_button_type = sanitize_text_field(@$_POST[ 'button_type' ]);
1029
  update_option( 'hupso_button_type', $hupso_button_type );
1030
  } else {
1031
+ $hupso_button_type = sanitize_text_field(get_option ( 'hupso_button_type', 'share_toolbar'));
1032
  }
1033
 
1034
  /* save button size */
1035
  if ( $post ) {
1036
+ $hupso_button_size = sanitize_text_field(@$_POST[ 'size' ]);
1037
  update_option( 'hupso_button_size', $hupso_button_size );
1038
  } else {
1039
+ $hupso_button_size = sanitize_text_field(get_option ( 'hupso_button_size', 'button100x23'));
1040
  }
1041
  $b_size = str_replace( 'button', '', $hupso_button_size);
1042
  if ($b_size != 'custom') {
1045
 
1046
  /* save share button custom URL */
1047
  if ( $post ) {
1048
+ $hupso_button_image_custom_url = esc_url(@$_POST[ 'hupso_button_image_custom_url' ]);
1049
  update_option( 'hupso_button_image_custom_url', $hupso_button_image_custom_url );
1050
  }
1051
 
1052
  /* save background & border color */
1053
  if ( $post ) {
1054
+ $hupso_background_color = sanitize_hex_color_no_hash(@$_POST[ 'background_color' ]);
1055
  update_option( 'hupso_background_color', $hupso_background_color );
1056
 
1057
+ $hupso_border_color = sanitize_hex_color_no_hash(@$_POST[ 'border_color' ]);
1058
  update_option( 'hupso_border_color', $hupso_border_color );
1059
  }
1060
 
1061
  /* save custom icons */
1062
  if ( $post ) {
1063
+ $hupso_custom_icons = sanitize_text_field(@$_POST[ 'hupso_custom_icons' ]);
1064
  update_option( 'hupso_custom_icons', $hupso_custom_icons );
1065
 
1066
+ $hupso_image_folder_url = esc_url(@$_POST[ 'hupso_image_folder_url' ]);
1067
  update_option( 'hupso_image_folder_url ', $hupso_image_folder_url );
1068
  }
1069
 
1070
  /* save toolbar size */
1071
  if ( $post ) {
1072
+ $hupso_toolbar_size = sanitize_text_field(@$_POST[ 'select_toolbar_size' ]);
1073
  update_option( 'hupso_toolbar_size', $hupso_toolbar_size );
1074
  } else {
1075
+ $hupso_button_size = sanitize_text_field(get_option ( 'hupso_toolbar_size', 'medium'));
1076
  }
1077
 
1078
  /* save share_image */
1079
  if ( $post ) {
1080
+ $hupso_share_image = sanitize_text_field(@$_POST[ 'hupso_share_image' ]);
1081
  update_option( 'hupso_share_image', $hupso_share_image );
1082
  } else {
1083
+ $hupso_share_image = sanitize_text_field(get_option ( 'hupso_share_image', 'normal'));
1084
  }
1085
 
1086
  /* save share_image_lang */
1087
  if ( $post ) {
1088
+ $hupso_share_image_lang = sanitize_text_field(@$_POST[ 'share_image_lang' ]);
1089
  update_option( 'hupso_share_image_lang', $hupso_share_image_lang );
1090
  } else {
1091
+ $hupso_share_image_lang = sanitize_text_field(get_option ( 'hupso_share_image_lang', ''));
1092
  }
1093
 
1094
  /* save share_image_custom_url */
1095
  if ( $post ) {
1096
+ $hupso_share_image_custom_url = esc_url(@$_POST[ 'hupso_share_image_custom_url' ]);
1097
  update_option( 'hupso_share_image_custom_url', $hupso_share_image_custom_url );
1098
  } else {
1099
+ $hupso_share_image_custom_url = esc_url(get_option ( 'hupso_share_image_custom_url', ''));
1100
  }
1101
 
1102
 
1103
  /* save services */
1104
  $hupso_vars = 'var hupso_services=new Array(';
1105
  foreach ( $hupso_all_services as $service_text ) {
1106
+ $service_text = sanitize_text_field($service_text);
1107
  $service_name = strtolower( $service_text );
1108
  $service_name = str_replace( ' ', '', $service_name );
1109
  if ( $post ) {
1110
+ $value = sanitize_text_field(@$_POST[ $service_name ]);
1111
  update_option( 'hupso_' . $service_name, $value );
1112
  }
1113
  else {
1114
+ $value = sanitize_text_field(get_option ( 'hupso_' . $service_name, in_array( $service_text, (array) $hupso_default_services ) ));
1115
  }
1116
  if ( $value == '1' ) {
1117
+ $hupso_vars .= '"' . esc_attr($service_text) .'",';
1118
  }
1119
  }
1120
  $hupso_vars .= ');';
1122
 
1123
  /* save hupso_counters_lang*/
1124
  if ( $post ) {
1125
+ $hupso_counters_lang = sanitize_text_field(@$_POST[ 'hupso_counters_lang' ]);
1126
  update_option( 'hupso_counters_lang', $hupso_counters_lang );
1127
  }
1128
 
1129
  /* save menu type */
1130
  if ( $post ) {
1131
+ $hupso_menu_type = sanitize_text_field(@$_POST[ 'menu_type' ]);
1132
  update_option( 'hupso_menu_type', $hupso_menu_type );
1133
  }
1134
  else {
1135
+ $hupso_menu_type = sanitize_text_field(get_option ( 'hupso_menu_type', 'labels' ));
1136
  }
1137
+ $hupso_vars .= 'var hupso_icon_type = "' . esc_attr($hupso_menu_type) . '";';
1138
 
1139
  /* save button position */
1140
  if ( $post ) {
1141
+ $hupso_button_position = sanitize_text_field(@$_POST[ 'hupso_button_position' ]);
1142
  update_option( 'hupso_button_position', $hupso_button_position );
1143
  }
1144
  else {
1145
+ $hupso_button_position = sanitize_text_field(get_option( 'hupso_button_position', 'below' ));
1146
  }
1147
 
1148
  /* save display options */
1149
  if ( $post ) {
1150
+ $hupso_show_posts = sanitize_text_field(@$_POST[ 'hupso_show_posts' ]);
1151
  update_option( 'hupso_show_posts', $hupso_show_posts );
1152
 
1153
+ $hupso_show_pages = sanitize_text_field(@$_POST[ 'hupso_show_pages' ]);
1154
  update_option( 'hupso_show_pages', $hupso_show_pages );
1155
 
1156
+ $hupso_show_frontpage = sanitize_text_field(@$_POST[ 'hupso_show_frontpage' ]);
1157
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
1158
 
1159
+ $hupso_show_category = sanitize_text_field(@$_POST[ 'hupso_show_category' ]);
1160
  update_option( 'hupso_show_category', $hupso_show_category );
1161
 
1162
+ $hupso_show_excerpts = sanitize_text_field(@$_POST[ 'hupso_show_excerpts' ]);
1163
  update_option( 'hupso_show_excerpts', $hupso_show_excerpts );
1164
 
1165
+ $hupso_show_search = sanitize_text_field(@$_POST[ 'hupso_show_search' ]);
1166
  update_option( 'hupso_show_search', $hupso_show_search );
1167
 
1168
  }
1169
 
1170
  /* save options for counters */
1171
  if ( $post ) {
1172
+ $twitter_tweet = sanitize_text_field(@$_POST[ 'twitter_tweet' ]);
1173
  update_option( 'hupso_twitter_tweet', $twitter_tweet );
1174
 
1175
+ $facebook_like = sanitize_text_field(@$_POST[ 'facebook_like' ]);
1176
  update_option( 'hupso_facebook_like', $facebook_like );
1177
 
1178
+ $facebook_send = sanitize_text_field(@$_POST[ 'facebook_send' ]);
1179
  update_option( 'hupso_facebook_send', $facebook_send );
1180
 
1181
+ $google_plus_one = sanitize_text_field(@$_POST[ 'google_plus_one' ]);
1182
  update_option( 'hupso_google_plus_one', $google_plus_one );
1183
 
1184
+ $pinterest_pin = sanitize_text_field(@$_POST[ 'pinterest_pin' ]);
1185
  update_option( 'hupso_pinterest_pin', $pinterest_pin );
1186
 
1187
+ $email_button = sanitize_text_field(@$_POST[ 'email_button' ]);
1188
  update_option( 'hupso_email_button', $email_button );
1189
 
1190
+ $print_button = sanitize_text_field(@$_POST[ 'print_button' ]);
1191
  update_option( 'hupso_print_button', $print_button );
1192
 
1193
+ $linkedin_share = sanitize_text_field(@$_POST[ 'linkedin_share' ]);
1194
  update_option( 'hupso_linkedin_share', $linkedin_share );
1195
  }
1196
 
1197
  /* Get title for sharing from */
1198
  if ( $post ) {
1199
+ $hupso_title_text = sanitize_text_field(@$_POST[ 'hupso_title_text' ]);
1200
  update_option( 'hupso_title_text', $hupso_title_text );
1201
  }
1202
 
1203
  /* Save twitter_via */
1204
  if ( $post ) {
1205
+ $hupso_twitter_via = sanitize_text_field(@$_POST[ 'hupso_twitter_via' ]);
1206
  update_option( 'hupso_twitter_via', $hupso_twitter_via );
1207
  }
1208
 
1209
  /* Save Facebook image */
1210
  if ( $post ) {
1211
+ $hupso_facebook_image = sanitize_text_field(@$_POST[ 'hupso_facebook_image' ]);
1212
  update_option( 'hupso_facebook_image', $hupso_facebook_image );
1213
  }
1214
 
1215
  /* Save Facebook custom image */
1216
  if ( $post ) {
1217
+ $hupso_facebook_custom_image = esc_url(@$_POST[ 'hupso_facebook_custom_image' ]);
1218
  update_option( 'hupso_facebook_custom_image', $hupso_facebook_custom_image );
1219
  }
1220
 
1221
  /* Save CSS style */
1222
  if ( $post ) {
1223
+ $hupso_css_style = sanitize_text_field(@$_POST[ 'hupso_css_style' ]);
1224
  update_option( 'hupso_css_style', $hupso_css_style );
1225
  }
1226
 
1227
  /* Save page_url */
1228
  if ( $post ) {
1229
+ $hupso_page_url = esc_url(@$_POST[ 'page_url' ]);
1230
  update_option( 'hupso_page_url', $hupso_page_url );
1231
  }
1232
 
1233
  /* Save page_title */
1234
  if ( $post ) {
1235
+ $hupso_page_title = sanitize_text_field(@$_POST[ 'page_title' ]);
1236
  update_option( 'hupso_page_title', $hupso_page_title );
1237
  }
1238
 
1239
  /* Save hupso_widget_text */
1240
  if ( $post ) {
1241
+ $hupso_widget_text = sanitize_text_field(@$_POST[ 'hupso_widget_text' ]);
1242
  update_option( 'hupso_widget_text', $hupso_widget_text );
1243
  }
1244
 
1245
  /* Save hupso_password_protected */
1246
  if ( $post ) {
1247
+ $hupso_password_protected = sanitize_text_field(@$_POST[ 'hupso_password_protected' ]);
1248
  update_option( 'hupso_password_protected', $hupso_password_protected );
1249
  }
1250
 
1251
  /* save hupso_hide_categories */
1252
  if ( $post ) {
1253
+ $hupso_hide_categories = sanitize_category(@$_POST['hupso_hide_categories']);
1254
  update_option( 'hupso_hide_categories', $hupso_hide_categories );
1255
  }
1256
 
1262
 
1263
  /* save hupso_meta_box */
1264
  if ( $post ) {
1265
+ $hupso_meta_box = sanitize_text_field(@$_POST[ 'hupso_meta_box' ]);
1266
  update_option( 'hupso_meta_box', $hupso_meta_box );
1267
  }
1268
 
1275
  $operator = 'and'; // 'and' or 'or'
1276
  $post_types = get_post_types( $args, $output, $operator );
1277
  foreach ( $post_types as $post_type ) {
1278
+ $post_type = sanitize_text_field($post_type);
1279
  $name = 'hupso_custom_post_' . $post_type;
1280
+ $val = sanitize_text_field(@$_POST[$name]);
1281
  if ($val == '') {
1282
  update_option ( $name, '0' );
1283
  }
1307
  $hupso_state = 'normal';
1308
 
1309
 
1310
+ $hupso_show_excerpts = sanitize_text_field(get_option( 'hupso_show_excerpts' , '1' ));
1311
  if ( ( $hupso_show_excerpts == 1 ) && ( $post->post_type != 'attachment' ) ) {
1312
  return hupso_the_content ( $content );
1313
  }
1321
  global $post_url, $post_title, $hupso_shortcode_params;
1322
 
1323
  $value = '';
1324
+ $hupso_meta_box = sanitize_text_field(get_option( 'hupso_meta_box', '' ));
1325
  if ($hupso_meta_box != "1") {
1326
  $value = '';
1327
  } else {
1365
  else {
1366
  $current_category = '';
1367
  }
1368
+ $hupso_hide_categories = sanitize_category(get_option( 'hupso_hide_categories' , array() ));
1369
  if ( $hupso_hide_categories == '' ) {
1370
  $hupso_hide_categories = array();
1371
  }
1372
 
1373
+ $hupso_title_text = sanitize_text_field(get_option( 'hupso_title_text' , 'post' ));
1374
+ $hupso_twitter_via = sanitize_text_field(get_option( 'hupso_twitter_via', '' ));
1375
+ $hupso_counters_lang = sanitize_text_field(get_option( 'hupso_counters_lang', 'en_US' ));
1376
 
1377
+ $hupso_page_url = esc_url(get_option( 'hupso_page_url', '' ));
1378
+ $hupso_page_title = stripslashes(sanitize_text_field(get_option( 'hupso_page_title', '' )));
1379
 
1380
 
1381
  /* default code */
1386
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1387
  }
1388
 
1389
+ $button_type = sanitize_text_field(get_option( 'hupso_button_type', 'share_toolbar' ));
1390
 
1391
  /* Check for old saved button code, prior to version 1.3 */
1392
  if ( get_option( 'hupso_custom', '0' ) == 0 ) {
1427
 
1428
  /* Twitter via @ */
1429
  if ( $hupso_twitter_via != '') {
1430
+ $code .= 'var hupso_twitter_via="' . esc_attr($hupso_twitter_via) . '";';
1431
  }
1432
 
1433
  /* Get shortcode params (if they exist) */
1458
 
1459
  switch ( $button_type ) {
1460
  case 'share_button':
1461
+ $code .= 'var hupso_url="' . esc_url($new_url) . '";';
1462
  break;
1463
  case 'share_toolbar':
1464
+ $code .= 'var hupso_url_t="' . esc_url($new_url) . '";';
1465
  break;
1466
  case 'counters':
1467
+ $code .= 'var hupso_url_c="' . esc_url($new_url) . '";';
1468
  break;
1469
  }
1470
 
1488
 
1489
  switch ( $button_type ) {
1490
  case 'share_button':
1491
+ $code .= 'var hupso_title="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1492
  break;
1493
  case 'share_toolbar':
1494
+ $code .= 'var hupso_title_t="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1495
  break;
1496
  case 'counters':
1497
+ $code .= 'var hupso_title_c="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1498
  break;
1499
  }
1500
  }
1516
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1517
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1518
 
1519
+ $position = sanitize_text_field(get_option( 'hupso_button_position', 'below' ));
1520
 
1521
+ $hupso_css_style = sanitize_text_field(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
1522
  if ($hupso_css_style != '') {
1523
+ $hupso_css_out = ' style="' . esc_attr($hupso_css_style) . '"';
1524
  }
1525
  else {
1526
  $hupso_css_out = '';
1566
  }
1567
 
1568
  $value = '';
1569
+ $hupso_meta_box = sanitize_text_field(get_option( 'hupso_meta_box', '' ));
1570
  if ($hupso_meta_box != "1") {
1571
  $value = '';
1572
  } else {
1599
  else {
1600
  $name = '';
1601
  }
1602
+ $val = intval(get_option( $name, '1' ));
1603
  if ($val == '0') {
1604
  $content = str_ireplace('[hupso_hide]', '', $content);
1605
  $content = str_ireplace('[hupso]', '', $content);
1625
 
1626
  /* Do not show share buttons on password protected pages, but show it inside widget */
1627
  $pass = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_password : '' );
1628
+ $hupso_password_protected = sanitize_text_field(get_option( 'hupso_password_protected', '0'));
1629
  if ( $hupso_state == 'normal' ) {
1630
  if ($pass != '') {
1631
  if (!$hupso_password_protected) {
1641
  }
1642
  }
1643
 
1644
+ $hupso_show_search = sanitize_text_field(get_option( 'hupso_show_search' , '1' ));
1645
  if ( ($hupso_state == 'normal') && (is_search()) && ($hupso_show_search != 1) ) {
1646
  $content = str_ireplace('[hupso_hide]', '', $content);
1647
  $content = str_ireplace('[hupso]', '', $content);
1649
  return $content;
1650
  }
1651
 
1652
+ $hupso_show_posts = sanitize_text_field(get_option( 'hupso_show_posts' , '1' ));
1653
  if ( ($hupso_state == 'normal') && (is_single()) && ($hupso_show_posts != 1) ) {
1654
  $content = str_ireplace('[hupso_hide]', '', $content);
1655
  $content = str_ireplace('[hupso]', '', $content);
1658
 
1659
  }
1660
 
1661
+ $hupso_show_pages = sanitize_text_field(get_option( 'hupso_show_pages' , '1' ));
1662
  if ( ($hupso_state == 'normal') && (is_page()) && ($hupso_show_pages != 1) ) {
1663
  $content = str_ireplace('[hupso_hide]', '', $content);
1664
  $content = str_ireplace('[hupso]', '', $content);
1667
 
1668
  }
1669
 
1670
+ $hupso_show_frontpage = sanitize_text_field(get_option( 'hupso_show_frontpage' , '1' ));
1671
+ $hupso_show_category = sanitize_text_field(get_option( 'hupso_show_category' , '1' ));
1672
 
1673
  /* Do not show share buttons if option is disabled */
1674
  if ( ($hupso_state == 'normal') && (is_home()) && ($hupso_show_frontpage != 1) ) {
1695
  else {
1696
  $current_category = '';
1697
  }
1698
+ $hupso_hide_categories = sanitize_category(get_option( 'hupso_hide_categories' , array() ));
1699
  if ( $hupso_hide_categories == '' ) {
1700
  $hupso_hide_categories = array();
1701
  }
1707
 
1708
  }
1709
 
1710
+ $hupso_title_text = sanitize_text_field(get_option( 'hupso_title_text' , 'post' ));
1711
+ $hupso_twitter_via = sanitize_text_field(get_option( 'hupso_twitter_via', '' ));
1712
+ $hupso_counters_lang = sanitize_text_field(get_option( 'hupso_counters_lang', 'en_US' ));
1713
 
1714
  $post_url = ( isset($GLOBALS['post']) ? get_permalink($GLOBALS['post']->ID) : get_permalink() );
1715
  $post_title = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_title : '' );
1725
  $post_title = '';
1726
  }
1727
 
1728
+ $hupso_page_url = esc_url(get_option( 'hupso_page_url', '' ));
1729
+ $hupso_page_title = stripslashes(sanitize_text_field(get_option( 'hupso_page_title', '' )));
1730
 
1731
 
1732
  /* default code */
1737
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1738
  }
1739
 
1740
+ $button_type = sanitize_text_field(get_option( 'hupso_button_type', 'share_toolbar' ));
1741
 
1742
  /* Check for old saved button code, prior to version 1.3 */
1743
  if ( get_option( 'hupso_custom', '0' ) == 0 ) {
1778
 
1779
  /* Twitter via @ */
1780
  if ( $hupso_twitter_via != '') {
1781
+ $code .= 'var hupso_twitter_via="' . esc_attr($hupso_twitter_via) . '";';
1782
  }
1783
 
1784
  /* Get shortcode params (if they exist) */
1817
 
1818
  switch ( $button_type ) {
1819
  case 'share_button':
1820
+ $code .= 'var hupso_url="' . esc_url($new_url) . '";';
1821
  break;
1822
  case 'share_toolbar':
1823
+ $code .= 'var hupso_url_t="' . esc_url($new_url) . '";';
1824
  break;
1825
  case 'counters':
1826
+ $code .= 'var hupso_url_c="' . esc_url($new_url) . '";';
1827
  break;
1828
  }
1829
 
1844
 
1845
  switch ( $button_type ) {
1846
  case 'share_button':
1847
+ $code .= 'var hupso_title="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1848
  break;
1849
  case 'share_toolbar':
1850
+ $code .= 'var hupso_title_t="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1851
  break;
1852
  case 'counters':
1853
+ $code .= 'var hupso_title_c="' . esc_attr(str_replace('"', '&quot;', $new_title)) . '";';
1854
  break;
1855
  }
1856
  }
1872
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1873
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1874
 
1875
+ $position = sanitize_text_field(get_option( 'hupso_button_position', 'below' ));
1876
 
1877
+ $hupso_css_style = sanitize_text_field(get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;'));
1878
  if ($hupso_css_style != '') {
1879
+ $hupso_css_out = ' style="' . esc_attr($hupso_css_style) . '"';
1880
  }
1881
  else {
1882
  $hupso_css_out = '';
1919
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
1920
 
1921
  foreach ( $hupso_all_services as $service_text ) {
1922
+ $service_text = sanitize_text_field($service_text);
1923
  $service_name = strtolower( $service_text );
1924
  $service_name = str_replace( ' ', '', $service_name );
1925
 
1926
  $checked = '';
1927
+ $value = sanitize_text_field(get_option( 'hupso_' . $service_name , in_array( $service_text, (array) $hupso_default_services ) ));
1928
  if ( $value == "1" ) {
1929
  $checked = 'checked="checked"';
1930
  }
2029
 
2030
  asort($languages);
2031
  echo '<option value="en_US">English (US)</option>';
2032
+ $hupso_counters_lang = sanitize_text_field(get_option( 'hupso_counters_lang', 'en_US' ));
2033
  if ($hupso_counters_lang == '') {
2034
  $hupso_counters_lang = 'en_US';
2035
  }
2039
  $sel_lang = ' selected ';
2040
  else
2041
  $sel_lang = '';
2042
+ echo '<option value="' . esc_attr($lang_code) . '"'. $sel_lang .'>' . esc_attr($lang_name) . '</option>';
2043
  }
2044
 
2045
  }