Version Description
- Update AMP support
- Update vertical floating share buttons bar for AMP pages
- Supports "Left docked" or "Right docked" placement options
- Update horizontal floating share buttons bar for AMP pages
- Full width layout overrides placement options
- Add round corners to AMP share buttons in content
- Skip plugin scripts on AMP pages
Download this release
Release Info
Developer | micropat |
Plugin | AddToAny Share Buttons |
Version | 1.8.3 |
Comparing to | |
See all releases |
Code changes from version 1.8.2 to 1.8.3
- README.txt +10 -1
- add-to-any.php +22 -11
- addtoany.amp.css +39 -0
- addtoany.compat.php +14 -21
README.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, share, icons, social media, share buttons, sharing, share button,
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 1.8.
|
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,15 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
|
|
346 |
|
347 |
== Changelog ==
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
= 1.8.2 =
|
350 |
* Update AddToAny core script loading
|
351 |
* Rename enqueued `addtoany` scripts to `addtoany-core` and `addtoany-jquery`
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 1.8.3
|
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.8.3 =
|
350 |
+
* Update AMP support
|
351 |
+
* Update vertical floating share buttons bar for AMP pages
|
352 |
+
* Supports "Left docked" or "Right docked" placement options
|
353 |
+
* Update horizontal floating share buttons bar for AMP pages
|
354 |
+
* Full width layout overrides placement options
|
355 |
+
* Add round corners to AMP share buttons in content
|
356 |
+
* Skip plugin scripts on AMP pages
|
357 |
+
|
358 |
= 1.8.2 =
|
359 |
* Update AddToAny core script loading
|
360 |
* Rename enqueued `addtoany` scripts to `addtoany-core` and `addtoany-jquery`
|
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.8.
|
7 |
* Author: AddToAny
|
8 |
* Author URI: https://www.addtoany.com/
|
9 |
* Text Domain: add-to-any
|
@@ -358,14 +358,15 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
358 |
|
359 |
// Use AMP's "print" action.
|
360 |
if ( $is_amp && 'print' === $code_name ) {
|
361 |
-
$amp_on_attr = 'on="tap:AMP.print()"';
|
362 |
-
$href_attr = '#';
|
|
|
363 |
} else {
|
364 |
$amp_on_attr = '';
|
365 |
}
|
366 |
|
367 |
// Set dimension attributes if using custom icons and dimension is specified.
|
368 |
-
if ( isset( $custom_icons ) ) {
|
369 |
$width_attr = ! empty( $icons_width ) ? ' width="' . $icons_width . '"' : '';
|
370 |
$height_attr = ! empty( $icons_height ) ? ' height="' . $icons_height . '"' : '';
|
371 |
}
|
@@ -755,7 +756,7 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
|
|
755 |
return $floating_html;
|
756 |
}
|
757 |
else {
|
758 |
-
// Output escaped HTML without stripping out positional styles as wp_kses* does.
|
759 |
echo addtoany_kses( $floating_html );
|
760 |
}
|
761 |
}
|
@@ -766,7 +767,7 @@ function A2A_SHARE_SAVE_footer_script() {
|
|
766 |
|
767 |
$floating_html = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) );
|
768 |
|
769 |
-
// Output escaped HTML without stripping out positional styles as wp_kses* does.
|
770 |
echo addtoany_kses( $floating_html );
|
771 |
}
|
772 |
|
@@ -922,10 +923,18 @@ function A2A_SHARE_SAVE_stylesheet() {
|
|
922 |
$options = $A2A_SHARE_SAVE_options;
|
923 |
|
924 |
if ( ! is_admin() ) {
|
925 |
-
wp_enqueue_style( 'addtoany', plugins_url('/addtoany.min.css', __FILE__ ), false, '1.15' );
|
926 |
-
|
927 |
// Prepare inline CSS.
|
928 |
$inline_css = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
|
930 |
$vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
|
931 |
$horizontal_type = ( isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ) ? $options['floating_horizontal'] : false;
|
@@ -943,7 +952,7 @@ function A2A_SHARE_SAVE_stylesheet() {
|
|
943 |
|
944 |
// Set media query.
|
945 |
$inline_css .= '@media screen and (max-width:' . $vertical_max_width . 'px){' . "\n"
|
946 |
-
. '.a2a_floating_style.a2a_vertical_style{display:none;}' . "\n"
|
947 |
. '}';
|
948 |
}
|
949 |
|
@@ -963,7 +972,7 @@ function A2A_SHARE_SAVE_stylesheet() {
|
|
963 |
|
964 |
// Set media query.
|
965 |
$inline_css .= '@media screen and (min-width:' . $horizontal_min_width . 'px){' . "\n"
|
966 |
-
. '.a2a_floating_style.a2a_default_style{display:none;}' . "\n"
|
967 |
. '}';
|
968 |
}
|
969 |
|
@@ -993,8 +1002,10 @@ function A2A_SHARE_SAVE_enqueue_script() {
|
|
993 |
// Hook to disable script output.
|
994 |
// Example: add_filter( 'addtoany_script_disabled', '__return_true' );
|
995 |
$script_disabled = apply_filters( 'addtoany_script_disabled', false );
|
|
|
|
|
996 |
|
997 |
-
if ( is_admin() || is_feed() || $script_disabled )
|
998 |
return;
|
999 |
|
1000 |
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, LinkedIn, Pinterest, WhatsApp and many more.
|
6 |
+
* Version: 1.8.3
|
7 |
* Author: AddToAny
|
8 |
* Author URI: https://www.addtoany.com/
|
9 |
* Text Domain: add-to-any
|
358 |
|
359 |
// Use AMP's "print" action.
|
360 |
if ( $is_amp && 'print' === $code_name ) {
|
361 |
+
$amp_on_attr = ' on="tap:AMP.print()"';
|
362 |
+
$href_attr = ' href="#print"';
|
363 |
+
$target_attr = '';
|
364 |
} else {
|
365 |
$amp_on_attr = '';
|
366 |
}
|
367 |
|
368 |
// Set dimension attributes if using custom icons and dimension is specified.
|
369 |
+
if ( isset( $custom_icons ) && ! $is_amp ) {
|
370 |
$width_attr = ! empty( $icons_width ) ? ' width="' . $icons_width . '"' : '';
|
371 |
$height_attr = ! empty( $icons_height ) ? ' height="' . $icons_height . '"' : '';
|
372 |
}
|
756 |
return $floating_html;
|
757 |
}
|
758 |
else {
|
759 |
+
// Output escaped HTML without stripping out AMP attributes and positional styles as wp_kses* does.
|
760 |
echo addtoany_kses( $floating_html );
|
761 |
}
|
762 |
}
|
767 |
|
768 |
$floating_html = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) );
|
769 |
|
770 |
+
// Output escaped HTML without stripping out AMP attributes and positional styles as wp_kses* does.
|
771 |
echo addtoany_kses( $floating_html );
|
772 |
}
|
773 |
|
923 |
$options = $A2A_SHARE_SAVE_options;
|
924 |
|
925 |
if ( ! is_admin() ) {
|
|
|
|
|
926 |
// Prepare inline CSS.
|
927 |
$inline_css = '';
|
928 |
+
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
929 |
+
$html_amp = $is_amp ? 'html[amp] ' : '';
|
930 |
+
|
931 |
+
// Load AMP stylesheet first so its declarations are overridable by the main stylesheet.
|
932 |
+
if ( $is_amp ) {
|
933 |
+
wp_enqueue_style( 'addtoany-amp', plugins_url('/addtoany.amp.css', __FILE__ ), false, '1.0' );
|
934 |
+
}
|
935 |
+
|
936 |
+
// Load main stylesheet last so its declarations can override the AMP stylesheet.
|
937 |
+
wp_enqueue_style( 'addtoany', plugins_url('/addtoany.min.css', __FILE__ ), false, '1.16' );
|
938 |
|
939 |
$vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
|
940 |
$horizontal_type = ( isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ) ? $options['floating_horizontal'] : false;
|
952 |
|
953 |
// Set media query.
|
954 |
$inline_css .= '@media screen and (max-width:' . $vertical_max_width . 'px){' . "\n"
|
955 |
+
. $html_amp . '.a2a_floating_style.a2a_vertical_style{display:none;}' . "\n"
|
956 |
. '}';
|
957 |
}
|
958 |
|
972 |
|
973 |
// Set media query.
|
974 |
$inline_css .= '@media screen and (min-width:' . $horizontal_min_width . 'px){' . "\n"
|
975 |
+
. $html_amp . '.a2a_floating_style.a2a_default_style{display:none;}' . "\n"
|
976 |
. '}';
|
977 |
}
|
978 |
|
1002 |
// Hook to disable script output.
|
1003 |
// Example: add_filter( 'addtoany_script_disabled', '__return_true' );
|
1004 |
$script_disabled = apply_filters( 'addtoany_script_disabled', false );
|
1005 |
+
|
1006 |
+
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
1007 |
|
1008 |
+
if ( is_admin() || is_feed() || $script_disabled || $is_amp )
|
1009 |
return;
|
1010 |
|
1011 |
if ( is_singular() ) {
|
addtoany.amp.css
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* CSS for AMP
|
3 |
+
*/
|
4 |
+
|
5 |
+
/* Standard Buttons */
|
6 |
+
html[amp] .addtoany_list a {
|
7 |
+
padding: 0 4px;
|
8 |
+
}
|
9 |
+
|
10 |
+
html[amp] .addtoany_list a > img {
|
11 |
+
border-radius: 4px;
|
12 |
+
display: inline-block;
|
13 |
+
}
|
14 |
+
|
15 |
+
/* Floating Buttons */
|
16 |
+
html[amp] .a2a_floating_style {
|
17 |
+
overflow: hidden;
|
18 |
+
position: fixed;
|
19 |
+
z-index: 9999995;
|
20 |
+
}
|
21 |
+
|
22 |
+
/* Horizontal Floating Buttons */
|
23 |
+
html[amp] .a2a_floating_style.a2a_default_style {
|
24 |
+
display: flex;
|
25 |
+
width: 100%;
|
26 |
+
}
|
27 |
+
|
28 |
+
html[amp] .a2a_floating_style.a2a_default_style a {
|
29 |
+
flex: 1;
|
30 |
+
}
|
31 |
+
|
32 |
+
html[amp] .a2a_floating_style.a2a_default_style a > img {
|
33 |
+
width: 100%;
|
34 |
+
}
|
35 |
+
|
36 |
+
/* Vertical Floating Buttons */
|
37 |
+
html[amp] .a2a_floating_style.a2a_vertical_style a {
|
38 |
+
display: block;
|
39 |
+
}
|
addtoany.compat.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Strips out disallowed HTML using wp_kses_post() while temporarily allowing
|
|
|
5 |
*/
|
6 |
function addtoany_kses( $string ) {
|
7 |
/**
|
@@ -17,15 +18,25 @@ function addtoany_kses( $string ) {
|
|
17 |
add_filter( 'safecss_filter_attr_allow_css', 'addtoany_kses_allow_css_declarations', 10, 2 );
|
18 |
|
19 |
// Strip out any disallowed HTML.
|
20 |
-
$string =
|
21 |
|
22 |
// Revert kses filters to originals.
|
23 |
-
remove_filter( 'safe_style_css', '
|
24 |
remove_filter( 'safecss_filter_attr_allow_css', 'addtoany_kses_allow_css_declarations', 10, 2 );
|
25 |
|
26 |
return $string;
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Allows some additional CSS properties in a `style` attribute.
|
31 |
*/
|
@@ -72,24 +83,6 @@ function addtoany_excerpt_remove() {
|
|
72 |
}
|
73 |
}
|
74 |
|
75 |
-
/**
|
76 |
-
* Load AMP (Accelerated Mobile Pages) compatibility functions.
|
77 |
-
*/
|
78 |
-
|
79 |
-
add_action( 'amp_post_template_css', 'addtoany_amp_additional_css_styles' );
|
80 |
-
|
81 |
-
function addtoany_amp_additional_css_styles( $amp_template ) {
|
82 |
-
// CSS only.
|
83 |
-
?>
|
84 |
-
.addtoany_list a {
|
85 |
-
padding: 0 4px;
|
86 |
-
}
|
87 |
-
.addtoany_list a amp-img {
|
88 |
-
display: inline-block;
|
89 |
-
}
|
90 |
-
<?php
|
91 |
-
}
|
92 |
-
|
93 |
/**
|
94 |
* Change the priority of standard buttons in content to work around a
|
95 |
* Jetpack ~v7.8 Related Posts bug that removes content added to AMP posts
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Strips out disallowed HTML using wp_kses_post() while temporarily allowing
|
5 |
+
* some additional HTML attributes and CSS in a style attribute.
|
6 |
*/
|
7 |
function addtoany_kses( $string ) {
|
8 |
/**
|
18 |
add_filter( 'safecss_filter_attr_allow_css', 'addtoany_kses_allow_css_declarations', 10, 2 );
|
19 |
|
20 |
// Strip out any disallowed HTML.
|
21 |
+
$string = wp_kses( $string, addtoany_expanded_allowed_html() );
|
22 |
|
23 |
// Revert kses filters to originals.
|
24 |
+
remove_filter( 'safe_style_css', 'addtoany_kses_allow_css_properties' );
|
25 |
remove_filter( 'safecss_filter_attr_allow_css', 'addtoany_kses_allow_css_declarations', 10, 2 );
|
26 |
|
27 |
return $string;
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* Returns `wp_kses_allowed_html( 'post' )` with additional allowed HTML.
|
32 |
+
*/
|
33 |
+
function addtoany_expanded_allowed_html() {
|
34 |
+
$allowed = wp_kses_allowed_html( 'post' );
|
35 |
+
// Add AMP attributes.
|
36 |
+
$allowed['a']['on'] = true;
|
37 |
+
return $allowed;
|
38 |
+
}
|
39 |
+
|
40 |
/**
|
41 |
* Allows some additional CSS properties in a `style` attribute.
|
42 |
*/
|
83 |
}
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
/**
|
87 |
* Change the priority of standard buttons in content to work around a
|
88 |
* Jetpack ~v7.8 Related Posts bug that removes content added to AMP posts
|