AddToAny Share Buttons - Version 1.6.7

Version Description

  • New Additional CSS box for AddToAny CSS customizations
  • Rename Additional Options box to Additional JavaScript box
  • Fix quotes and other special characters in shared titles
  • Simplify sections in settings
  • Update universal button to canonical endpoint
  • Use SSL for local cache updates
  • Support must-use plugin usage via a proxy PHP loader so add-to-any.php can remain in the add-to-any directory
  • Remove support for old method of moving add-to-any.php into mu-plugins for auto-loading
Download this release

Release Info

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

Code changes from version 1.6.6 to 1.6.7

Files changed (3) hide show
  1. README.txt +25 -13
  2. add-to-any.php +25 -35
  3. addtoany.admin.php +53 -14
README.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: micropat, addtoany
3
  Tags: AddToAny, sharing, share, social, share button, share buttons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
4
  Requires at least: 2.8
5
- Tested up to: 4.3
6
- Stable tag: 1.6.6
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
@@ -72,8 +72,8 @@ This plugin always strives to be the best WordPress plugin for sharing. Developm
72
 
73
  See also:
74
 
75
- * The standard <a href="https://www.addtoany.com/buttons/for/website">Share button</a> code
76
- * The <a href="/plugins/add-to-any-subscribe/" title="WordPress RSS Subscribe plugin">Subscribe button</a> plugin
77
 
78
  <a href="https://www.addtoany.com/blog/">AddToAny Blog</a> | <a href="https://www.addtoany.com/privacy">Privacy Policy</a>
79
 
@@ -99,11 +99,11 @@ In your Admin panel, go to `Settings` > `AddToAny`. Among other options, you can
99
 
100
  To place the buttons as a "widget" in your theme (if your theme supports WordPress Widgets), go to `Appearance` > `Widgets`, then drag AddToAny to an available Widget Area and click `Save`.
101
 
102
- To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one or more lines of JavaScript code into "Additional Options" box. The Additional Options box is in `Settings` > `AddToAny`.
103
 
104
  = Something is wrong. What should I try first? =
105
 
106
- Try temporarily switching themes and deactivating other plugins to identify a potential conflict. If you find a conflict, try contacting that theme or plugin author. If an issue persists on a default theme with all other plugins deactivatd, perform a google search across the WordPress forums using a query such as: <a href="https://www.google.com/#q=site:wordpress.org%2Fsupport+-reviews+addtoany+">site:wordpress.org/support -reviews addtoany [your issue issue here]</a>
107
 
108
  Feel free to <a href="https://wordpress.org/support/plugin/add-to-any">post here</a>, where the community can hopefully help you. Describe the issue, what troubleshooting you have already done, provide a link to your site, and any other potentially relevant information.
109
 
@@ -190,7 +190,7 @@ You can create a plugin or customize the following example PHP code to add to yo
190
  add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );`
191
 
192
  = How can I align the sharing button(s) to the center or to the right side of posts? =
193
- It depends on your theme, but you can try adding the following CSS code to your main stylesheet.
194
 
195
  To align right:
196
  `.addtoany_share_save_container { text-align:right; }`
@@ -246,14 +246,12 @@ In settings, disable the default placement of the Vertical Buttons. In your them
246
  ) );
247
  } ?>`
248
 
249
- = Why does the Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button, or Google +1 Button have so much whitespace to the right of it? =
250
 
251
  The minimum width for the Facebook Like Button is 90 pixels. This is required to display the total number of Likes to the right of the button. See Facebook's <a href="https://developers.facebook.com/docs/plugins/like-button">Like Button documentation</a> for details
252
 
253
  It's not recommended, but you can change the width of the Facebook Like Button using CSS code, for instance: `.a2a_button_facebook_like { width:50px !important; }`
254
 
255
- The Twitter Tweet Button with 'show count' enabled is 130 pixels. You can change the width using CSS code, for instance: `.a2a_button_twitter_tweet { width:100px !important; }`
256
-
257
  The Pinterest Pin It Button with 'show count' enabled is 76 pixels. You can change the width using CSS code, for instance: `.a2a_button_pinterest_pin { width:90px !important; }`
258
 
259
  The Google +1 Button with 'show count' enabled is 90 pixels. You can change the width using CSS code, for instance: `.a2a_button_google_plusone { width:65px !important; }`
@@ -277,15 +275,16 @@ A few prerequisites:
277
 
278
  * The request has an `HTTP_X_REQUESTED_WITH` header set to `xmlhttprequest`
279
  * `jQuery` available
280
- * AddToAny script blocks in the response need to execute, so don't use jQuery's `load` method *with a selector expression*. Selector expression usage with that method will cause script blocks in the response <a href="https://api.jquery.com/load/#script-execution">to be stripped out</a>
281
 
282
  = Why does the menu appear behind embedded objects (like Flash)? =
283
 
284
  Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/wordpress/hide_embeds">hide intersecting embedded objects</a>.
285
 
286
- = For a WordPress Multisite Network (MS), how can I set the plugin as a "Must-Use" plugin to automatically execute for all blogs? =
287
 
288
- Upload the plugin directory (including all files and directories within) to the `/wp-content/mu-plugins/` folder, then move the `add-to-any.php` file from the plugin directory to the mu-plugins folder so that it can auto-execute.
 
289
 
290
  == Screenshots ==
291
 
@@ -298,6 +297,16 @@ Upload the plugin directory (including all files and directories within) to the
298
 
299
  == Changelog ==
300
 
 
 
 
 
 
 
 
 
 
 
301
  = 1.6.6 =
302
  * Harden local caching option (thanks pineappleclock)
303
  * Remove old warning message when template tags seem to be missing (thanks Tenebral, and theme authors everywhere)
@@ -1337,6 +1346,9 @@ Upload the plugin directory (including all files and directories within) to the
1337
 
1338
  == Upgrade Notice ==
1339
 
 
 
 
1340
  = 1.6.3 =
1341
  If you configured a Google+ follow button through an AddToAny Follow widget, the automatic `+` in your URL has been removed to permit default Google+ URLs which do not have a `+` preceding the ID number. Be sure to add the `+` back if you have a Google+ custom URL.
1342
 
2
  Contributors: micropat, addtoany
3
  Tags: AddToAny, sharing, share, social, share button, share buttons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
4
  Requires at least: 2.8
5
+ Tested up to: 4.4
6
+ Stable tag: 1.6.7
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
72
 
73
  See also:
74
 
75
+ * The standard <a href="https://www.addtoany.com/buttons/for/website">share buttons</a> code
76
+ * The universal <a href="https://www.addtoany.com/buttons/for/wordpress_com">share button for WordPress.com</a>
77
 
78
  <a href="https://www.addtoany.com/blog/">AddToAny Blog</a> | <a href="https://www.addtoany.com/privacy">Privacy Policy</a>
79
 
99
 
100
  To place the buttons as a "widget" in your theme (if your theme supports WordPress Widgets), go to `Appearance` > `Widgets`, then drag AddToAny to an available Widget Area and click `Save`.
101
 
102
+ To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one or more lines of JavaScript code into "Additional JavaScript" box. The Additional JavaScript box is in `Settings` > `AddToAny`.
103
 
104
  = Something is wrong. What should I try first? =
105
 
106
+ Try temporarily switching themes and deactivating other plugins to identify a potential conflict. If you find a conflict, try contacting that theme or plugin author. If an issue persists on a default theme with all other plugins deactivated, perform a google search across the WordPress forums using a query such as: <a href="https://www.google.com/#q=site:wordpress.org%2Fsupport+-reviews+addtoany+">site:wordpress.org/support -reviews addtoany [your issue issue here]</a>
107
 
108
  Feel free to <a href="https://wordpress.org/support/plugin/add-to-any">post here</a>, where the community can hopefully help you. Describe the issue, what troubleshooting you have already done, provide a link to your site, and any other potentially relevant information.
109
 
190
  add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );`
191
 
192
  = How can I align the sharing button(s) to the center or to the right side of posts? =
193
+ It depends on your theme, but you can try adding the following CSS code to your Additional CSS box in Settings > AddToAny.
194
 
195
  To align right:
196
  `.addtoany_share_save_container { text-align:right; }`
246
  ) );
247
  } ?>`
248
 
249
+ = Why does the Facebook Like Button, Pinterest Pin It Button, Google+ Share Button, or Google +1 Button have so much whitespace to the right of it? =
250
 
251
  The minimum width for the Facebook Like Button is 90 pixels. This is required to display the total number of Likes to the right of the button. See Facebook's <a href="https://developers.facebook.com/docs/plugins/like-button">Like Button documentation</a> for details
252
 
253
  It's not recommended, but you can change the width of the Facebook Like Button using CSS code, for instance: `.a2a_button_facebook_like { width:50px !important; }`
254
 
 
 
255
  The Pinterest Pin It Button with 'show count' enabled is 76 pixels. You can change the width using CSS code, for instance: `.a2a_button_pinterest_pin { width:90px !important; }`
256
 
257
  The Google +1 Button with 'show count' enabled is 90 pixels. You can change the width using CSS code, for instance: `.a2a_button_google_plusone { width:65px !important; }`
275
 
276
  * The request has an `HTTP_X_REQUESTED_WITH` header set to `xmlhttprequest`
277
  * `jQuery` available
278
+ * AddToAny `<script>` blocks in the response need to execute, so don't use jQuery's `load` method *with a selector expression*. Selector expression usage with that method will cause `<script>` blocks in the response <a href="https://api.jquery.com/load/#script-execution">to be stripped out</a>
279
 
280
  = Why does the menu appear behind embedded objects (like Flash)? =
281
 
282
  Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/wordpress/hide_embeds">hide intersecting embedded objects</a>.
283
 
284
+ = How can I set the plugin as a "Must-Use" plugin that is autoloaded and activated for all sites? =
285
 
286
+ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plugins/` directory. Then create a proxy PHP loader file (such as `load.php`) in your `mu-plugins` directory, for example:
287
+ `<?php require WPMU_PLUGIN_DIR . '/add-to-any/add-to-any.php';`
288
 
289
  == Screenshots ==
290
 
297
 
298
  == Changelog ==
299
 
300
+ = 1.6.7 =
301
+ * New Additional CSS box for AddToAny CSS customizations
302
+ * Rename Additional Options box to Additional JavaScript box
303
+ * Fix quotes and other special characters in shared titles
304
+ * Simplify sections in settings
305
+ * Update universal button to canonical endpoint
306
+ * Use SSL for local cache updates
307
+ * Support must-use plugin usage via a proxy PHP loader so `add-to-any.php` can remain in the `add-to-any` directory
308
+ * Remove support for old method of moving `add-to-any.php` into `mu-plugins` for auto-loading
309
+
310
  = 1.6.6 =
311
  * Harden local caching option (thanks pineappleclock)
312
  * Remove old warning message when template tags seem to be missing (thanks Tenebral, and theme authors everywhere)
1346
 
1347
  == Upgrade Notice ==
1348
 
1349
+ = 1.6.7 =
1350
+ If you are using AddToAny as a "must-use" autoloaded plugin (in the `mu-plugins` directory), the old method of moving `add-to-any.php` into `mu-plugins` is no longer supported and will not work. See the plugin's last FAQ about using a proxy PHP loader file that autoloads AddToAny.
1351
+
1352
  = 1.6.3 =
1353
  If you configured a Google+ follow button through an AddToAny Follow widget, the automatic `+` in your URL has been removed to permit default Google+ URLs which do not have a `+` preceding the ID number. Be sure to add the `+` back if you have a Google+ custom URL.
1354
 
add-to-any.php CHANGED
@@ -3,37 +3,22 @@
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.6.6
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
10
  Domain Path: /languages
11
  */
12
-
13
- if ( ! isset( $A2A_locale ) ) {
14
- $A2A_locale = '';
15
- }
16
 
17
  $A2A_SHARE_SAVE_plugin_basename = plugin_basename( dirname( __FILE__ ) );
 
 
18
 
19
- // WordPress Must-Use?
20
- if ( basename( dirname( __FILE__ ) ) == 'mu-plugins' ) {
21
- // __FILE__ expected in /wp-content/mu-plugins (parent directory for auto-execution)
22
- // /wp-content/mu-plugins/add-to-any
23
- $A2A_SHARE_SAVE_plugin_url_path = WPMU_PLUGIN_URL . '/add-to-any';
24
- $A2A_SHARE_SAVE_plugin_dir = WPMU_PLUGIN_DIR . '/add-to-any';
25
- }
26
- else {
27
- // /wp-content/plugins/add-to-any
28
- $A2A_SHARE_SAVE_plugin_url_path = WP_PLUGIN_URL . '/' . $A2A_SHARE_SAVE_plugin_basename;
29
- $A2A_SHARE_SAVE_plugin_dir = WP_PLUGIN_DIR . '/' . $A2A_SHARE_SAVE_plugin_basename;
30
- }
31
-
32
- // Fix SSL
33
- if ( is_ssl() ) {
34
- $A2A_SHARE_SAVE_plugin_url_path = str_replace( 'http:', 'https:', $A2A_SHARE_SAVE_plugin_url_path );
35
- }
36
-
37
  $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' );
38
 
39
  function A2A_SHARE_SAVE_init() {
@@ -62,14 +47,14 @@ function A2A_SHARE_SAVE_link_vars( $linkname = false, $linkurl = false ) {
62
  // Set linkname
63
  if ( ! $linkname ) {
64
  if ( isset( $post ) ) {
65
- $linkname = strip_tags( get_the_title( $post->ID ) );
66
  }
67
  else {
68
  $linkname = '';
69
  }
70
  }
71
 
72
- $linkname_enc = rawurlencode( html_entity_decode( $linkname, ENT_QUOTES, 'UTF-8' ) );
73
 
74
  // Set linkurl
75
  if ( ! $linkurl ) {
@@ -429,7 +414,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
429
  $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share"/>';
430
  }
431
 
432
- $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . ' addtoany_share_save" href="https://www.addtoany.com/share_save' .$button_href_querystring . '"' . $button_id
433
  . $style . $button_target
434
  . '>' . $button . '</a>';
435
 
@@ -975,7 +960,7 @@ function A2A_SHARE_SAVE_stylesheet() {
975
  // wp_add_inline_style requires WP 3.3+
976
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
977
 
978
- // Prepare inline CSS for media queries on floating bars
979
  $inline_css = '';
980
 
981
  $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
@@ -1012,11 +997,8 @@ function A2A_SHARE_SAVE_stylesheet() {
1012
  is_numeric( $options['floating_horizontal_responsive_min_width'] )
1013
  ) ? $options['floating_horizontal_responsive_min_width'] : '981';
1014
 
1015
- // If there is inline CSS already
1016
- if ( 0 < strlen( $inline_css ) ) {
1017
- // Insert newline
1018
- $inline_css .= "\n";
1019
- }
1020
 
1021
  // Set media query
1022
  $inline_css .= '@media screen and (min-width:' . $horizontal_min_width . 'px){' . "\n"
@@ -1025,9 +1007,18 @@ function A2A_SHARE_SAVE_stylesheet() {
1025
 
1026
  }
1027
 
 
 
 
 
 
 
 
 
 
 
1028
  // If there is inline CSS
1029
  if ( 0 < strlen( $inline_css ) ) {
1030
-
1031
  // Insert inline CSS
1032
  wp_add_inline_style( 'A2A_SHARE_SAVE', $inline_css );
1033
  }
@@ -1041,13 +1032,12 @@ function A2A_SHARE_SAVE_stylesheet() {
1041
  add_action( 'wp_print_styles', 'A2A_SHARE_SAVE_stylesheet' );
1042
 
1043
 
1044
-
1045
  /**
1046
  * Cache AddToAny
1047
  */
1048
 
1049
  function A2A_SHARE_SAVE_refresh_cache() {
1050
- $contents = wp_remote_fopen( 'http://www.addtoany.com/ext/updater/files_list/' );
1051
  $file_urls = explode( "\n", $contents, 20 );
1052
  $upload_dir = wp_upload_dir();
1053
 
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.6.7
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
10
  Domain Path: /languages
11
  */
 
 
 
 
12
 
13
  $A2A_SHARE_SAVE_plugin_basename = plugin_basename( dirname( __FILE__ ) );
14
+ $A2A_SHARE_SAVE_plugin_dir = untrailingslashit( plugin_dir_path( __FILE__ ) );
15
+ $A2A_SHARE_SAVE_plugin_url_path = untrailingslashit( plugin_dir_url( __FILE__ ) );
16
 
17
+ // HTTPS?
18
+ $A2A_SHARE_SAVE_plugin_url_path = is_ssl() ? str_replace( 'http:', 'https:', $A2A_SHARE_SAVE_plugin_url_path ) : $A2A_SHARE_SAVE_plugin_url_path;
19
+ // Set AddToAny locale (JavaScript)
20
+ $A2A_locale = ! isset ( $A2A_locale ) ? '' : $A2A_locale;
21
+ // Set plugin options
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' );
23
 
24
  function A2A_SHARE_SAVE_init() {
47
  // Set linkname
48
  if ( ! $linkname ) {
49
  if ( isset( $post ) ) {
50
+ $linkname = html_entity_decode( strip_tags( get_the_title( $post->ID, ENT_QUOTES, 'UTF-8' ) ) );
51
  }
52
  else {
53
  $linkname = '';
54
  }
55
  }
56
 
57
+ $linkname_enc = rawurlencode( $linkname );
58
 
59
  // Set linkurl
60
  if ( ! $linkurl ) {
414
  $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share"/>';
415
  }
416
 
417
+ $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"' . $button_id
418
  . $style . $button_target
419
  . '>' . $button . '</a>';
420
 
960
  // wp_add_inline_style requires WP 3.3+
961
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
962
 
963
+ // Prepare inline CSS
964
  $inline_css = '';
965
 
966
  $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
997
  is_numeric( $options['floating_horizontal_responsive_min_width'] )
998
  ) ? $options['floating_horizontal_responsive_min_width'] : '981';
999
 
1000
+ // Insert newline if there is inline CSS already
1001
+ $inline_css = 0 < strlen( $inline_css ) ? $inline_css . "\n" : $inline_css;
 
 
 
1002
 
1003
  // Set media query
1004
  $inline_css .= '@media screen and (min-width:' . $horizontal_min_width . 'px){' . "\n"
1007
 
1008
  }
1009
 
1010
+ // If additional CSS (custom CSS for AddToAny) is set
1011
+ if ( ! empty( $options['additional_css'] ) ) {
1012
+ $custom_css = stripslashes( $options['additional_css'] );
1013
+
1014
+ // Insert newline if there is inline CSS already
1015
+ $inline_css = 0 < strlen( $inline_css ) ? $inline_css . "\n" : $inline_css;
1016
+
1017
+ $inline_css .= $custom_css;
1018
+ }
1019
+
1020
  // If there is inline CSS
1021
  if ( 0 < strlen( $inline_css ) ) {
 
1022
  // Insert inline CSS
1023
  wp_add_inline_style( 'A2A_SHARE_SAVE', $inline_css );
1024
  }
1032
  add_action( 'wp_print_styles', 'A2A_SHARE_SAVE_stylesheet' );
1033
 
1034
 
 
1035
  /**
1036
  * Cache AddToAny
1037
  */
1038
 
1039
  function A2A_SHARE_SAVE_refresh_cache() {
1040
+ $contents = wp_remote_fopen( 'https://www.addtoany.com/ext/updater/files_list/' );
1041
  $file_urls = explode( "\n", $contents, 20 );
1042
  $upload_dir = wp_upload_dir();
1043
 
addtoany.admin.php CHANGED
@@ -264,6 +264,7 @@ function A2A_SHARE_SAVE_options_page() {
264
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
265
  $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
266
  $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
 
267
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
268
  $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) : '';
269
  $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_type'] : 'png';
@@ -532,7 +533,7 @@ function A2A_SHARE_SAVE_options_page() {
532
 
533
  <tr valign="top">
534
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
535
- <td><fieldset>
536
  <label>
537
  <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( stripslashes( $options['header'] ) ); ?>" />
538
  </label>
@@ -606,7 +607,7 @@ function A2A_SHARE_SAVE_options_page() {
606
 
607
  <tr valign="top">
608
  <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
609
- <td><fieldset>
610
  <label>
611
  <input name="A2A_SHARE_SAVE_onclick" type="checkbox"<?php if ( isset( $options['onclick'] ) && $options['onclick'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
612
  <?php _e('Only show the universal share menu when the user <em>clicks</em> the universal share button', 'add-to-any'); ?>
@@ -617,7 +618,7 @@ function A2A_SHARE_SAVE_options_page() {
617
  <?php _e('Show the title of the page within the universal share menu', 'add-to-any'); ?>
618
  </label>
619
  <label>
620
- <p><?php _e("You can use AddToAny's Menu Styler to customize the colors of your universal share menu. When you're done, be sure to paste the generated code in the <a href=\"#\" onclick=\"document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();return false\">Additional Options</a> box below.", 'add-to-any'); ?></p>
621
  </label>
622
  <p>
623
  <a href="https://www.addtoany.com/buttons/share_save/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the AddToAny Menu Styler in a new window", 'add-to-any'); ?>" target="_blank" onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus(); document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", 'add-to-any'); ?></a>
@@ -626,8 +627,8 @@ function A2A_SHARE_SAVE_options_page() {
626
  </tr>
627
 
628
  <tr valign="top">
629
- <th scope="row"><?php _e('Additional Options', 'add-to-any'); ?></th>
630
- <td><fieldset>
631
  <p id="A2A_SHARE_SAVE_menu_styler_note" style="display:none">
632
  <label for="A2A_SHARE_SAVE_additional_js_variables" class="updated">
633
  <strong><?php _e("Paste the code from AddToAny's Menu Styler in the box below!", 'add-to-any'); ?></strong>
@@ -643,8 +644,20 @@ function A2A_SHARE_SAVE_options_page() {
643
  </fieldset></td>
644
  </tr>
645
  <tr valign="top">
 
 
 
 
 
 
 
 
 
 
 
 
646
  <th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
647
- <td><fieldset>
648
  <label for="A2A_SHARE_SAVE_custom_icons">
649
  <input name="A2A_SHARE_SAVE_custom_icons" id="A2A_SHARE_SAVE_custom_icons" type="checkbox"<?php if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' ) echo ' checked="checked"'; ?> value="url"/>
650
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
@@ -1073,19 +1086,31 @@ function A2A_SHARE_SAVE_admin_head() {
1073
 
1074
  // Add/Remove Services button
1075
  jQuery('#addtoany_services_sortable .dummy:first').after('<li id="addtoany_show_services"><?php _e('Add/Remove Services', 'add-to-any'); ?> &#187;</li>');
1076
- jQuery('#addtoany_show_services').click(function(e){
1077
  jQuery('#addtoany_services_selectable, #addtoany_services_info').slideDown('fast');
1078
  jQuery(this).fadeOut('fast');
1079
  });
1080
 
1081
  // Adjust the Add/Remove Services button for large or small icons
1082
- if ( jQuery('input:radio[name=A2A_SHARE_SAVE_icon_size]:checked').val() != '16' )
1083
  jQuery('#addtoany_show_services').addClass('addtoany_line_height_32');
 
1084
 
1085
- // TBD
1086
- jQuery('#addtoany_show_css_code').click(function(e){
1087
- jQuery('#addtoany_css_code').slideDown('fast');
1088
- jQuery(this).fadeOut('fast');
 
 
 
 
 
 
 
 
 
 
 
1089
  });
1090
  });
1091
  --></script>
@@ -1126,6 +1151,22 @@ function A2A_SHARE_SAVE_admin_head() {
1126
  li#addtoany_show_services:hover{border:1px solid #AAA;}
1127
  #addtoany_services_info{clear:left;display:none;margin:10px;}
1128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  .a2a_kit_size_32.addtoany_override .a2a_svg {
1130
  border-radius: 4px;
1131
  display:inline-block;
@@ -1134,8 +1175,6 @@ function A2A_SHARE_SAVE_admin_head() {
1134
  width: 32px;
1135
  }
1136
 
1137
- #addtoany_template_button_code, #addtoany_css_code{display:none;}
1138
-
1139
  #A2A_SHARE_SAVE_reset_options{color:red;margin-left: 15px;}
1140
  </style>
1141
  <?php
264
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
265
  $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
266
  $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
267
+ $new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
268
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
269
  $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) : '';
270
  $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_type'] : 'png';
533
 
534
  <tr valign="top">
535
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
536
+ <td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section" role="region">
537
  <label>
538
  <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( stripslashes( $options['header'] ) ); ?>" />
539
  </label>
607
 
608
  <tr valign="top">
609
  <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
610
+ <td><fieldset id="addtoany_extra_section_menu_options" class="addtoany_extra_section" role="region">
611
  <label>
612
  <input name="A2A_SHARE_SAVE_onclick" type="checkbox"<?php if ( isset( $options['onclick'] ) && $options['onclick'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
613
  <?php _e('Only show the universal share menu when the user <em>clicks</em> the universal share button', 'add-to-any'); ?>
618
  <?php _e('Show the title of the page within the universal share menu', 'add-to-any'); ?>
619
  </label>
620
  <label>
621
+ <p><?php _e("You can use AddToAny's Menu Styler to customize the colors of your universal share menu. When you're done, be sure to paste the generated code in the <a href=\"#\" onclick=\"document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();return false\">Additional JavaScript</a> box below.", 'add-to-any'); ?></p>
622
  </label>
623
  <p>
624
  <a href="https://www.addtoany.com/buttons/share_save/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the AddToAny Menu Styler in a new window", 'add-to-any'); ?>" target="_blank" onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus(); document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", 'add-to-any'); ?></a>
627
  </tr>
628
 
629
  <tr valign="top">
630
+ <th scope="row"><?php _e('Additional JavaScript', 'add-to-any'); ?></th>
631
+ <td><fieldset id="addtoany_extra_section_additional_javascript" class="addtoany_extra_section" role="region">
632
  <p id="A2A_SHARE_SAVE_menu_styler_note" style="display:none">
633
  <label for="A2A_SHARE_SAVE_additional_js_variables" class="updated">
634
  <strong><?php _e("Paste the code from AddToAny's Menu Styler in the box below!", 'add-to-any'); ?></strong>
644
  </fieldset></td>
645
  </tr>
646
  <tr valign="top">
647
+ <th scope="row"><?php _e('Additional CSS', 'add-to-any'); ?></th>
648
+ <td><fieldset id="addtoany_extra_section_additional_css" class="addtoany_extra_section" role="region">
649
+ <label for="A2A_SHARE_SAVE_additional_css">
650
+ <p><?php _e('Below you can add special CSS code for AddToAny.', 'add-to-any'); ?>
651
+ <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
652
+ </label>
653
+ <p>
654
+ <textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_css'] ) ) echo stripslashes( $options['additional_css'] ); ?></textarea>
655
+ </p>
656
+ </fieldset></td>
657
+ </tr>
658
+ <tr valign="top">
659
  <th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
660
+ <td><fieldset id="addtoany_extra_section_advanced_options" class="addtoany_extra_section" role="region">
661
  <label for="A2A_SHARE_SAVE_custom_icons">
662
  <input name="A2A_SHARE_SAVE_custom_icons" id="A2A_SHARE_SAVE_custom_icons" type="checkbox"<?php if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' ) echo ' checked="checked"'; ?> value="url"/>
663
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
1086
 
1087
  // Add/Remove Services button
1088
  jQuery('#addtoany_services_sortable .dummy:first').after('<li id="addtoany_show_services"><?php _e('Add/Remove Services', 'add-to-any'); ?> &#187;</li>');
1089
+ jQuery('#addtoany_show_services').click(function(e) {
1090
  jQuery('#addtoany_services_selectable, #addtoany_services_info').slideDown('fast');
1091
  jQuery(this).fadeOut('fast');
1092
  });
1093
 
1094
  // Adjust the Add/Remove Services button for large or small icons
1095
+ if ( jQuery('input:radio[name=A2A_SHARE_SAVE_icon_size]:checked').val() != '16' ) {
1096
  jQuery('#addtoany_show_services').addClass('addtoany_line_height_32');
1097
+ }
1098
 
1099
+ // Hide each 'extra' section if it does not have a textarea with a value
1100
+ jQuery('.addtoany_extra_section:not(:has(textarea:not(:empty)))').hide()
1101
+ // Keep it accessible
1102
+ .attr('aria-expanded', 'false')
1103
+ .attr('tabindex', '-1')
1104
+ .each(function(index) {
1105
+ // Insert an accessible 'show section' button
1106
+ jQuery(this).after('<fieldset><button class="addtoany_show_more_button button" type="button" aria-controls="' + jQuery(this).attr('id') + '"><span class="dashicons dashicons-arrow-down"></span></button></fieldset>');
1107
+ });
1108
+ // Handle click on 'show section' button
1109
+ jQuery('.addtoany_extra_section').next('fieldset').find('button').click(function(e) {
1110
+ jQuery(this).hide('fast');
1111
+ jQuery(this).parent().prev('fieldset').slideDown('fast')
1112
+ .attr('aria-expanded', 'true')
1113
+ .focus();
1114
  });
1115
  });
1116
  --></script>
1151
  li#addtoany_show_services:hover{border:1px solid #AAA;}
1152
  #addtoany_services_info{clear:left;display:none;margin:10px;}
1153
 
1154
+ /* No outline during ARIA focus */
1155
+ .addtoany_extra_section {
1156
+ outline: 0;
1157
+ }
1158
+ /* Adjust position of arrow icon on show more button */
1159
+ .addtoany_show_more_button .dashicons {
1160
+ position: relative;
1161
+ right: 1px;
1162
+ top: 2px;
1163
+ }
1164
+ @media screen and (max-width: 782px) {
1165
+ .addtoany_show_more_button .dashicons {
1166
+ top: 0px;
1167
+ }
1168
+ }
1169
+
1170
  .a2a_kit_size_32.addtoany_override .a2a_svg {
1171
  border-radius: 4px;
1172
  display:inline-block;
1175
  width: 32px;
1176
  }
1177
 
 
 
1178
  #A2A_SHARE_SAVE_reset_options{color:red;margin-left: 15px;}
1179
  </style>
1180
  <?php