AddToAny Share Buttons - Version 1.7.33

Version Description

  • New translatable strings for the optional post-share modal
    • "Thanks for sharing!"
    • "Thanks for following!"
    • You can configure the new post-share "Thanks for sharing!" modal and ad unit, rolling out soon for WordPress sites. By default, the modal only displays on pages that have an existing ad tag. You can enable and disable the modal and the ad, or add your own ad unit to be rotated along with AddToAny's
  • Move the "Show sharing buttons" meta box to the side of the WordPress editor
  • Fix issue where an extra floating vertical bar could appear when Placement is set to "Attach to content"
  • Add some supplementary escaping
Download this release

Release Info

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

Code changes from version 1.7.32 to 1.7.33

Files changed (3) hide show
  1. README.txt +15 -3
  2. add-to-any.php +16 -12
  3. addtoany.admin.php +28 -6
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.0
6
  Requires PHP: 5.2
7
- Stable tag: 1.7.32
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
10
 
@@ -263,13 +263,13 @@ To align center:
263
 
264
  = How can I remove the button(s) from individual posts and pages? =
265
 
266
- When editing a post or page, uncheck "Show sharing buttons", which is located at the bottom of the editor page. Be sure to update or publish to save your changes.
267
 
268
  An older method was to insert the following tag into the page or post (HTML tab) that you do not want the button(s) to appear in: `<!--nosharesave-->`
269
 
270
  = How can I force the button(s) to appear in individual posts and pages? =
271
 
272
- When editing a post or page, check the "Show sharing buttons" checkbox, which is located at the bottom of the editor page. Be sure to update or publish to save your changes. Note that, by default, AddToAny is setup to display on all posts and pages.
273
 
274
  An older method was to insert the following tag into the page or post (HTML tab) that you want the button(s) to appear in: `<!--sharesave-->`
275
 
@@ -350,6 +350,15 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
350
 
351
  == Changelog ==
352
 
 
 
 
 
 
 
 
 
 
353
  = 1.7.32 =
354
  * Fix the option to hide a floating bar when scrolled to a footer region
355
  * Fix placeholders and add a description for translating a string in admin (thanks Andreas)
@@ -998,6 +1007,9 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
998
 
999
  == Upgrade Notice ==
1000
 
 
 
 
1001
  = 1.7.31 =
1002
  Using the Facebook Like button? You can enable its counter by clicking the down arrow below the Facebook Like button in AddToAny settings. For accurate counts when you enable [AddToAny Share Count Recovery](https://www.addtoany.com/blog/fix-share-counts-after-https-domain-url-change/), switch to AddToAny's standard Facebook share button instead of the Like button, because the Facebook Like button does not offer a way for previous counts to be recovered.
1003
 
4
  Requires at least: 3.7
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
+ Stable tag: 1.7.33
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
10
 
263
 
264
  = How can I remove the button(s) from individual posts and pages? =
265
 
266
+ When editing a post or page, uncheck "Show sharing buttons", which is located next to the WordPress editor. Be sure to update or publish to save your changes.
267
 
268
  An older method was to insert the following tag into the page or post (HTML tab) that you do not want the button(s) to appear in: `<!--nosharesave-->`
269
 
270
  = How can I force the button(s) to appear in individual posts and pages? =
271
 
272
+ When editing a post or page, check the "Show sharing buttons" checkbox, which is located next to the WordPress editor. Be sure to update or publish to save your changes. Note that, by default, AddToAny is setup to display on all posts and pages.
273
 
274
  An older method was to insert the following tag into the page or post (HTML tab) that you want the button(s) to appear in: `<!--sharesave-->`
275
 
350
 
351
  == Changelog ==
352
 
353
+ = 1.7.33 =
354
+ * New translatable strings for the optional [post-share modal](https://www.addtoany.com/buttons/customize/wordpress/thanks)
355
+ * "Thanks for sharing!"
356
+ * "Thanks for following!"
357
+ * You can [configure](https://www.addtoany.com/buttons/customize/wordpress/thanks) the new post-share "Thanks for sharing!" modal and ad unit, rolling out soon for WordPress sites. By default, the modal only displays on pages that have an existing ad tag. You can [enable](https://www.addtoany.com/buttons/customize/wordpress/thanks#enable) and [disable](https://www.addtoany.com/buttons/customize/wordpress/thanks#disable) the modal and the ad, or [add](https://www.addtoany.com/buttons/customize/wordpress/thanks#add-ad) your own ad unit to be rotated along with AddToAny's
358
+ * Move the "Show sharing buttons" meta box to the side of the WordPress editor
359
+ * Fix issue where an extra floating vertical bar could appear when Placement is set to "Attach to content"
360
+ * Add some supplementary escaping
361
+
362
  = 1.7.32 =
363
  * Fix the option to hide a floating bar when scrolled to a footer region
364
  * Fix placeholders and add a description for translating a string in admin (thanks Andreas)
1007
 
1008
  == Upgrade Notice ==
1009
 
1010
+ = 1.7.33 =
1011
+ [Configure](https://www.addtoany.com/buttons/customize/wordpress/thanks) the new post-share "Thanks for sharing!" modal and ad unit, rolling out soon for WordPress sites. By default, the modal only displays on pages that have an existing ad tag. You can [enable](https://www.addtoany.com/buttons/customize/wordpress/thanks#enable) and [disable](https://www.addtoany.com/buttons/customize/wordpress/thanks#disable) the modal and the ad, or [add](https://www.addtoany.com/buttons/customize/wordpress/thanks#add-ad) your own ad unit to be rotated along with AddToAny's.
1012
+
1013
  = 1.7.31 =
1014
  Using the Facebook Like button? You can enable its counter by clicking the down arrow below the Facebook Like button in AddToAny settings. For accurate counts when you enable [AddToAny Share Count Recovery](https://www.addtoany.com/blog/fix-share-counts-after-https-domain-url-change/), switch to AddToAny's standard Facebook share button instead of the Like button, because the Facebook Like button does not offer a way for previous counts to be recovered.
1015
 
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, Google+, Pinterest, WhatsApp and many more.
6
- Version: 1.7.32
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -272,7 +272,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
272
  $link = ADDTOANY_SHARE_SAVE_SPECIAL( $active_service, $special_args );
273
  } else {
274
  $service = $services[ $active_service ];
275
- $safe_name = $active_service;
276
  $name = $service['name'];
277
 
278
  // If Follow kit and HREF specified
@@ -288,7 +288,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
288
  // Replace the ID placeholder in the URL template
289
  $href = str_replace( '${id}', $follow_id, $service['href'] );
290
  }
291
- $href = ( 'feed' == $safe_name ) ? $follow_id : $href;
292
 
293
  // If icon_url is set, presume custom service
294
  if ( isset( $service['icon_url'] ) ) {
@@ -321,17 +321,17 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
321
  $icon = isset( $service['icon'] ) ? $service['icon'] : 'default'; // Just the icon filename
322
  $icon_url = isset( $service['icon_url'] ) ? $service['icon_url'] : false;
323
  $icon_url = $is_amp && ! $icon_url ? 'https://static.addtoany.com/buttons/' . $icon . '.svg' : $icon_url;
324
- $width_attr = isset( $service['icon_width'] ) ? ' width="' . $service['icon_width'] . '"' : ' width="16"';
325
- $width_attr = $is_amp && ! empty( $args['icon_size'] ) ? ' width="' . $args['icon_size'] . '"' : $width_attr;
326
- $height_attr = isset( $service['icon_height'] ) ? ' height="' . $service['icon_height'] . '"' : ' height="16"';
327
- $height_attr = $is_amp && ! empty( $args['icon_size'] ) ? ' height="' . $args['icon_size'] . '"' : $height_attr;
328
 
329
- $amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . $safe_name . ' img{background-color:#' . $service['color'] . ';}' : '';
330
 
331
- $url = isset( $href ) ? $href : 'https://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $args['linkurl_enc'] .'&amp;linkname=' . $args['linkname_enc'];
332
  $src = $icon_url ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
333
  $counter = $counter_enabled ? ' a2a_counter' : '';
334
- $class_attr = $custom_service ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
335
  $href_attr = $args['basic_html'] && ! isset( $href ) ? '' : ' href="' . esc_attr( $url ) . '"';
336
  $title_attr = $args['basic_html'] ? '' : ' title="' . esc_attr( $name ) . '"';
337
 
@@ -552,7 +552,9 @@ if ( ! function_exists( 'A2A_menu_locale' ) ) {
552
  AddToYourFavorites: "' . __( "Add to your favorites", 'add-to-any' ) . '",
553
  SendFromWebOrProgram: "' . __( "Send from any email address or email program", 'add-to-any' ) . '",
554
  EmailProgram: "' . __( "Email program", 'add-to-any' ) . '",
555
- More: "' . __( "More&#8230;", 'add-to-any' ) . '"
 
 
556
  };
557
  ';
558
  return $A2A_locale;
@@ -607,7 +609,9 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
607
  $floating_html = '';
608
 
609
  // Overridable by args below
610
- $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
 
 
611
  $horizontal_type = ( isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ) ? $options['floating_horizontal'] : false;
612
 
613
  if ( is_singular() ) {
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, Google+, Pinterest, WhatsApp and many more.
6
+ Version: 1.7.33
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
272
  $link = ADDTOANY_SHARE_SAVE_SPECIAL( $active_service, $special_args );
273
  } else {
274
  $service = $services[ $active_service ];
275
+ $code_name = $active_service;
276
  $name = $service['name'];
277
 
278
  // If Follow kit and HREF specified
288
  // Replace the ID placeholder in the URL template
289
  $href = str_replace( '${id}', $follow_id, $service['href'] );
290
  }
291
+ $href = ( 'feed' == $code_name ) ? $follow_id : $href;
292
 
293
  // If icon_url is set, presume custom service
294
  if ( isset( $service['icon_url'] ) ) {
321
  $icon = isset( $service['icon'] ) ? $service['icon'] : 'default'; // Just the icon filename
322
  $icon_url = isset( $service['icon_url'] ) ? $service['icon_url'] : false;
323
  $icon_url = $is_amp && ! $icon_url ? 'https://static.addtoany.com/buttons/' . $icon . '.svg' : $icon_url;
324
+ $width_attr = isset( $service['icon_width'] ) ? ' width="' . esc_attr( $service['icon_width'] ) . '"' : ' width="16"';
325
+ $width_attr = $is_amp && ! empty( $args['icon_size'] ) ? ' width="' . esc_attr( $args['icon_size'] ) . '"' : $width_attr;
326
+ $height_attr = isset( $service['icon_height'] ) ? ' height="' . esc_attr( $service['icon_height'] ) . '"' : ' height="16"';
327
+ $height_attr = $is_amp && ! empty( $args['icon_size'] ) ? ' height="' . esc_attr( $args['icon_size'] ) . '"' : $height_attr;
328
 
329
+ $amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . esc_attr( $code_name ) . ' img{background-color:#' . $service['color'] . ';}' : '';
330
 
331
+ $url = isset( $href ) ? $href : 'https://www.addtoany.com/add_to/' . $code_name . '?linkurl=' . $args['linkurl_enc'] .'&amp;linkname=' . $args['linkname_enc'];
332
  $src = $icon_url ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
333
  $counter = $counter_enabled ? ' a2a_counter' : '';
334
+ $class_attr = $custom_service ? '' : ' class="a2a_button_' . esc_attr( $code_name ) . $counter . '"';
335
  $href_attr = $args['basic_html'] && ! isset( $href ) ? '' : ' href="' . esc_attr( $url ) . '"';
336
  $title_attr = $args['basic_html'] ? '' : ' title="' . esc_attr( $name ) . '"';
337
 
552
  AddToYourFavorites: "' . __( "Add to your favorites", 'add-to-any' ) . '",
553
  SendFromWebOrProgram: "' . __( "Send from any email address or email program", 'add-to-any' ) . '",
554
  EmailProgram: "' . __( "Email program", 'add-to-any' ) . '",
555
+ More: "' . __( "More&#8230;", 'add-to-any' ) . '",
556
+ ThanksForSharing: "' . __( "Thanks for sharing!", 'add-to-any' ) . '",
557
+ ThanksForFollowing: "' . __( "Thanks for following!", 'add-to-any' ) . '"
558
  };
559
  ';
560
  return $A2A_locale;
609
  $floating_html = '';
610
 
611
  // Overridable by args below
612
+ $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical']
613
+ && ! in_array( $options['floating_vertical'], array( 'left_attached', 'right_attached' ) )
614
+ ) ? $options['floating_vertical'] : false;
615
  $horizontal_type = ( isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ) ? $options['floating_horizontal'] : false;
616
 
617
  if ( is_singular() ) {
addtoany.admin.php CHANGED
@@ -23,7 +23,7 @@ function A2A_SHARE_SAVE_add_meta_box() {
23
  ! isset( $options['display_in_cpt_' . $post_type] ) || $options['display_in_cpt_' . $post_type] != '-1'
24
  ) {
25
  // Add meta box
26
- add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'advanced', 'high' );
27
  }
28
  }
29
  }
@@ -499,8 +499,8 @@ function A2A_SHARE_SAVE_options_page() {
499
  $special_service = ( in_array( $service_safe_name, array( 'facebook', 'pinterest', 'reddit' ) ) )
500
  ? ' class="addtoany_special_service"' : '';
501
  ?>
502
- <li data-addtoany-icon-name="<?php echo $site['icon']; ?>"<?php echo $special_service; ?> id="a2a_wp_<?php echo $service_safe_name; ?>" title="<?php echo $site['name']; ?>">
503
- <img src="<?php echo (isset($site['icon_url'])) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url.'/icons/'.$site['icon'].'.svg'; ?>" width="<?php echo (isset($site['icon_width'])) ? $site['icon_width'] : '24'; ?>" height="<?php echo (isset($site['icon_height'])) ? $site['icon_height'] : '24'; ?>"<?php if ( isset( $site['color'] ) ) : ?> style="background-color:#<?php echo $site['color']; endif; ?>"><?php echo $site['name']; ?>
504
  </li>
505
  <?php
506
  } ?>
@@ -953,6 +953,23 @@ function A2A_SHARE_SAVE_admin_head() {
953
 
954
  jQuery('.A2A_SHARE_SAVE_position').html($this.find('option:selected').html());
955
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
 
957
  var to_input = function(this_sortable){
958
  // Clear any previous hidden inputs for storing chosen services
@@ -965,7 +982,7 @@ function A2A_SHARE_SAVE_admin_head() {
965
 
966
  for (var i=0, service_name, show_count_value, fb_verb_value; i < services_size; i++) {
967
  if(services_array[i]!='') { // Exclude dummy icon
968
- jQuery('#addtoany_admin_form').append('<input class="addtoany_hidden_options" name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+services_array[i]+'"/>');
969
 
970
  // Special service options?
971
  service_name = services_array[i].substr(7);
@@ -1138,8 +1155,13 @@ function A2A_SHARE_SAVE_admin_head() {
1138
  }
1139
  ?>
1140
 
1141
- jQuery.each(services, function(i, val){
1142
- jQuery('#a2a_wp_'+val).click();
 
 
 
 
 
1143
  });
1144
 
1145
  // Add/Remove Services button
23
  ! isset( $options['display_in_cpt_' . $post_type] ) || $options['display_in_cpt_' . $post_type] != '-1'
24
  ) {
25
  // Add meta box
26
+ add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'side', 'default' );
27
  }
28
  }
29
  }
499
  $special_service = ( in_array( $service_safe_name, array( 'facebook', 'pinterest', 'reddit' ) ) )
500
  ? ' class="addtoany_special_service"' : '';
501
  ?>
502
+ <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'] ); ?>">
503
+ <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'] ); ?>
504
  </li>
505
  <?php
506
  } ?>
953
 
954
  jQuery('.A2A_SHARE_SAVE_position').html($this.find('option:selected').html());
955
  });
956
+
957
+ var entityMap = {
958
+ '&': '&amp;',
959
+ '<': '&lt;',
960
+ '>': '&gt;',
961
+ '"': '&quot;',
962
+ "'": '&#39;',
963
+ '/': '&#x2F;',
964
+ '`': '&#x60;',
965
+ '=': '&#x3D;'
966
+ };
967
+
968
+ function escapeHtml (string) {
969
+ return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) {
970
+ return entityMap[s];
971
+ });
972
+ }
973
 
974
  var to_input = function(this_sortable){
975
  // Clear any previous hidden inputs for storing chosen services
982
 
983
  for (var i=0, service_name, show_count_value, fb_verb_value; i < services_size; i++) {
984
  if(services_array[i]!='') { // Exclude dummy icon
985
+ jQuery('#addtoany_admin_form').append('<input class="addtoany_hidden_options" name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+escapeHtml(services_array[i])+'"/>');
986
 
987
  // Special service options?
988
  service_name = services_array[i].substr(7);
1155
  }
1156
  ?>
1157
 
1158
+ jQuery.each(services, function(i, val) {
1159
+ try {
1160
+ jQuery('#a2a_wp_'+escapeHtml(val)).click();
1161
+ } catch(e) {
1162
+ if (console && console.warn)
1163
+ console.warn('Invalid CSS selector: ' + val);
1164
+ }
1165
  });
1166
 
1167
  // Add/Remove Services button