AddToAny Share Buttons - Version 1.7.47

Version Description

  • Additional input validation & sanitization in admin
  • Additional output escaping
  • Update Twitter icon color
  • Remove Mix
Download this release

Release Info

Developer micropat
Plugin Icon 128x128 AddToAny Share Buttons
Version 1.7.47
Comparing to
See all releases

Code changes from version 1.7.46 to 1.7.47

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, share, icons, social media, share buttons, sharing, share button,
4
  Requires at least: 3.7
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 1.7.46
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
@@ -346,6 +346,12 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
346
 
347
  == Changelog ==
348
 
 
 
 
 
 
 
349
  = 1.7.46 =
350
  * In addition to requiring the `manage_options` user capability in Settings, require the `unfiltered_html` user capability for changing the Sharing Header, Additional JavaScript, and Additional CSS fields
351
  * Note: In WordPress Multisite, only Super Admins have the `unfiltered_html` capability
4
  Requires at least: 3.7
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 1.7.47
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
346
 
347
  == Changelog ==
348
 
349
+ = 1.7.47 =
350
+ * Additional input validation & sanitization in admin
351
+ * Additional output escaping
352
+ * Update Twitter icon color
353
+ * Remove Mix
354
+
355
  = 1.7.46 =
356
  * In addition to requiring the `manage_options` user capability in Settings, require the `unfiltered_html` user capability for changing the Sharing Header, Additional JavaScript, and Additional CSS fields
357
  * Note: In WordPress Multisite, only Super Admins have the `unfiltered_html` capability
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AddToAny Share Buttons
4
  * Plugin URI: https://www.addtoany.com/
5
  * Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, LinkedIn, Pinterest, WhatsApp and many more.
6
- * Version: 1.7.46
7
  * Author: AddToAny
8
  * Author URI: https://www.addtoany.com/
9
  * Text Domain: add-to-any
@@ -166,7 +166,7 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
166
  // Cache for _BUTTON.
167
  $html_container_close = $args['html_container_close'];
168
  // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON.
169
- unset($args['html_container_close']);
170
 
171
  if ( ! isset( $args['html_wrap_open'] ) )
172
  $args['html_wrap_open'] = "";
@@ -185,7 +185,7 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
185
  if ( true == $args['output_later'] )
186
  return $kit_html;
187
  else
188
- echo $kit_html;
189
  }
190
 
191
  function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
@@ -387,7 +387,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
387
  if ( true == $args['output_later'] )
388
  return $ind_html;
389
  else
390
- echo $ind_html;
391
  }
392
 
393
  function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
@@ -489,7 +489,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
489
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
490
  return $button_html;
491
  else
492
- echo $button_html;
493
  }
494
 
495
  function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
@@ -532,17 +532,16 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
532
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
533
  return $special_html;
534
  else
535
- echo $special_html;
536
  }
537
 
538
- if ( ! function_exists( 'A2A_menu_locale' ) ) {
539
- function A2A_menu_locale() {
540
- global $A2A_locale;
541
- $locale = get_locale();
542
- if ( $locale == 'en_US' || $locale == 'en' || $A2A_locale != '' )
543
- return false;
544
-
545
- $A2A_locale = 'a2a_localize = {
546
  Share: "' . __( "Share", 'add-to-any' ) . '",
547
  Save: "' . __( "Save", 'add-to-any' ) . '",
548
  Subscribe: "' . __( "Subscribe", 'add-to-any' ) . '",
@@ -565,8 +564,7 @@ if ( ! function_exists( 'A2A_menu_locale' ) ) {
565
  ThanksForFollowing: "' . __( "Thanks for following!", 'add-to-any' ) . '"
566
  };
567
  ';
568
- return $A2A_locale;
569
- }
570
  }
571
 
572
  function ADDTOANY_FOLLOW_KIT( $args = array() ) {
@@ -608,13 +606,13 @@ function ADDTOANY_FOLLOW_KIT( $args = array() ) {
608
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
609
  return $follow_html;
610
  else
611
- echo $follow_html;
612
  }
613
 
614
  function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
615
  $options = get_option( 'addtoany_options', array() );
616
 
617
- $floating_html = '';
618
 
619
  // Overridable by args below.
620
  $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical']
@@ -706,7 +704,7 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
706
  $vertical_args['kit_style'] .= 'background-color:transparent;';
707
  }
708
 
709
- $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $vertical_args );
710
  }
711
 
712
  // Horizontal type?
@@ -753,14 +751,14 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
753
  $horizontal_args['kit_style'] .= 'background-color:transparent;';
754
  }
755
 
756
- $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $horizontal_args );
757
  }
758
  }
759
 
760
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
761
- return $floating_html;
762
  else
763
- echo $floating_html;
764
  }
765
 
766
 
@@ -814,7 +812,7 @@ function A2A_SHARE_SAVE_head_script() {
814
  $icon_color = $icon_bg_color . $icon_fg_color;
815
 
816
  // Floating vertical relative to content.
817
- $floating_js = '';
818
  if (
819
  isset( $options['floating_vertical'] )
820
  && in_array( $options['floating_vertical'], array( 'left_attached', 'right_attached' ) )
@@ -830,7 +828,7 @@ function A2A_SHARE_SAVE_head_script() {
830
  $floating_js_kit_style = 'left_attached' === $options['floating_vertical'] ? 'margin-left:' . $floating_js_offset . ';' : '';
831
  $floating_js_kit_style .= 'top:' . $floating_js_position . ';';
832
 
833
- $floating_js = "\n"
834
  . 'a2a_config.callbacks.push({'
835
  . 'ready: function(){'
836
  . 'var d=document;'
@@ -852,31 +850,32 @@ function A2A_SHARE_SAVE_head_script() {
852
  }
853
 
854
  // Enternal script call + initial JS + set-once variables.
855
- $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
856
- $script_configs = ( ( $cache ) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
857
  . ( $icon_color ? "\n" . 'a2a_config.icon_color="' . $icon_color . '";' : '' )
858
  . ( isset( $options['onclick'] ) && '1' == $options['onclick'] ? "\n" . 'a2a_config.onclick=1;' : '' )
859
  . ( $additional_js ? "\n" . stripslashes( $additional_js ) : '' );
860
 
861
- $javascript_header = "\n"
862
  . '<script data-cfasync="false">' . "\n"
863
  . 'window.a2a_config=window.a2a_config||{};'
864
  . 'a2a_config.callbacks=[];a2a_config.overlays=[];'
865
  . 'a2a_config.templates={};'
866
- . A2A_menu_locale()
867
- . $floating_js
868
- . $script_configs
869
  . "\n"
870
  . '(function(d,s,a,b){'
871
  . 'a=d.createElement(s);'
872
  . 'b=d.getElementsByTagName(s)[0];'
873
  . 'a.async=1;'
874
- . 'a.src="' . $static_server . '/page.js' . $querystring . '";'
875
  . 'b.parentNode.insertBefore(a,b);'
876
  . '})(document,"script");'
877
  . "\n</script>\n";
878
 
879
- echo $javascript_header;
 
880
  }
881
 
882
  add_action( 'wp_head', 'A2A_SHARE_SAVE_head_script' );
@@ -885,9 +884,10 @@ function A2A_SHARE_SAVE_footer_script() {
885
  if ( is_admin() || is_feed() )
886
  return;
887
 
888
- $floating_html = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) );
889
 
890
- echo $floating_html;
 
891
  }
892
 
893
  add_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
3
  * Plugin Name: AddToAny Share Buttons
4
  * Plugin URI: https://www.addtoany.com/
5
  * Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, LinkedIn, Pinterest, WhatsApp and many more.
6
+ * Version: 1.7.47
7
  * Author: AddToAny
8
  * Author URI: https://www.addtoany.com/
9
  * Text Domain: add-to-any
166
  // Cache for _BUTTON.
167
  $html_container_close = $args['html_container_close'];
168
  // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON.
169
+ unset( $args['html_container_close'] );
170
 
171
  if ( ! isset( $args['html_wrap_open'] ) )
172
  $args['html_wrap_open'] = "";
185
  if ( true == $args['output_later'] )
186
  return $kit_html;
187
  else
188
+ echo wp_kses_post( $kit_html );
189
  }
190
 
191
  function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
387
  if ( true == $args['output_later'] )
388
  return $ind_html;
389
  else
390
+ echo wp_kses_post( $ind_html );
391
  }
392
 
393
  function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
489
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
490
  return $button_html;
491
  else
492
+ echo wp_kses_post( $button_html );
493
  }
494
 
495
  function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
532
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
533
  return $special_html;
534
  else
535
+ echo wp_kses_post( $special_html );
536
  }
537
 
538
+ function addtoany_menu_locale_escaped() {
539
+ global $A2A_locale;
540
+ $locale = get_locale();
541
+ if ( $locale == 'en_US' || $locale == 'en' || $A2A_locale != '' )
542
+ return false;
543
+
544
+ $A2A_locale = 'a2a_localize = {
 
545
  Share: "' . __( "Share", 'add-to-any' ) . '",
546
  Save: "' . __( "Save", 'add-to-any' ) . '",
547
  Subscribe: "' . __( "Subscribe", 'add-to-any' ) . '",
564
  ThanksForFollowing: "' . __( "Thanks for following!", 'add-to-any' ) . '"
565
  };
566
  ';
567
+ return $A2A_locale;
 
568
  }
569
 
570
  function ADDTOANY_FOLLOW_KIT( $args = array() ) {
606
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
607
  return $follow_html;
608
  else
609
+ echo wp_kses_post( $follow_html );
610
  }
611
 
612
  function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
613
  $options = get_option( 'addtoany_options', array() );
614
 
615
+ $floating_html_escaped = '';
616
 
617
  // Overridable by args below.
618
  $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical']
704
  $vertical_args['kit_style'] .= 'background-color:transparent;';
705
  }
706
 
707
+ $floating_html_escaped .= ADDTOANY_SHARE_SAVE_KIT( $vertical_args );
708
  }
709
 
710
  // Horizontal type?
751
  $horizontal_args['kit_style'] .= 'background-color:transparent;';
752
  }
753
 
754
+ $floating_html_escaped .= ADDTOANY_SHARE_SAVE_KIT( $horizontal_args );
755
  }
756
  }
757
 
758
  if ( isset( $args['output_later'] ) && $args['output_later'] == true )
759
+ return $floating_html_escaped;
760
  else
761
+ echo $floating_html_escaped;
762
  }
763
 
764
 
812
  $icon_color = $icon_bg_color . $icon_fg_color;
813
 
814
  // Floating vertical relative to content.
815
+ $floating_js_escaped = '';
816
  if (
817
  isset( $options['floating_vertical'] )
818
  && in_array( $options['floating_vertical'], array( 'left_attached', 'right_attached' ) )
828
  $floating_js_kit_style = 'left_attached' === $options['floating_vertical'] ? 'margin-left:' . $floating_js_offset . ';' : '';
829
  $floating_js_kit_style .= 'top:' . $floating_js_position . ';';
830
 
831
+ $floating_js_escaped = "\n"
832
  . 'a2a_config.callbacks.push({'
833
  . 'ready: function(){'
834
  . 'var d=document;'
850
  }
851
 
852
  // Enternal script call + initial JS + set-once variables.
853
+ $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '';
854
+ $script_configs_escaped = ( ( $cache ) ? "\n" . 'a2a_config.static_server=' . wp_json_encode( esc_url( $static_server ), JSON_UNESCAPED_SLASHES ) . ';' : '' )
855
  . ( $icon_color ? "\n" . 'a2a_config.icon_color="' . $icon_color . '";' : '' )
856
  . ( isset( $options['onclick'] ) && '1' == $options['onclick'] ? "\n" . 'a2a_config.onclick=1;' : '' )
857
  . ( $additional_js ? "\n" . stripslashes( $additional_js ) : '' );
858
 
859
+ $javascript_header_escaped = "\n"
860
  . '<script data-cfasync="false">' . "\n"
861
  . 'window.a2a_config=window.a2a_config||{};'
862
  . 'a2a_config.callbacks=[];a2a_config.overlays=[];'
863
  . 'a2a_config.templates={};'
864
+ . addtoany_menu_locale_escaped()
865
+ . $floating_js_escaped
866
+ . $script_configs_escaped
867
  . "\n"
868
  . '(function(d,s,a,b){'
869
  . 'a=d.createElement(s);'
870
  . 'b=d.getElementsByTagName(s)[0];'
871
  . 'a.async=1;'
872
+ . 'a.src=' . wp_json_encode( esc_url( $static_server . '/page.js' . $querystring ), JSON_UNESCAPED_SLASHES ) . ';'
873
  . 'b.parentNode.insertBefore(a,b);'
874
  . '})(document,"script");'
875
  . "\n</script>\n";
876
 
877
+ // Output escaped HTML. Arbitrary JavaScript is expected from users with the `unfiltered_html` capability.
878
+ echo $javascript_header_escaped;
879
  }
880
 
881
  add_action( 'wp_head', 'A2A_SHARE_SAVE_head_script' );
884
  if ( is_admin() || is_feed() )
885
  return;
886
 
887
+ $floating_html_escaped = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) );
888
 
889
+ // Output escaped HTML and avoid stripping positional styles with wp_kses*.
890
+ echo $floating_html_escaped;
891
  }
892
 
893
  add_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
addtoany.admin.php CHANGED
@@ -108,8 +108,8 @@ function A2A_SHARE_SAVE_enqueue_pointer_script_style( $hook_suffix ) {
108
  add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' );
109
 
110
  function A2A_SHARE_SAVE_pointer_print_scripts() {
111
- $pointer_content_settings = '<h3>AddToAny Sharing Settings</h3>';
112
- $pointer_content_settings .= '<p>To customize your AddToAny share buttons, click &quot;AddToAny&quot; in the Settings menu.</p>';
113
 
114
  // Get array list of dismissed pointers for current user and convert it to array
115
  $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
@@ -119,7 +119,7 @@ function A2A_SHARE_SAVE_pointer_print_scripts() {
119
  <?php if ( ! in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) : ?>
120
  jQuery(document).ready( function($) {
121
  $('#menu-settings').pointer({
122
- content: '<?php echo $pointer_content_settings; ?>',
123
  position: {
124
  edge: 'left', // arrow direction
125
  align: 'center' // vertical alignment
@@ -199,6 +199,24 @@ function _a2a_valid_hex_color( $value ) {
199
  return false;
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  function A2A_SHARE_SAVE_options_page() {
203
 
204
  global $A2A_SHARE_SAVE_plugin_url,
@@ -277,7 +295,7 @@ function A2A_SHARE_SAVE_options_page() {
277
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] )
278
  ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] : '32';
279
 
280
- $new_options['floating_horizontal_bg'] = ! empty( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] : 'transparent';
281
  $new_options['floating_horizontal_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] : '#ffffff';
282
 
283
  $new_options['floating_vertical_position'] = (
@@ -287,7 +305,7 @@ function A2A_SHARE_SAVE_options_page() {
287
 
288
  $new_options['floating_vertical_attached_to'] = (
289
  ! empty( $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] )
290
- ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] : 'main, [role="main"], article, .status-publish';
291
 
292
  $new_options['floating_vertical_offset'] = (
293
  isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
@@ -329,13 +347,13 @@ function A2A_SHARE_SAVE_options_page() {
329
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] )
330
  ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] : '32';
331
 
332
- $new_options['floating_vertical_bg'] = ! empty( $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] : 'transparent';
333
  $new_options['floating_vertical_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] : '#ffffff';
334
 
335
  } else {
336
  // Standard options screen
337
 
338
- $new_options['position'] = ( isset( $_POST['A2A_SHARE_SAVE_position'] ) ) ? $_POST['A2A_SHARE_SAVE_position'] : 'bottom';
339
  $new_options['display_in_posts_on_front_page'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] == '1' ) ? '1' : '-1';
340
  $new_options['display_in_posts_on_archive_pages'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] == '1' ) ? '1' : '-1';
341
  $new_options['display_in_excerpts'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_excerpts'] ) && $_POST['A2A_SHARE_SAVE_display_in_excerpts'] == '1' ) ? '1' : '-1';
@@ -345,21 +363,21 @@ function A2A_SHARE_SAVE_options_page() {
345
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
346
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
347
  $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
348
- $new_options['icon_bg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_bg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_bg'] : 'original';
349
  $new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_bg_color'] : '#2a2a2a';
350
- $new_options['icon_fg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_fg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_fg'] : 'original';
351
  $new_options['icon_fg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_fg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_fg_color'] : '#ffffff';
352
- $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
353
- $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
354
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
355
  $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) && current_user_can( 'unfiltered_html' ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
356
  $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
357
  $new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
358
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
359
- $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) : '';
360
- $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_type'] : 'png';
361
- $new_options['custom_icons_width'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_width'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_width'] : '';
362
- $new_options['custom_icons_height'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_height'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_height'] : '';
363
  $new_options['cache'] = ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) ? '1' : '-1';
364
 
365
  $custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
@@ -377,7 +395,7 @@ function A2A_SHARE_SAVE_options_page() {
377
  }
378
 
379
  // Store desired text for text-only:
380
- $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any');
381
 
382
  // Store chosen individual services to make active
383
  $active_services = array();
@@ -483,7 +501,7 @@ function A2A_SHARE_SAVE_options_page() {
483
  <th scope="row"><?php _e("Share Buttons", 'add-to-any'); ?></th>
484
  <td><fieldset>
485
  <ul id="addtoany_services_sortable" class="addtoany_admin_list addtoany_override">
486
- <li class="dummy"><img src="<?php echo $A2A_SHARE_SAVE_plugin_url; ?>/icons/transparent.gif" width="32" height="32" alt="" /></li>
487
  </ul>
488
  <p id="addtoany_services_info"><?php _e("Choose the services you want below. &nbsp;Click a chosen service again to remove. &nbsp;Reorder services by dragging and dropping as they appear above.", 'add-to-any'); ?></p>
489
  <ul id="addtoany_services_selectable" class="addtoany_admin_list">
@@ -498,29 +516,29 @@ function A2A_SHARE_SAVE_options_page() {
498
  if ( ! isset( $site['icon'] ) )
499
  $site['icon'] = 'default';
500
 
501
- $special_service = ( in_array( $service_safe_name, array( 'pinterest', 'reddit', 'tumblr', ) ) )
502
  ? ' class="addtoany_special_service"' : '';
503
  ?>
504
- <li data-addtoany-icon-name="<?php echo esc_attr( $site['icon'] ); ?>"<?php echo $special_service; ?> id="a2a_wp_<?php echo esc_attr( $service_safe_name ); ?>" title="<?php echo esc_attr( $site['name'] ); ?>">
505
  <img src="<?php echo esc_attr( isset( $site['icon_url'] ) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url.'/icons/'.$site['icon'].'.svg' ); ?>" width="<?php echo isset( $site['icon_width'] ) ? esc_attr( $site['icon_width'] ) : '24'; ?>" height="<?php echo isset( $site['icon_height'] ) ? esc_attr( $site['icon_height'] ) : '24'; ?>"<?php if ( isset( $site['color'] ) ) : ?> style="background-color:#<?php echo esc_attr( $site['color'] ); endif; ?>"><?php echo esc_html( $site['name'] ); ?>
506
  </li>
507
  <?php
508
  } ?>
509
  <li style="clear:left" id="a2a_wp_facebook_like" class="addtoany_special_service addtoany_3p_button" title="Facebook Like button">
510
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url.'/icons/facebook_like_2x.png'; ?>" width="101" height="40" alt="Facebook Like" />
511
  </li>
512
  <li id="a2a_wp_twitter_tweet" class="addtoany_special_service addtoany_3p_button" title="Twitter Tweet button">
513
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url.'/icons/twitter_tweet_2x.png'; ?>" width="122" height="40" alt="Twitter Tweet" />
514
  </li>
515
  <li id="a2a_wp_pinterest_pin" class="addtoany_special_service addtoany_3p_button" title="Pinterest Pin It button">
516
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url.'/icons/pinterest_pin_2x.png'; ?>" width="80" height="40" alt="Pinterest Pin It" />
517
  </li>
518
  </ul>
519
  <div id="addtoany_services_tip">
520
  <p style="line-height:0">
521
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url; ?>/icons/instagram.svg" width="24" height="24" style="margin-right:8px">
522
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url; ?>/icons/youtube.svg" width="24" height="24" style="margin-right:8px">
523
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url; ?>/icons/snapchat.svg" width="24" height="24">
524
  </p>
525
  <p>You can setup Instagram, YouTube, Snapchat, and other buttons in an AddToAny Follow widget.</p><p>Add the &quot;AddToAny Follow&quot; widget in <a href="customize.php?autofocus[panel]=widgets&amp;return=options-general.php%3Fpage%3Daddtoany">Customize</a> or <a href="widgets.php">Widgets</a>.</p>
526
  </div>
@@ -533,7 +551,7 @@ function A2A_SHARE_SAVE_options_page() {
533
  <div class="addtoany_extra_element addtoany_icon_size_large">
534
  <label class="addtoany_override a2a_kit_size_32">
535
  <input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
536
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url.'/icons/a2a.svg'; ?>" width="32" height="32" alt="AddToAny" onclick="this.parentNode.firstChild.checked=true" />
537
  </label>
538
  <br>
539
  </div>
@@ -1072,7 +1090,6 @@ function A2A_SHARE_SAVE_admin_head() {
1072
  jQuery(this).remove();
1073
  });
1074
 
1075
-
1076
  if( jQuery('#addtoany_services_sortable li').not('.dummy').length==1 )
1077
  jQuery('#addtoany_services_sortable').find('.dummy').show();
1078
 
@@ -1090,7 +1107,7 @@ function A2A_SHARE_SAVE_admin_head() {
1090
  $admin_services_saved = isset( $_POST['A2A_SHARE_SAVE_active_services'] ) && isset( $_POST['Submit'] );
1091
 
1092
  if ( $admin_services_saved ) {
1093
- $active_services = $_POST['A2A_SHARE_SAVE_active_services'];
1094
  } elseif ( ! $admin_services_saved && isset( $options['active_services'] ) ) {
1095
  $active_services = $options['active_services'];
1096
  } else {
@@ -1101,14 +1118,14 @@ function A2A_SHARE_SAVE_admin_head() {
1101
  $active_services_last = end($active_services);
1102
  if($admin_services_saved)
1103
  $active_services_last = substr($active_services_last, 7); // Remove a2a_wp_
1104
- $active_services_quoted = '';
1105
  $counters_enabled_js = '';
1106
  foreach ($active_services as $service) {
1107
  if ( $admin_services_saved )
1108
  $service = substr( $service, 7 ); // Remove a2a_wp_
1109
- $active_services_quoted .= json_encode( $service );
1110
  if ( $service != $active_services_last )
1111
- $active_services_quoted .= ',';
1112
 
1113
  // AddToAny counter enabled?
1114
  if ( in_array( $service, array( 'pinterest', 'reddit', 'tumblr', ) ) ) {
@@ -1123,7 +1140,7 @@ function A2A_SHARE_SAVE_admin_head() {
1123
  }
1124
  }
1125
  ?>
1126
- var services = [<?php echo $active_services_quoted; ?>],
1127
  service_options = {};
1128
 
1129
  <?php
@@ -1313,7 +1330,7 @@ function addtoany_admin_scripts( $current_admin_page ) {
1313
 
1314
  // If current screen is the default tab and WordPress >= 4.9
1315
  if ( empty( $_GET['action'] ) && function_exists( 'wp_enqueue_code_editor' ) ) {
1316
- $readyOnly = current_user_can( 'unfiltered_html' ) ? false : 'nocursor';
1317
 
1318
  // Additional JavaScript editor.
1319
  // Enqueue code editor and settings for manipulating JavaScript.
@@ -1327,7 +1344,7 @@ function addtoany_admin_scripts( $current_admin_page ) {
1327
  ),
1328
  'codemirror' => array(
1329
  'lineNumbers' => false,
1330
- 'readOnly' => $readyOnly,
1331
  ),
1332
  ) );
1333
 
@@ -1347,7 +1364,7 @@ function addtoany_admin_scripts( $current_admin_page ) {
1347
  'type' => 'text/css',
1348
  'codemirror' => array(
1349
  'lineNumbers' => false,
1350
- 'readOnly' => $readyOnly,
1351
  ),
1352
  ) );
1353
 
108
  add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' );
109
 
110
  function A2A_SHARE_SAVE_pointer_print_scripts() {
111
+ $pointer_content_settings_safe = '<h3>AddToAny Sharing Settings</h3>';
112
+ $pointer_content_settings_safe .= '<p>To customize your AddToAny share buttons, click &quot;AddToAny&quot; in the Settings menu.</p>';
113
 
114
  // Get array list of dismissed pointers for current user and convert it to array
115
  $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
119
  <?php if ( ! in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) : ?>
120
  jQuery(document).ready( function($) {
121
  $('#menu-settings').pointer({
122
+ content: '<?php echo $pointer_content_settings_safe; ?>',
123
  position: {
124
  edge: 'left', // arrow direction
125
  align: 'center' // vertical alignment
199
  return false;
200
  }
201
 
202
+ function _a2a_valid_content_position_selection( $value ) {
203
+ return in_array( $value, array('top', 'bottom', 'both') ) ? true : false;
204
+ }
205
+
206
+ function _a2a_valid_floating_bg_color_selection( $value ) {
207
+ return in_array( $value, array( 'transparent', 'custom' ) ) ? true : false;
208
+ }
209
+
210
+ function _a2a_valid_icon_color_selection( $value, $bg_or_fg ) {
211
+ if ( 'bg' === $bg_or_fg ) {
212
+ $valid_selections = array('original', 'custom', 'transparent');
213
+ } elseif ( 'fg' === $bg_or_fg ) {
214
+ $valid_selections = array('original', 'custom');
215
+ }
216
+
217
+ return in_array( $value, $valid_selections ) ? true : false;
218
+ }
219
+
220
  function A2A_SHARE_SAVE_options_page() {
221
 
222
  global $A2A_SHARE_SAVE_plugin_url,
295
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] )
296
  ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] : '32';
297
 
298
+ $new_options['floating_horizontal_bg'] = _a2a_valid_floating_bg_color_selection( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] : 'transparent';
299
  $new_options['floating_horizontal_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] : '#ffffff';
300
 
301
  $new_options['floating_vertical_position'] = (
305
 
306
  $new_options['floating_vertical_attached_to'] = (
307
  ! empty( $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] )
308
+ ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] ) : 'main, [role="main"], article, .status-publish';
309
 
310
  $new_options['floating_vertical_offset'] = (
311
  isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
347
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] )
348
  ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] : '32';
349
 
350
+ $new_options['floating_vertical_bg'] = _a2a_valid_floating_bg_color_selection( $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] : 'transparent';
351
  $new_options['floating_vertical_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] : '#ffffff';
352
 
353
  } else {
354
  // Standard options screen
355
 
356
+ $new_options['position'] = ( _a2a_valid_content_position_selection( $_POST['A2A_SHARE_SAVE_position'] ) ) ? $_POST['A2A_SHARE_SAVE_position'] : 'bottom';
357
  $new_options['display_in_posts_on_front_page'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] == '1' ) ? '1' : '-1';
358
  $new_options['display_in_posts_on_archive_pages'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] == '1' ) ? '1' : '-1';
359
  $new_options['display_in_excerpts'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_excerpts'] ) && $_POST['A2A_SHARE_SAVE_display_in_excerpts'] == '1' ) ? '1' : '-1';
363
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
364
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
365
  $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
366
+ $new_options['icon_bg'] = _a2a_valid_icon_color_selection( $_POST['A2A_SHARE_SAVE_icon_bg'], 'bg' ) ? $_POST['A2A_SHARE_SAVE_icon_bg'] : 'original';
367
  $new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_bg_color'] : '#2a2a2a';
368
+ $new_options['icon_fg'] = _a2a_valid_icon_color_selection( $_POST['A2A_SHARE_SAVE_icon_fg'], 'fg' ) ? $_POST['A2A_SHARE_SAVE_icon_fg'] : 'original';
369
  $new_options['icon_fg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_fg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_fg_color'] : '#ffffff';
370
+ $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button'] ) : '';
371
+ $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button_custom'] ) : '';
372
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
373
  $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) && current_user_can( 'unfiltered_html' ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
374
  $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
375
  $new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
376
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
377
+ $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( sanitize_text_field( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) : '';
378
+ $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) : 'png';
379
+ $new_options['custom_icons_width'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_width'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_custom_icons_width'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_width'] : '';
380
+ $new_options['custom_icons_height'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_height'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_custom_icons_height'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_height'] : '';
381
  $new_options['cache'] = ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) ? '1' : '-1';
382
 
383
  $custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
395
  }
396
 
397
  // Store desired text for text-only:
398
+ $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button_text'] ) : __('Share','add-to-any');
399
 
400
  // Store chosen individual services to make active
401
  $active_services = array();
501
  <th scope="row"><?php _e("Share Buttons", 'add-to-any'); ?></th>
502
  <td><fieldset>
503
  <ul id="addtoany_services_sortable" class="addtoany_admin_list addtoany_override">
504
+ <li class="dummy"><img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/transparent.gif" width="32" height="32" alt="" /></li>
505
  </ul>
506
  <p id="addtoany_services_info"><?php _e("Choose the services you want below. &nbsp;Click a chosen service again to remove. &nbsp;Reorder services by dragging and dropping as they appear above.", 'add-to-any'); ?></p>
507
  <ul id="addtoany_services_selectable" class="addtoany_admin_list">
516
  if ( ! isset( $site['icon'] ) )
517
  $site['icon'] = 'default';
518
 
519
+ $special_service_class_attr_safe = ( in_array( $service_safe_name, array( 'pinterest', 'reddit', 'tumblr', ) ) )
520
  ? ' class="addtoany_special_service"' : '';
521
  ?>
522
+ <li data-addtoany-icon-name="<?php echo esc_attr( $site['icon'] ); ?>"<?php echo $special_service_class_attr_safe; ?> id="a2a_wp_<?php echo esc_attr( $service_safe_name ); ?>" title="<?php echo esc_attr( $site['name'] ); ?>">
523
  <img src="<?php echo esc_attr( isset( $site['icon_url'] ) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url.'/icons/'.$site['icon'].'.svg' ); ?>" width="<?php echo isset( $site['icon_width'] ) ? esc_attr( $site['icon_width'] ) : '24'; ?>" height="<?php echo isset( $site['icon_height'] ) ? esc_attr( $site['icon_height'] ) : '24'; ?>"<?php if ( isset( $site['color'] ) ) : ?> style="background-color:#<?php echo esc_attr( $site['color'] ); endif; ?>"><?php echo esc_html( $site['name'] ); ?>
524
  </li>
525
  <?php
526
  } ?>
527
  <li style="clear:left" id="a2a_wp_facebook_like" class="addtoany_special_service addtoany_3p_button" title="Facebook Like button">
528
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/facebook_like_2x.png'; ?>" width="101" height="40" alt="Facebook Like" />
529
  </li>
530
  <li id="a2a_wp_twitter_tweet" class="addtoany_special_service addtoany_3p_button" title="Twitter Tweet button">
531
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/twitter_tweet_2x.png'; ?>" width="122" height="40" alt="Twitter Tweet" />
532
  </li>
533
  <li id="a2a_wp_pinterest_pin" class="addtoany_special_service addtoany_3p_button" title="Pinterest Pin It button">
534
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/pinterest_pin_2x.png'; ?>" width="80" height="40" alt="Pinterest Pin It" />
535
  </li>
536
  </ul>
537
  <div id="addtoany_services_tip">
538
  <p style="line-height:0">
539
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/instagram.svg" width="24" height="24" style="margin-right:8px">
540
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/youtube.svg" width="24" height="24" style="margin-right:8px">
541
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/snapchat.svg" width="24" height="24">
542
  </p>
543
  <p>You can setup Instagram, YouTube, Snapchat, and other buttons in an AddToAny Follow widget.</p><p>Add the &quot;AddToAny Follow&quot; widget in <a href="customize.php?autofocus[panel]=widgets&amp;return=options-general.php%3Fpage%3Daddtoany">Customize</a> or <a href="widgets.php">Widgets</a>.</p>
544
  </div>
551
  <div class="addtoany_extra_element addtoany_icon_size_large">
552
  <label class="addtoany_override a2a_kit_size_32">
553
  <input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
554
+ <img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/a2a.svg'; ?>" width="32" height="32" alt="AddToAny" onclick="this.parentNode.firstChild.checked=true" />
555
  </label>
556
  <br>
557
  </div>
1090
  jQuery(this).remove();
1091
  });
1092
 
 
1093
  if( jQuery('#addtoany_services_sortable li').not('.dummy').length==1 )
1094
  jQuery('#addtoany_services_sortable').find('.dummy').show();
1095
 
1107
  $admin_services_saved = isset( $_POST['A2A_SHARE_SAVE_active_services'] ) && isset( $_POST['Submit'] );
1108
 
1109
  if ( $admin_services_saved ) {
1110
+ $active_services = isset( $_POST['A2A_SHARE_SAVE_active_services'] ) ? (array) $_POST['A2A_SHARE_SAVE_active_services'] : array();
1111
  } elseif ( ! $admin_services_saved && isset( $options['active_services'] ) ) {
1112
  $active_services = $options['active_services'];
1113
  } else {
1118
  $active_services_last = end($active_services);
1119
  if($admin_services_saved)
1120
  $active_services_last = substr($active_services_last, 7); // Remove a2a_wp_
1121
+ $active_services_quoted_escaped = '';
1122
  $counters_enabled_js = '';
1123
  foreach ($active_services as $service) {
1124
  if ( $admin_services_saved )
1125
  $service = substr( $service, 7 ); // Remove a2a_wp_
1126
+ $active_services_quoted_escaped .= json_encode( $service );
1127
  if ( $service != $active_services_last )
1128
+ $active_services_quoted_escaped .= ',';
1129
 
1130
  // AddToAny counter enabled?
1131
  if ( in_array( $service, array( 'pinterest', 'reddit', 'tumblr', ) ) ) {
1140
  }
1141
  }
1142
  ?>
1143
+ var services = [<?php echo $active_services_quoted_escaped; ?>],
1144
  service_options = {};
1145
 
1146
  <?php
1330
 
1331
  // If current screen is the default tab and WordPress >= 4.9
1332
  if ( empty( $_GET['action'] ) && function_exists( 'wp_enqueue_code_editor' ) ) {
1333
+ $readOnly_value = current_user_can( 'unfiltered_html' ) ? false : 'nocursor';
1334
 
1335
  // Additional JavaScript editor.
1336
  // Enqueue code editor and settings for manipulating JavaScript.
1344
  ),
1345
  'codemirror' => array(
1346
  'lineNumbers' => false,
1347
+ 'readOnly' => $readOnly_value,
1348
  ),
1349
  ) );
1350
 
1364
  'type' => 'text/css',
1365
  'codemirror' => array(
1366
  'lineNumbers' => false,
1367
+ 'readOnly' => $readOnly_value,
1368
  ),
1369
  ) );
1370
 
addtoany.compat.php CHANGED
@@ -82,7 +82,7 @@ function addtoany_woocommerce_share() {
82
  } else {
83
  // If a Sharing Header is set.
84
  if ( ! empty( $options['header'] ) ) {
85
- echo '<div class="addtoany_header">' . stripslashes( $options['header'] ) . '</div>';
86
  } else {
87
  $html_header = '';
88
  }
82
  } else {
83
  // If a Sharing Header is set.
84
  if ( ! empty( $options['header'] ) ) {
85
+ echo wp_kses_post( '<div class="addtoany_header">' . stripslashes( $options['header'] ) . '</div>' );
86
  } else {
87
  $html_header = '';
88
  }
addtoany.services.php CHANGED
@@ -10,7 +10,7 @@ $A2A_SHARE_SAVE_services = array(
10
  "twitter" => array(
11
  "name" => "Twitter",
12
  "icon" => "twitter",
13
- "color" => "55ACEE",
14
  ),
15
  "pinterest" => array(
16
  "name" => "Pinterest",
@@ -257,11 +257,6 @@ $A2A_SHARE_SAVE_services = array(
257
  "icon" => "mewe",
258
  "color" => "007DA1",
259
  ),
260
- "mix" => array(
261
- "name" => "Mix",
262
- "icon" => "mix",
263
- "color" => "ff8226",
264
- ),
265
  "mixi" => array(
266
  "name" => "Mixi",
267
  "icon" => "mixi",
10
  "twitter" => array(
11
  "name" => "Twitter",
12
  "icon" => "twitter",
13
+ "color" => "1D9BF0",
14
  ),
15
  "pinterest" => array(
16
  "name" => "Pinterest",
257
  "icon" => "mewe",
258
  "color" => "007DA1",
259
  ),
 
 
 
 
 
260
  "mixi" => array(
261
  "name" => "Mixi",
262
  "icon" => "mixi",
addtoany.widgets.php CHANGED
@@ -224,7 +224,7 @@ class A2A_Follow_Widget extends WP_Widget {
224
  <label for="<?php echo $this->get_field_id( $code_id ); ?>"><?php echo $label_text; ?></label>
225
  <input class="widefat" id="<?php echo $this->get_field_id( $code_id ); ?>" name="<?php echo $this->get_field_name( $code_id ); ?>" type="text" value="<?php esc_attr_e( $id_value ); ?>">
226
  <br>
227
- <small><?php echo str_replace( '${id}', '<u>ID</u>', $service['href'] ); ?></small>
228
  </p>
229
  <?php endforeach; ?>
230
  <p>
224
  <label for="<?php echo $this->get_field_id( $code_id ); ?>"><?php echo $label_text; ?></label>
225
  <input class="widefat" id="<?php echo $this->get_field_id( $code_id ); ?>" name="<?php echo $this->get_field_name( $code_id ); ?>" type="text" value="<?php esc_attr_e( $id_value ); ?>">
226
  <br>
227
+ <small><?php echo wp_kses_post( str_replace( '${id}', '<u>ID</u>', $service['href'] ) ); ?></small>
228
  </p>
229
  <?php endforeach; ?>
230
  <p>
icons/mix.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="#FFF"><path opacity=".8" d="M27.87 4.125c-5.224 0-9.467 4.159-9.467 9.291v2.89c0-1.306 1.074-2.362 2.399-2.362s2.399 1.056 2.399 2.362v1.204c0 1.306 1.074 2.362 2.399 2.362s2.399-1.056 2.399-2.362V4.134c-.036-.009-.082-.009-.129-.009"/><path d="M4 4.125v12.94c2.566 0 4.668-1.973 4.807-4.465v-2.214c0-.065 0-.12.009-.176.093-1.213 1.13-2.177 2.39-2.177 1.325 0 2.399 1.056 2.399 2.362v9.226c0 1.306 1.074 2.353 2.399 2.353s2.399-1.056 2.399-2.353v-6.206c0-5.132 4.233-9.291 9.467-9.291H4z"/><path opacity=".8" d="M4 17.074v8.438c0 1.306 1.074 2.362 2.399 2.362s2.399-1.056 2.399-2.362V12.61C8.659 15.102 6.566 17.074 4 17.074"/></g></svg>