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

Version Description

  • Compatible with Wordpress 4.7.1
  • Security fixes
Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.5

Files changed (2) hide show
  1. readme.txt +9 -5
  2. share-buttons-hupso.php +186 -137
readme.txt CHANGED
@@ -2,17 +2,17 @@
2
  Contributors: kasal
3
  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.8
6
- Tested up to: 4.2.2
7
- Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Help share your posts on popular social networks: Twitter, Facebook, Google+, Linkedin, Pinterest, StumbleUpon, Tumblr, Reddit, Bebo and others.
12
 
13
  == Description ==
14
 
15
- 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, Delicous, VKontakte and Email.
16
 
17
  These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
18
 
@@ -305,6 +305,10 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
305
 
306
  == Changelog ==
307
 
 
 
 
 
308
  = 4.0.3 =
309
  * Added Arabic translation
310
 
2
  Contributors: kasal
3
  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
 
11
+ Add social share buttons to your posts or pages. Support for Twitter, Facebook, Google+, Linkedin, Pinterest, Tumblr, Reddit and others.
12
 
13
  == Description ==
14
 
15
+ Add simple social share buttons to your posts or pages. 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, Delicous, VKontakte and Email.
16
 
17
  These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
18
 
305
 
306
  == Changelog ==
307
 
308
+ = 4.0.5 =
309
+ * Compatible with Wordpress 4.7.1
310
+ * Security fixes
311
+
312
  = 4.0.3 =
313
  * Added Arabic translation
314
 
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.3
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.3';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
@@ -72,19 +72,26 @@ add_shortcode( 'hupso', 'hupso_shortcodes' );
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
  }
85
 
86
  /* Add stylesheet */
87
  add_action( 'wp_enqueue_scripts', 'hupso_add_my_stylesheet' );
 
 
 
 
 
 
 
88
 
89
  function hupso_add_my_stylesheet() {
90
  wp_register_style( 'hupso_css', plugins_url('style.css', __FILE__) );
@@ -194,7 +201,7 @@ function hupso_plugin_uninstall() {
194
  function hupso_plugin_activation() {
195
 
196
  /* Fix for bug in version 3.0 */
197
- $size = get_option( 'hupso_button_size', '');
198
  if ( ($size == 'share_button') or ($size == 'share_toolbar') or ($size == 'counters') ) {
199
  @update_option( 'hupso_button_size', 'button100x23');
200
  }
@@ -219,8 +226,8 @@ function hupso_set_facebook_thumbnail() {
219
  */
220
 
221
  $thumb_image = '';
222
- $hupso_facebook_image = get_option( 'hupso_facebook_image', 'fch' );
223
- $hupso_facebook_custom_image = get_option( 'hupso_facebook_custom_image', '' );
224
 
225
  switch ( $hupso_facebook_image ) {
226
  case 'header':
@@ -264,7 +271,12 @@ function hupso_get_the_excerpt($content) {
264
  return $content;
265
  }
266
 
 
267
  function hupso_admin_settings_show() {
 
 
 
 
268
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
269
 
270
  wp_enqueue_script(
@@ -278,28 +290,30 @@ function hupso_admin_settings_show() {
278
  );
279
 
280
 
 
281
  $hupso_lang_code = __('en_US', 'hupso');
282
  $hupso_language = __('English', 'hupso');
283
  $hupso_share_image = __('Share', 'hupso');
284
  $hupso_excerpts = __('Excerpts', 'hupso');
285
 
286
-
287
- if ( !current_user_can( 'manage_options' ) ) {
288
- wp_die( __( 'You do not have sufficient permissions to access this page.' , 'hupso') );
289
- }
290
-
291
  /* save settings */
292
  if ( @$_POST[ 'button_type' ] != '' ) {
293
- hupso_admin_settings_save();
 
 
 
 
 
294
  }
295
 
296
 
 
297
  echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
298
  echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)', 'hupso').'</h2>';
299
  echo '<form name="hupso_settings_form" method="post" action="">';
300
 
301
  echo '<div id="right" style="float:right; width:200px; margin-right:10px; margin-left:20px; margin-top:20px;">';
302
- echo '<div id="button_preview" style="background: #F7FFBF; padding: 10px 10px 10px 10px; "><table><tr><td><h3>' . __( 'Preview', 'hupso') . '</h3></td><td style="padding-left:50px;"><input class="button-primary" name="submit-preview" type="button" onclick="hupso_create_code()" value="' . __('Update', 'hupso') . '" /></td></tr></table><br/>';
303
  echo '<div id="button"></div>';
304
  echo '<div id="move_mouse"><p style="font-size:13px; padding-top: 15px;"><b>Move your mouse over the button to see the sharing menu.</b></p></div><br/><br/>';
305
  echo '<div style="padding-left:40px;"><input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings', 'hupso') . '" /></div>';
@@ -350,7 +364,7 @@ function hupso_admin_settings_show() {
350
 
351
 
352
  $checked = 'checked="checked"';
353
- $current_button_size = get_option( 'hupso_button_size' , 'button100x23' );
354
  $button60_checked = '';
355
  $button80_checked = '';
356
  $button100_checked = '';
@@ -378,8 +392,8 @@ function hupso_admin_settings_show() {
378
  <td style="width:100px;"><?php _e('Button type', 'hupso'); ?>
379
  </td>
380
  <?php
381
- $hupso_button_type = get_option( 'hupso_button_type', 'share_toolbar' );
382
- $hupso_button_image_custom_url = get_option( 'hupso_button_image_custom_url', '');
383
  $checked = ' checked="checked" ';
384
  $hupso_share_button_checked = '';
385
  $hupso_share_toolbar_checked = '';
@@ -425,7 +439,7 @@ function hupso_admin_settings_show() {
425
  <td style="width:100px;"><?php _e('Toolbar size', 'hupso'); ?></td>
426
  <td style="width:100px">
427
  <?php
428
- $hupso_toolbar_size = get_option( 'hupso_toolbar_size', 'medium' );
429
  $hupso_toolbar_size_big_checked = '';
430
  $hupso_toolbar_size_medium_checked = '';
431
  $hupso_toolbar_size_small_checked = '';
@@ -456,7 +470,7 @@ function hupso_admin_settings_show() {
456
 
457
  /* hupso_share_image */
458
  $checked = ' checked="checked" ';
459
- $hupso_share_image = get_option( 'hupso_share_image', 'normal' );
460
  $hupso_share_image_show_checked = '';
461
  $hupso_share_image_hide_checked = '';
462
  $hupso_share_image_lang_checked = '';
@@ -469,8 +483,8 @@ function hupso_admin_settings_show() {
469
  case 'custom': $hupso_share_image_custom_checked = $checked; break;
470
  }
471
 
472
- $hupso_share_image_lang = get_option ( 'hupso_share_image_lang', '' );
473
- $hupso_share_image_custom_url = get_option ( 'hupso_share_image_custom_url', '' );
474
 
475
  ?>
476
  <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');?>:
@@ -511,8 +525,8 @@ function hupso_admin_settings_show() {
511
 
512
  <?php
513
  /* background & border color */
514
- $hupso_background_color = get_option( 'hupso_background_color', 'EAF4FF');
515
- $hupso_border_color = get_option( 'hupso_border_color', '66CCFF');
516
  ?>
517
  <div id="show_color">
518
  <table style="border: 0px;">
@@ -542,28 +556,28 @@ function hupso_admin_settings_show() {
542
  $print_button_checked = '';
543
  $linkedin_share_checked = '';
544
 
545
- $twitter_tweet = get_option( 'hupso_twitter_tweet', '1' );
546
  if ( $twitter_tweet == 1 ) $twitter_tweet_checked = $checked;
547
 
548
- $facebook_like = get_option( 'hupso_facebook_like', '1' );
549
  if ( $facebook_like == 1 ) $facebook_like_checked = $checked;
550
 
551
- $facebook_send = get_option( 'hupso_facebook_send', '1' );
552
  if ( $facebook_send == 1 ) $facebook_send_checked = $checked;
553
 
554
- $google_plus_one = get_option( 'hupso_google_plus_one', '1' );
555
  if ( $google_plus_one == 1 ) $google_plus_one_checked = $checked;
556
 
557
- $pinterest_pin = get_option( 'hupso_pinterest_pin', '1' );
558
  if ( $pinterest_pin == 1 ) $pinterest_pin_checked = $checked;
559
 
560
- $email_button = get_option( 'hupso_email_button', '0' );
561
  if ( $email_button == 1 ) $email_button_checked = $checked;
562
 
563
- $print_button = get_option( 'hupso_print_button', '0' );
564
  if ( $print_button == 1 ) $print_button_checked = $checked;
565
 
566
- $linkedin_share = get_option( 'hupso_linkedin_share', '0' );
567
  if ( $linkedin_share == 1 ) $linkedin_share_checked = $checked;
568
  ?>
569
  <div id="counters_config" style="display:none;">
@@ -634,7 +648,7 @@ function hupso_admin_settings_show() {
634
  <tr>
635
  <td style="width:100px;"><?php _e('Type of menu', 'hupso'); ?></td>
636
  <?php
637
- $menu_type = get_option( 'hupso_menu_type', 'labels' );
638
  $checked = ' checked="checked" ';
639
  $hupso_labels_checked = '';
640
  $hupso_icons_checked = '';
@@ -655,7 +669,7 @@ function hupso_admin_settings_show() {
655
  <tr>
656
  <td style="width:100px;"><?php _e('Button position', 'hupso'); ?></td>
657
  <?php
658
- $button_position = get_option( 'hupso_button_position', 'below' );
659
  $checked = ' checked="checked" ';
660
  $hupso_below_checked = '';
661
  $hupso_above_checked = '';
@@ -684,49 +698,49 @@ function hupso_admin_settings_show() {
684
  $hupso_show_excerpts_checked = '';
685
 
686
  /* posts */
687
- $hupso_show_posts = get_option( 'hupso_show_posts', '1' );
688
  if ( $hupso_show_posts == 1 )
689
  $hupso_show_posts_checked = $checked;
690
  else
691
  $hupso_show_posts_checked = '';
692
 
693
  /* pages */
694
- $hupso_show_pages = get_option( 'hupso_show_pages', '1' );
695
  if ( $hupso_show_pages == 1 )
696
  $hupso_show_pages_checked = $checked;
697
  else
698
  $hupso_show_pages_checked = '';
699
 
700
  /* frontpage */
701
- $hupso_show_frontpage = get_option( 'hupso_show_frontpage', '1' );
702
  if ( $hupso_show_frontpage == 1 )
703
  $hupso_show_frontpage_checked = $checked;
704
  else
705
  $hupso_show_frontpage_checked = '';
706
 
707
  /* archive pages (categories, tags, dates, authors) */
708
- $hupso_show_category = get_option( 'hupso_show_category', '1' );
709
  if ( $hupso_show_category == 1 )
710
  $hupso_show_category_checked = $checked;
711
  else
712
  $hupso_show_category_checked = '';
713
 
714
  /* excerpts */
715
- $hupso_show_excerpts = get_option( 'hupso_show_excerpts', '1' );
716
  if ( $hupso_show_excerpts == 1 )
717
  $hupso_show_excerpts_checked = $checked;
718
  else
719
  $hupso_show_excerpts_checked = '';
720
 
721
  /* search pages */
722
- $hupso_show_search = get_option( 'hupso_show_search', '1');
723
  if ( $hupso_show_search == '1' )
724
  $hupso_show_search_checked = $checked;
725
  else
726
  $hupso_show_search_checked = '';
727
 
728
  /* password protected posts */
729
- $hupso_password_protected = get_option( 'hupso_password_protected', '0');
730
  if ( $hupso_password_protected == '1' )
731
  $hupso_password_protected_checked = $checked;
732
  else
@@ -756,7 +770,7 @@ function hupso_admin_settings_show() {
756
 
757
  foreach ( $post_types as $post_type ) {
758
  $name = 'hupso_custom_post_' . $post_type;
759
- $val = get_option( $name, '1' );
760
  if ($val == '1') {
761
  $checked = ' checked="checked" ';
762
  }
@@ -772,7 +786,7 @@ function hupso_admin_settings_show() {
772
  <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/>';
773
  /* add meta box */
774
  $checked = ' checked="checked" ';
775
- $hupso_meta_box = get_option( 'hupso_meta_box', '' );
776
  if ( $hupso_meta_box == 1 )
777
  $hupso_meta_box_checked = $checked;
778
  else
@@ -820,7 +834,7 @@ function hupso_admin_settings_show() {
820
  $hupso_title_text_post_checked = '';
821
 
822
  /* posts */
823
- $hupso_title_text = get_option( 'hupso_title_text', 'post' );
824
  if ( $hupso_title_text == 'page' )
825
  $hupso_title_text_page_checked = $checked;
826
  else
@@ -837,7 +851,7 @@ function hupso_admin_settings_show() {
837
  <?php
838
 
839
  /* Twitter via */
840
- $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
841
 
842
  ?>
843
  @<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,7 +872,7 @@ function hupso_admin_settings_show() {
858
  $hupso_facebook_image_none_checked = '';
859
  $hupso_facebook_image_fch_checked = '';
860
 
861
- $hupso_facebook_image = get_option( 'hupso_facebook_image', 'fch' );
862
 
863
  switch ( $hupso_facebook_image ) {
864
  case 'header':
@@ -879,7 +893,7 @@ function hupso_admin_settings_show() {
879
  }
880
 
881
  /* Facebook custom image */
882
- $hupso_facebook_custom_image = get_option( 'hupso_facebook_custom_image', '' );
883
 
884
  /* Other */
885
  $header_image = trim(get_header_image());
@@ -901,7 +915,7 @@ function hupso_admin_settings_show() {
901
  <?php
902
 
903
  /* CSS Style */
904
- $hupso_css_style = get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;');
905
 
906
  ?>
907
  <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/>
@@ -915,7 +929,7 @@ function hupso_admin_settings_show() {
915
 
916
  /* Widget Text */
917
  $checked = ' checked="checked" ';
918
- $hupso_widget_text = get_option( 'hupso_widget_text', '1');
919
  if ( $hupso_widget_text == '1' )
920
  $hupso_widget_text_checked = $checked;
921
  else
@@ -932,7 +946,7 @@ function hupso_admin_settings_show() {
932
  <?php
933
  /* page_title */
934
  $checked = ' checked="checked" ';
935
- $hupso_page_title = stripslashes(get_option( 'hupso_page_title', ''));
936
  $hupso_page_title = htmlentities($hupso_page_title);
937
  ?>
938
  <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'); ?>
@@ -945,7 +959,7 @@ function hupso_admin_settings_show() {
945
  <?php
946
  /* page_url */
947
  $checked = ' checked="checked" ';
948
- $hupso_page_url = get_option( 'hupso_page_url', '');
949
  ?>
950
  <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'); ?>
951
  </td>
@@ -960,8 +974,8 @@ function hupso_admin_settings_show() {
960
  $hupso_custom_icons_no_checked = '';
961
  $hupso_custom_icons_local_checked = '';
962
  $hupso_custom_icons_custom_checked = '';
963
- $hupso_custom_icons = get_option( 'hupso_custom_icons', 'no');
964
- $hupso_image_folder_url = get_option( 'hupso_image_folder_url', '');
965
  switch ( $hupso_custom_icons ) {
966
  case 'no': $hupso_custom_icons_no_checked = $checked; break;
967
  case 'local': $hupso_custom_icons_local_checked = $checked; break;
@@ -973,12 +987,17 @@ function hupso_admin_settings_show() {
973
  <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'); ?>
974
  [<?php echo $image_url;?>]<br/>
975
  <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/>
976
- <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'); ?><br/><?php _e('This setting has no effect when using Counters.', 'hupso'); ?>
977
  </td>
978
  </tr>
979
  </div>
980
 
981
  </table>
 
 
 
 
 
982
  <br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings', 'hupso'); ?>" />
983
  </form>
984
  </div>
@@ -990,8 +1009,36 @@ function hupso_admin_settings_show() {
990
 
991
  }
992
 
993
- function hupso_admin_settings_save() {
994
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
995
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
996
  update_option( 'hupso_custom', '1' );
997
 
@@ -1002,18 +1049,18 @@ function hupso_admin_settings_save() {
1002
 
1003
  /* save button type */
1004
  if ( $post ) {
1005
- $hupso_button_type = @$_POST[ 'button_type' ];
1006
  update_option( 'hupso_button_type', $hupso_button_type );
1007
  } else {
1008
- $hupso_button_type = get_option ( 'hupso_button_type', 'share_toolbar');
1009
  }
1010
 
1011
  /* save button size */
1012
  if ( $post ) {
1013
- $hupso_button_size = @$_POST[ 'size' ];
1014
  update_option( 'hupso_button_size', $hupso_button_size );
1015
  } else {
1016
- $hupso_button_size = get_option ( 'hupso_button_size', 'button100x23');
1017
  }
1018
  $b_size = str_replace( 'button', '', $hupso_button_size);
1019
  if ($b_size != 'custom') {
@@ -1022,75 +1069,76 @@ function hupso_admin_settings_save() {
1022
 
1023
  /* save share button custom URL */
1024
  if ( $post ) {
1025
- $hupso_button_image_custom_url = @$_POST[ 'hupso_button_image_custom_url' ];
1026
  update_option( 'hupso_button_image_custom_url', $hupso_button_image_custom_url );
1027
  }
1028
 
1029
  /* save background & border color */
1030
  if ( $post ) {
1031
- $hupso_background_color = @$_POST[ 'background_color' ];
1032
  update_option( 'hupso_background_color', $hupso_background_color );
1033
 
1034
- $hupso_border_color = @$_POST[ 'border_color' ];
1035
  update_option( 'hupso_border_color', $hupso_border_color );
1036
  }
1037
 
1038
  /* save custom icons */
1039
  if ( $post ) {
1040
- $hupso_custom_icons = @$_POST[ 'hupso_custom_icons' ];
1041
  update_option( 'hupso_custom_icons', $hupso_custom_icons );
1042
 
1043
- $hupso_image_folder_url = @$_POST[ 'hupso_image_folder_url' ];
1044
  update_option( 'hupso_image_folder_url ', $hupso_image_folder_url );
1045
  }
1046
 
1047
  /* save toolbar size */
1048
  if ( $post ) {
1049
- $hupso_toolbar_size = @$_POST[ 'select_toolbar_size' ];
1050
  update_option( 'hupso_toolbar_size', $hupso_toolbar_size );
1051
  } else {
1052
- $hupso_button_size = get_option ( 'hupso_toolbar_size', 'medium');
1053
  }
1054
 
1055
  /* save share_image */
1056
  if ( $post ) {
1057
- $hupso_share_image = @$_POST[ 'hupso_share_image' ];
1058
  update_option( 'hupso_share_image', $hupso_share_image );
1059
  } else {
1060
- $hupso_share_image = get_option ( 'hupso_share_image', 'normal');
1061
  }
1062
 
1063
  /* save share_image_lang */
1064
  if ( $post ) {
1065
- $hupso_share_image_lang = @$_POST[ 'share_image_lang' ];
1066
  update_option( 'hupso_share_image_lang', $hupso_share_image_lang );
1067
  } else {
1068
- $hupso_share_image_lang = get_option ( 'hupso_share_image_lang', '');
1069
  }
1070
 
1071
  /* save share_image_custom_url */
1072
  if ( $post ) {
1073
- $hupso_share_image_custom_url = @$_POST[ 'hupso_share_image_custom_url' ];
1074
  update_option( 'hupso_share_image_custom_url', $hupso_share_image_custom_url );
1075
  } else {
1076
- $hupso_share_image_custom_url = get_option ( 'hupso_share_image_custom_url', '');
1077
  }
1078
 
1079
 
1080
  /* save services */
1081
  $hupso_vars = 'var hupso_services=new Array(';
1082
  foreach ( $hupso_all_services as $service_text ) {
 
1083
  $service_name = strtolower( $service_text );
1084
  $service_name = str_replace( ' ', '', $service_name );
1085
  if ( $post ) {
1086
- $value = @$_POST[ $service_name ];
1087
  update_option( 'hupso_' . $service_name, $value );
1088
  }
1089
  else {
1090
- $value = get_option ( 'hupso_' . $service_name, in_array( $service_text, (array) $hupso_default_services ) );
1091
  }
1092
  if ( $value == '1' ) {
1093
- $hupso_vars .= '"' . $service_text .'",';
1094
  }
1095
  }
1096
  $hupso_vars .= ');';
@@ -1098,135 +1146,135 @@ function hupso_admin_settings_save() {
1098
 
1099
  /* save hupso_counters_lang*/
1100
  if ( $post ) {
1101
- $hupso_counters_lang = @$_POST[ 'hupso_counters_lang' ];
1102
  update_option( 'hupso_counters_lang', $hupso_counters_lang );
1103
  }
1104
 
1105
  /* save menu type */
1106
  if ( $post ) {
1107
- $hupso_menu_type = @$_POST[ 'menu_type' ];
1108
  update_option( 'hupso_menu_type', $hupso_menu_type );
1109
  }
1110
  else {
1111
- $hupso_menu_type = get_option ( 'hupso_menu_type', 'labels' );
1112
  }
1113
- $hupso_vars .= 'var hupso_icon_type = "'.$hupso_menu_type.'";';
1114
 
1115
  /* save button position */
1116
  if ( $post ) {
1117
- $hupso_button_position = @$_POST[ 'hupso_button_position' ];
1118
  update_option( 'hupso_button_position', $hupso_button_position );
1119
  }
1120
  else {
1121
- $hupso_button_position = get_option( 'hupso_button_position', 'below' );
1122
  }
1123
 
1124
  /* save display options */
1125
  if ( $post ) {
1126
- $hupso_show_posts = @$_POST[ 'hupso_show_posts' ];
1127
  update_option( 'hupso_show_posts', $hupso_show_posts );
1128
 
1129
- $hupso_show_pages = @$_POST[ 'hupso_show_pages' ];
1130
  update_option( 'hupso_show_pages', $hupso_show_pages );
1131
 
1132
- $hupso_show_frontpage = @$_POST[ 'hupso_show_frontpage' ];
1133
  update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
1134
 
1135
- $hupso_show_category = @$_POST[ 'hupso_show_category' ];
1136
  update_option( 'hupso_show_category', $hupso_show_category );
1137
 
1138
- $hupso_show_excerpts = @$_POST[ 'hupso_show_excerpts' ];
1139
  update_option( 'hupso_show_excerpts', $hupso_show_excerpts );
1140
 
1141
- $hupso_show_search = @$_POST[ 'hupso_show_search' ];
1142
  update_option( 'hupso_show_search', $hupso_show_search );
1143
 
1144
  }
1145
 
1146
  /* save options for counters */
1147
  if ( $post ) {
1148
- $twitter_tweet = @$_POST[ 'twitter_tweet' ];
1149
  update_option( 'hupso_twitter_tweet', $twitter_tweet );
1150
 
1151
- $facebook_like = @$_POST[ 'facebook_like' ];
1152
  update_option( 'hupso_facebook_like', $facebook_like );
1153
 
1154
- $facebook_send = @$_POST[ 'facebook_send' ];
1155
  update_option( 'hupso_facebook_send', $facebook_send );
1156
 
1157
- $google_plus_one = @$_POST[ 'google_plus_one' ];
1158
  update_option( 'hupso_google_plus_one', $google_plus_one );
1159
 
1160
- $pinterest_pin = @$_POST[ 'pinterest_pin' ];
1161
  update_option( 'hupso_pinterest_pin', $pinterest_pin );
1162
 
1163
- $email_button = @$_POST[ 'email_button' ];
1164
  update_option( 'hupso_email_button', $email_button );
1165
 
1166
- $print_button = @$_POST[ 'print_button' ];
1167
  update_option( 'hupso_print_button', $print_button );
1168
 
1169
- $linkedin_share = @$_POST[ 'linkedin_share' ];
1170
  update_option( 'hupso_linkedin_share', $linkedin_share );
1171
  }
1172
 
1173
  /* Get title for sharing from */
1174
  if ( $post ) {
1175
- $hupso_title_text = @$_POST[ 'hupso_title_text' ];
1176
  update_option( 'hupso_title_text', $hupso_title_text );
1177
  }
1178
 
1179
  /* Save twitter_via */
1180
  if ( $post ) {
1181
- $hupso_twitter_via = @$_POST[ 'hupso_twitter_via' ];
1182
  update_option( 'hupso_twitter_via', $hupso_twitter_via );
1183
  }
1184
 
1185
  /* Save Facebook image */
1186
  if ( $post ) {
1187
- $hupso_facebook_image = @$_POST[ 'hupso_facebook_image' ];
1188
  update_option( 'hupso_facebook_image', $hupso_facebook_image );
1189
  }
1190
 
1191
  /* Save Facebook custom image */
1192
  if ( $post ) {
1193
- $hupso_facebook_custom_image = @$_POST[ 'hupso_facebook_custom_image' ];
1194
  update_option( 'hupso_facebook_custom_image', $hupso_facebook_custom_image );
1195
  }
1196
 
1197
  /* Save CSS style */
1198
  if ( $post ) {
1199
- $hupso_css_style = @$_POST[ 'hupso_css_style' ];
1200
  update_option( 'hupso_css_style', $hupso_css_style );
1201
  }
1202
 
1203
  /* Save page_url */
1204
  if ( $post ) {
1205
- $hupso_page_url = @$_POST[ 'page_url' ];
1206
  update_option( 'hupso_page_url', $hupso_page_url );
1207
  }
1208
 
1209
  /* Save page_title */
1210
  if ( $post ) {
1211
- $hupso_page_title = @$_POST[ 'page_title' ];
1212
  update_option( 'hupso_page_title', $hupso_page_title );
1213
  }
1214
 
1215
  /* Save hupso_widget_text */
1216
  if ( $post ) {
1217
- $hupso_widget_text = @$_POST[ 'hupso_widget_text' ];
1218
  update_option( 'hupso_widget_text', $hupso_widget_text );
1219
  }
1220
 
1221
  /* Save hupso_password_protected */
1222
  if ( $post ) {
1223
- $hupso_password_protected = @$_POST[ 'hupso_password_protected' ];
1224
  update_option( 'hupso_password_protected', $hupso_password_protected );
1225
  }
1226
 
1227
  /* save hupso_hide_categories */
1228
  if ( $post ) {
1229
- $hupso_hide_categories = @$_POST['hupso_hide_categories'];
1230
  update_option( 'hupso_hide_categories', $hupso_hide_categories );
1231
  }
1232
 
@@ -1238,7 +1286,7 @@ function hupso_admin_settings_save() {
1238
 
1239
  /* save hupso_meta_box */
1240
  if ( $post ) {
1241
- $hupso_meta_box = @$_POST[ 'hupso_meta_box' ];
1242
  update_option( 'hupso_meta_box', $hupso_meta_box );
1243
  }
1244
 
@@ -1251,8 +1299,9 @@ function hupso_admin_settings_save() {
1251
  $operator = 'and'; // 'and' or 'or'
1252
  $post_types = get_post_types( $args, $output, $operator );
1253
  foreach ( $post_types as $post_type ) {
 
1254
  $name = 'hupso_custom_post_' . $post_type;
1255
- $val = @$_POST[$name];
1256
  if ($val == '') {
1257
  update_option ( $name, '0' );
1258
  }
@@ -1282,7 +1331,7 @@ function hupso_the_excerpt( $content ) {
1282
  $hupso_state = 'normal';
1283
 
1284
 
1285
- $hupso_show_excerpts = get_option( 'hupso_show_excerpts' , '1' );
1286
  if ( ( $hupso_show_excerpts == 1 ) && ( $post->post_type != 'attachment' ) ) {
1287
  return hupso_the_content ( $content );
1288
  }
@@ -1296,7 +1345,7 @@ function hupso_the_content_shortcodes( $content ) {
1296
  global $post_url, $post_title, $hupso_shortcode_params;
1297
 
1298
  $value = '';
1299
- $hupso_meta_box = get_option( 'hupso_meta_box', '' );
1300
  if ($hupso_meta_box != "1") {
1301
  $value = '';
1302
  } else {
@@ -1340,28 +1389,28 @@ function hupso_the_content_shortcodes( $content ) {
1340
  else {
1341
  $current_category = '';
1342
  }
1343
- $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
1344
  if ( $hupso_hide_categories == '' ) {
1345
  $hupso_hide_categories = array();
1346
  }
1347
 
1348
- $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
1349
- $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
1350
- $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
1351
 
1352
- $hupso_page_url = get_option( 'hupso_page_url', '' );
1353
- $hupso_page_title = stripslashes(get_option( 'hupso_page_title', '' ));
1354
 
1355
 
1356
  /* default code */
1357
  $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="' . $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" style="border:0px; 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";';
1358
 
1359
- $code = get_option( 'hupso_share_buttons_code', $share_code );
1360
  if ( $hupso_p == 'https:' ) {
1361
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1362
  }
1363
 
1364
- $button_type = get_option( 'hupso_button_type', 'share_toolbar' );
1365
 
1366
  /* Check for old saved button code, prior to version 1.3 */
1367
  if ( get_option( 'hupso_custom', '0' ) == 0 ) {
@@ -1491,9 +1540,9 @@ function hupso_the_content_shortcodes( $content ) {
1491
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1492
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1493
 
1494
- $position = get_option( 'hupso_button_position', 'below' );
1495
 
1496
- $hupso_css_style = get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;');
1497
  if ($hupso_css_style != '') {
1498
  $hupso_css_out = ' style="' . $hupso_css_style . '"';
1499
  }
@@ -1541,7 +1590,7 @@ function hupso_the_content( $content ) {
1541
  }
1542
 
1543
  $value = '';
1544
- $hupso_meta_box = get_option( 'hupso_meta_box', '' );
1545
  if ($hupso_meta_box != "1") {
1546
  $value = '';
1547
  } else {
@@ -1574,7 +1623,7 @@ function hupso_the_content( $content ) {
1574
  else {
1575
  $name = '';
1576
  }
1577
- $val = get_option( $name, '1' );
1578
  if ($val == '0') {
1579
  $content = str_ireplace('[hupso_hide]', '', $content);
1580
  $content = str_ireplace('[hupso]', '', $content);
@@ -1600,7 +1649,7 @@ function hupso_the_content( $content ) {
1600
 
1601
  /* Do not show share buttons on password protected pages, but show it inside widget */
1602
  $pass = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_password : '' );
1603
- $hupso_password_protected = get_option( 'hupso_password_protected', '0');
1604
  if ( $hupso_state == 'normal' ) {
1605
  if ($pass != '') {
1606
  if (!$hupso_password_protected) {
@@ -1616,7 +1665,7 @@ function hupso_the_content( $content ) {
1616
  }
1617
  }
1618
 
1619
- $hupso_show_search = get_option( 'hupso_show_search' , '1' );
1620
  if ( ($hupso_state == 'normal') && (is_search()) && ($hupso_show_search != 1) ) {
1621
  $content = str_ireplace('[hupso_hide]', '', $content);
1622
  $content = str_ireplace('[hupso]', '', $content);
@@ -1624,7 +1673,7 @@ function hupso_the_content( $content ) {
1624
  return $content;
1625
  }
1626
 
1627
- $hupso_show_posts = get_option( 'hupso_show_posts' , '1' );
1628
  if ( ($hupso_state == 'normal') && (is_single()) && ($hupso_show_posts != 1) ) {
1629
  $content = str_ireplace('[hupso_hide]', '', $content);
1630
  $content = str_ireplace('[hupso]', '', $content);
@@ -1633,7 +1682,7 @@ function hupso_the_content( $content ) {
1633
 
1634
  }
1635
 
1636
- $hupso_show_pages = get_option( 'hupso_show_pages' , '1' );
1637
  if ( ($hupso_state == 'normal') && (is_page()) && ($hupso_show_pages != 1) ) {
1638
  $content = str_ireplace('[hupso_hide]', '', $content);
1639
  $content = str_ireplace('[hupso]', '', $content);
@@ -1642,8 +1691,8 @@ function hupso_the_content( $content ) {
1642
 
1643
  }
1644
 
1645
- $hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
1646
- $hupso_show_category = get_option( 'hupso_show_category' , '1' );
1647
 
1648
  /* Do not show share buttons if option is disabled */
1649
  if ( ($hupso_state == 'normal') && (is_home()) && ($hupso_show_frontpage != 1) ) {
@@ -1670,7 +1719,7 @@ function hupso_the_content( $content ) {
1670
  else {
1671
  $current_category = '';
1672
  }
1673
- $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
1674
  if ( $hupso_hide_categories == '' ) {
1675
  $hupso_hide_categories = array();
1676
  }
@@ -1682,9 +1731,9 @@ function hupso_the_content( $content ) {
1682
 
1683
  }
1684
 
1685
- $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
1686
- $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
1687
- $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
1688
 
1689
  $post_url = ( isset($GLOBALS['post']) ? get_permalink($GLOBALS['post']->ID) : get_permalink() );
1690
  $post_title = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_title : '' );
@@ -1700,14 +1749,14 @@ function hupso_the_content( $content ) {
1700
  $post_title = '';
1701
  }
1702
 
1703
- $hupso_page_url = get_option( 'hupso_page_url', '' );
1704
- $hupso_page_title = stripslashes(get_option( 'hupso_page_title', '' ));
1705
 
1706
 
1707
  /* default code */
1708
  $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="' . $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" style="border:0px; 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";';
1709
 
1710
- $code = get_option( 'hupso_share_buttons_code', $share_code );
1711
  if ( $hupso_p == 'https:' ) {
1712
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1713
  }
@@ -1847,9 +1896,9 @@ function hupso_the_content( $content ) {
1847
  $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1848
  $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1849
 
1850
- $position = get_option( 'hupso_button_position', 'below' );
1851
 
1852
- $hupso_css_style = get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;');
1853
  if ($hupso_css_style != '') {
1854
  $hupso_css_out = ' style="' . $hupso_css_style . '"';
1855
  }
@@ -1898,7 +1947,7 @@ function hupso_settings_print_services() {
1898
  $service_name = str_replace( ' ', '', $service_name );
1899
 
1900
  $checked = '';
1901
- $value = get_option( 'hupso_' . $service_name , in_array( $service_text, (array) $hupso_default_services ) );
1902
  if ( $value == "1" ) {
1903
  $checked = 'checked="checked"';
1904
  }
@@ -2003,7 +2052,7 @@ function hupso_counters_lang_list() {
2003
 
2004
  asort($languages);
2005
  echo '<option value="en_US">English (US)</option>';
2006
- $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
2007
  if ($hupso_counters_lang == '') {
2008
  $hupso_counters_lang = 'en_US';
2009
  }
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
  */
13
 
14
  global $HUPSO_VERSION;
15
+ $HUPSO_VERSION = '4.0.5';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
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
  }
85
 
86
  /* Add stylesheet */
87
  add_action( 'wp_enqueue_scripts', 'hupso_add_my_stylesheet' );
88
+ add_action( 'admin_init', 'hupso_start_session' );
89
+
90
+ function hupso_start_session() {
91
+ if ( session_id() == '' ) {
92
+ session_start();
93
+ }
94
+ }
95
 
96
  function hupso_add_my_stylesheet() {
97
  wp_register_style( 'hupso_css', plugins_url('style.css', __FILE__) );
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
  */
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':
271
  return $content;
272
  }
273
 
274
+
275
  function hupso_admin_settings_show() {
276
+ if ( !current_user_can( 'manage_options' ) ) {
277
+ wp_die( __( 'You do not have sufficient permissions to access this page.' , 'hupso') );
278
+ }
279
+
280
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
281
 
282
  wp_enqueue_script(
290
  );
291
 
292
 
293
+
294
  $hupso_lang_code = __('en_US', 'hupso');
295
  $hupso_language = __('English', 'hupso');
296
  $hupso_share_image = __('Share', 'hupso');
297
  $hupso_excerpts = __('Excerpts', 'hupso');
298
 
 
 
 
 
 
299
  /* save settings */
300
  if ( @$_POST[ 'button_type' ] != '' ) {
301
+ // check token
302
+ $token = $_SESSION['h_settings_token'];
303
+ $post_token = $_POST['h_settings_token'];
304
+ if ($token == $post_token) {
305
+ hupso_admin_settings_save();
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>';
313
  echo '<form name="hupso_settings_form" method="post" action="">';
314
 
315
  echo '<div id="right" style="float:right; width:200px; margin-right:10px; margin-left:20px; margin-top:20px;">';
316
+ echo '<div id="button_preview" style="background: #F7FFBF; padding: 10px 10px 10px 10px; border: 1px solid rgb(204, 204, 204);"><table><tr><td><h3>' . __( 'Preview', 'hupso') . '</h3></td><td style="padding-left:50px;"><input class="button-primary" name="submit-preview" type="button" onclick="hupso_create_code()" value="' . __('Update', 'hupso') . '" /></td></tr></table><br/>';
317
  echo '<div id="button"></div>';
318
  echo '<div id="move_mouse"><p style="font-size:13px; padding-top: 15px;"><b>Move your mouse over the button to see the sharing menu.</b></p></div><br/><br/>';
319
  echo '<div style="padding-left:40px;"><input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings', 'hupso') . '" /></div>';
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
  <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 = '';
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
 
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
  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');?>:
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;">
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
  <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
  <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
  $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
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
  }
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
  $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
  <?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/>
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
  }
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());
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/>
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
  <?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'); ?>
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
  $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;
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>
994
 
995
  </table>
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>
1003
  </div>
1009
 
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') );
1040
+ }
1041
+
1042
  global $hupso_all_services, $hupso_default_services, $hupso_plugin_url;
1043
  update_option( 'hupso_custom', '1' );
1044
 
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
 
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
 
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
 
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
  $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
  $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
  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
  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 */
1406
  $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="' . $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" style="border:0px; 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";';
1407
 
1408
+ $code = get_option( 'hupso_share_buttons_code', $share_code );
1409
  if ( $hupso_p == 'https:' ) {
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 ) {
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
  }
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
  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
 
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
  }
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
  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
 
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
 
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
  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
 
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
  $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 */
1757
  $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="' . $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" style="border:0px; 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";';
1758
 
1759
+ $code = get_option( 'hupso_share_buttons_code', $share_code );
1760
  if ( $hupso_p == 'https:' ) {
1761
  $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1762
  }
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
  }
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
 
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
  }