Version Description
- Follow buttons have arrived for WordPress!
- Includes Instagram, YouTube, Vimeo, Flickr, Foursquare, Behance, and RSS
- Go to
Appearance
>Customize
orAppearance
>Widgets
to setup your follow buttons
Download this release
Release Info
Developer | micropat |
Plugin | AddToAny Share Buttons |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.9 to 1.6
- README.txt +15 -8
- add-to-any.php +78 -24
- addtoany.services.php +78 -0
- addtoany.widget.php +0 -68
- addtoany.widgets.php +186 -0
README.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Share Buttons by AddToAny ===
|
2 |
Contributors: micropat, addtoany
|
3 |
-
Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, google +1, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any, AddToAny
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
|
9 |
|
@@ -13,14 +13,13 @@ The WordPress sharing plugin to help people share, save, and email your posts an
|
|
13 |
|
14 |
AddToAny's customizable platform and social share icons let you optimize your site's blog posts & pages for the best social sharing engagement.
|
15 |
|
16 |
-
= Share Buttons =
|
17 |
|
18 |
* **Counters** — fast & official share counts in the same style
|
19 |
* **Floating** share buttons — responsive & customizable, vertical & horizontal
|
20 |
-
* **Vector**
|
21 |
* **Universal** Share Button and Smart Menu
|
22 |
-
* Individual share links
|
23 |
-
* Custom share icons
|
24 |
* Choose from over 100 services
|
25 |
* 3rd party buttons include the Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button and Google +1 Button
|
26 |
* Universal email sharing makes it easy to share via Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web and native apps
|
@@ -63,7 +62,7 @@ AddToAny's customizable platform and social share icons let you optimize your si
|
|
63 |
= Wide Support =
|
64 |
|
65 |
* Over 8 years of active development
|
66 |
-
* Over
|
67 |
* Translated into dozens of languages
|
68 |
* Ongoing support from the community
|
69 |
|
@@ -264,7 +263,7 @@ Upload the plugin directory (including all files and directories within) to the
|
|
264 |
|
265 |
== Screenshots ==
|
266 |
|
267 |
-
1.
|
268 |
2. Traditional Share/Save button features Facebook, Twitter, and a generic share icon
|
269 |
3. Mini share menu that drops down when visitors use the universal share button
|
270 |
4. Full universal share menu modal that includes all services
|
@@ -273,6 +272,11 @@ Upload the plugin directory (including all files and directories within) to the
|
|
273 |
|
274 |
== Changelog ==
|
275 |
|
|
|
|
|
|
|
|
|
|
|
276 |
= 1.5.9 =
|
277 |
* Accept custom icons of all file types such as png, svg, gif, jpg, webp, etc.
|
278 |
* Remove empty width and height attributes on custom icons for W3C validation
|
@@ -1268,6 +1272,9 @@ Upload the plugin directory (including all files and directories within) to the
|
|
1268 |
|
1269 |
== Upgrade Notice ==
|
1270 |
|
|
|
|
|
|
|
1271 |
= 1.5.3 =
|
1272 |
Switch to the Large or Custom icon size if you haven't already - AddToAny's vector icons are way better than the traditional Small icons.
|
1273 |
|
1 |
=== Share Buttons by AddToAny ===
|
2 |
Contributors: micropat, addtoany
|
3 |
+
Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, google +1, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any, AddToAny
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 1.6
|
7 |
|
8 |
Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
|
9 |
|
13 |
|
14 |
AddToAny's customizable platform and social share icons let you optimize your site's blog posts & pages for the best social sharing engagement.
|
15 |
|
16 |
+
= Share Buttons & Follow Buttons =
|
17 |
|
18 |
* **Counters** — fast & official share counts in the same style
|
19 |
* **Floating** share buttons — responsive & customizable, vertical & horizontal
|
20 |
+
* **Vector** share & follow buttons (SVG icons)
|
21 |
* **Universal** Share Button and Smart Menu
|
22 |
+
* Individual share links and custom share icons
|
|
|
23 |
* Choose from over 100 services
|
24 |
* 3rd party buttons include the Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button and Google +1 Button
|
25 |
* Universal email sharing makes it easy to share via Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web and native apps
|
62 |
= Wide Support =
|
63 |
|
64 |
* Over 8 years of active development
|
65 |
+
* Over 4 million downloads
|
66 |
* Translated into dozens of languages
|
67 |
* Ongoing support from the community
|
68 |
|
263 |
|
264 |
== Screenshots ==
|
265 |
|
266 |
+
1. AddToAny vector share buttons (SVG icons) are pixel-perfect on Retina and high-PPI dispays
|
267 |
2. Traditional Share/Save button features Facebook, Twitter, and a generic share icon
|
268 |
3. Mini share menu that drops down when visitors use the universal share button
|
269 |
4. Full universal share menu modal that includes all services
|
272 |
|
273 |
== Changelog ==
|
274 |
|
275 |
+
= 1.6 =
|
276 |
+
* <a href="https://www.addtoany.com/buttons/customize/wordpress/follow_buttons">Follow buttons</a> have arrived for WordPress!
|
277 |
+
* Includes Instagram, YouTube, Vimeo, Flickr, Foursquare, Behance, and RSS
|
278 |
+
* Go to `Appearance` > `Customize` or `Appearance` > `Widgets` to setup your follow buttons
|
279 |
+
|
280 |
= 1.5.9 =
|
281 |
* Accept custom icons of all file types such as png, svg, gif, jpg, webp, etc.
|
282 |
* Remove empty width and height attributes on custom icons for W3C validation
|
1272 |
|
1273 |
== Upgrade Notice ==
|
1274 |
|
1275 |
+
= 1.6 =
|
1276 |
+
Follow buttons are now available! Look for the AddToAny Follow widget in Appearance > Customize or Appearance > Widgets.
|
1277 |
+
|
1278 |
= 1.5.3 =
|
1279 |
Switch to the Large or Custom icon size if you haven't already - AddToAny's vector icons are way better than the traditional Small icons.
|
1280 |
|
add-to-any.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Share Buttons by AddToAny
|
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.
|
7 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
*/
|
@@ -175,7 +175,8 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
175 |
// $args array: output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl
|
176 |
|
177 |
global $A2A_SHARE_SAVE_plugin_url_path,
|
178 |
-
$A2A_SHARE_SAVE_services
|
|
|
179 |
|
180 |
$linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : FALSE;
|
181 |
$linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] : FALSE;
|
@@ -192,22 +193,14 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
192 |
'html_container_close' => '',
|
193 |
'html_wrap_open' => '',
|
194 |
'html_wrap_close' => '',
|
|
|
195 |
'no_universal_button' => false,
|
|
|
196 |
);
|
197 |
|
198 |
$args = wp_parse_args( $args, $defaults );
|
199 |
extract( $args );
|
200 |
|
201 |
-
// Make available services extensible via plugins, themes (functions.php), etc.
|
202 |
-
$A2A_SHARE_SAVE_services = apply_filters( 'A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services );
|
203 |
-
|
204 |
-
$service_codes = ( is_array( $A2A_SHARE_SAVE_services ) ) ? array_keys( $A2A_SHARE_SAVE_services ) : array();
|
205 |
-
|
206 |
-
// Include Facebook Like and Twitter Tweet etc. unless no_special_services arg is true
|
207 |
-
if ( ! isset( $no_special_services ) || false == $no_special_services ) {
|
208 |
-
array_unshift( $service_codes, 'facebook_like', 'twitter_tweet', 'google_plusone', 'google_plus_share', 'pinterest_pin' );
|
209 |
-
}
|
210 |
-
|
211 |
$options = get_option( 'addtoany_options' );
|
212 |
|
213 |
// False if "icon_size" is set to '16' or no_small_icons arg is true
|
@@ -227,8 +220,30 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
227 |
$icons_type = 'png';
|
228 |
}
|
229 |
|
230 |
-
//
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
$ind_html = "" . $html_container_open;
|
234 |
|
@@ -242,12 +257,16 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
242 |
$special_args['output_later'] = true;
|
243 |
$link = ADDTOANY_SHARE_SAVE_SPECIAL( $active_service, $special_args );
|
244 |
} else {
|
245 |
-
$service = $
|
246 |
$safe_name = $active_service;
|
247 |
$name = $service['name'];
|
248 |
|
249 |
-
// If
|
250 |
-
if ( isset( $service['href'] )
|
|
|
|
|
|
|
|
|
251 |
$custom_service = true;
|
252 |
$href = $service['href'];
|
253 |
if ( isset( $service['href_js_esc'] ) ) {
|
@@ -265,7 +284,8 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
265 |
}
|
266 |
|
267 |
// AddToAny counter enabled?
|
268 |
-
$counter_enabled = ( !
|
|
|
269 |
&& in_array( $active_service, array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'reddit' ) )
|
270 |
&& isset( $options['special_' . $active_service . '_options'] )
|
271 |
&& isset( $options['special_' . $active_service . '_options']['show_count'] )
|
@@ -277,10 +297,11 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
277 |
$width_attr = ( isset( $service['icon_width'] ) ) ? ' width="' . $service['icon_width'] . '"' : ' width="16"';
|
278 |
$height_attr = ( isset( $service['icon_height'] ) ) ? ' height="' . $service['icon_height'] . '"' : ' height="16"';
|
279 |
|
280 |
-
$url = ( $
|
281 |
$src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
|
282 |
$counter = ( $counter_enabled ) ? ' a2a_counter' : '';
|
283 |
$class_attr = ( $custom_service ) ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
|
|
|
284 |
|
285 |
// Remove dimension attributes if using custom icons
|
286 |
if ( isset( $custom_icons ) ) {
|
@@ -288,7 +309,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
288 |
$height_attr = '';
|
289 |
}
|
290 |
|
291 |
-
$link = $html_wrap_open . "<a$class_attr href=\"$url\" title=\"$name\"
|
292 |
$link .= ( $large_icons && ! isset( $custom_icons ) && ! $custom_service ) ? "" : "<img src=\"$src\"" . $width_attr . $height_attr . " alt=\"$name\"/>";
|
293 |
$link .= "</a>" . $html_wrap_close;
|
294 |
}
|
@@ -548,6 +569,38 @@ if ( ! function_exists( 'A2A_menu_locale' ) ) {
|
|
548 |
}
|
549 |
}
|
550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
|
552 |
$options = get_option( 'addtoany_options' );
|
553 |
|
@@ -569,7 +622,7 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
|
|
569 |
}
|
570 |
}
|
571 |
|
572 |
-
// Args are
|
573 |
$defaults = array(
|
574 |
'linkname' => '',
|
575 |
'linkurl' => '',
|
@@ -1084,14 +1137,15 @@ function A2A_SHARE_SAVE_add_menu_link() {
|
|
1084 |
|
1085 |
add_filter( 'admin_menu', 'A2A_SHARE_SAVE_add_menu_link' );
|
1086 |
|
1087 |
-
function
|
1088 |
global $A2A_SHARE_SAVE_plugin_dir;
|
1089 |
|
1090 |
-
include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.
|
1091 |
register_widget( 'A2A_SHARE_SAVE_Widget' );
|
|
|
1092 |
}
|
1093 |
|
1094 |
-
add_action( 'widgets_init', '
|
1095 |
|
1096 |
// Place in Option List on Settings > Plugins page
|
1097 |
function A2A_SHARE_SAVE_actlinks( $links, $file ) {
|
3 |
Plugin Name: Share Buttons by AddToAny
|
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 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
*/
|
175 |
// $args array: output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl
|
176 |
|
177 |
global $A2A_SHARE_SAVE_plugin_url_path,
|
178 |
+
$A2A_SHARE_SAVE_services,
|
179 |
+
$A2A_FOLLOW_services;
|
180 |
|
181 |
$linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : FALSE;
|
182 |
$linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] : FALSE;
|
193 |
'html_container_close' => '',
|
194 |
'html_wrap_open' => '',
|
195 |
'html_wrap_close' => '',
|
196 |
+
'is_follow' => false,
|
197 |
'no_universal_button' => false,
|
198 |
+
'buttons' => array(),
|
199 |
);
|
200 |
|
201 |
$args = wp_parse_args( $args, $defaults );
|
202 |
extract( $args );
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
$options = get_option( 'addtoany_options' );
|
205 |
|
206 |
// False if "icon_size" is set to '16' or no_small_icons arg is true
|
220 |
$icons_type = 'png';
|
221 |
}
|
222 |
|
223 |
+
// If Follow kit
|
224 |
+
if ( $is_follow ) {
|
225 |
+
// Make available services extensible via plugins, themes (functions.php), etc.
|
226 |
+
$services = apply_filters( 'A2A_FOLLOW_services', $A2A_FOLLOW_services );
|
227 |
+
$service_codes = ( is_array( $services ) ) ? array_keys( $services ) : array();
|
228 |
+
|
229 |
+
// Services set by "buttons" arg
|
230 |
+
$active_services = ! empty ( $buttons ) ? array_keys( $buttons ) : array();
|
231 |
+
// Else Share kit
|
232 |
+
} else {
|
233 |
+
// Make available services extensible via plugins, themes (functions.php), etc.
|
234 |
+
$services = apply_filters( 'A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services );
|
235 |
+
$service_codes = ( is_array( $services ) ) ? array_keys( $services ) : array();
|
236 |
+
|
237 |
+
// Include Facebook Like and Twitter Tweet etc. unless no_special_services arg is true
|
238 |
+
if ( ! isset( $no_special_services ) || false == $no_special_services ) {
|
239 |
+
array_unshift( $service_codes, 'facebook_like', 'twitter_tweet', 'google_plusone', 'google_plus_share', 'pinterest_pin' );
|
240 |
+
}
|
241 |
+
|
242 |
+
// Use default services if services have not been selected yet
|
243 |
+
$active_services = ( isset( $options['active_services'] ) ) ? $options['active_services'] : array( 'facebook', 'twitter', 'google_plus' );
|
244 |
+
// Services set by "buttons" arg? Then use "buttons" arg instead
|
245 |
+
$active_services = ! empty ( $buttons ) ? $buttons : $active_services;
|
246 |
+
}
|
247 |
|
248 |
$ind_html = "" . $html_container_open;
|
249 |
|
257 |
$special_args['output_later'] = true;
|
258 |
$link = ADDTOANY_SHARE_SAVE_SPECIAL( $active_service, $special_args );
|
259 |
} else {
|
260 |
+
$service = $services[ $active_service ];
|
261 |
$safe_name = $active_service;
|
262 |
$name = $service['name'];
|
263 |
|
264 |
+
// If Follow kit and HREF specified
|
265 |
+
if ( $is_follow && isset( $service['href'] ) ) {
|
266 |
+
$follow_id = $buttons[ $active_service ]['id'];
|
267 |
+
$href = str_replace( '${id}', $follow_id, $service['href'] );
|
268 |
+
// Else if Share Kit and HREF specified, presume custom service
|
269 |
+
} elseif ( isset( $service['href'] ) ) {
|
270 |
$custom_service = true;
|
271 |
$href = $service['href'];
|
272 |
if ( isset( $service['href_js_esc'] ) ) {
|
284 |
}
|
285 |
|
286 |
// AddToAny counter enabled?
|
287 |
+
$counter_enabled = ( ! $is_follow // Disable counters on Follow Kits
|
288 |
+
&& ! isset( $is_floating ) // Disable counters on floating buttons for now
|
289 |
&& in_array( $active_service, array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'reddit' ) )
|
290 |
&& isset( $options['special_' . $active_service . '_options'] )
|
291 |
&& isset( $options['special_' . $active_service . '_options']['show_count'] )
|
297 |
$width_attr = ( isset( $service['icon_width'] ) ) ? ' width="' . $service['icon_width'] . '"' : ' width="16"';
|
298 |
$height_attr = ( isset( $service['icon_height'] ) ) ? ' height="' . $service['icon_height'] . '"' : ' height="16"';
|
299 |
|
300 |
+
$url = ( $href ) ? $href : "http://www.addtoany.com/add_to/" . $safe_name . "?linkurl=" . $linkurl_enc . "&linkname=" . $linkname_enc;
|
301 |
$src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
|
302 |
$counter = ( $counter_enabled ) ? ' a2a_counter' : '';
|
303 |
$class_attr = ( $custom_service ) ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
|
304 |
+
$rel_nofollow = $is_follow ? '' : ' rel="nofollow"'; // ($is_follow indicates a Follow Kit. 'nofollow' is for search crawlers. Different things)
|
305 |
|
306 |
// Remove dimension attributes if using custom icons
|
307 |
if ( isset( $custom_icons ) ) {
|
309 |
$height_attr = '';
|
310 |
}
|
311 |
|
312 |
+
$link = $html_wrap_open . "<a$class_attr href=\"$url\" title=\"$name\"$rel_nofollow target=\"_blank\">";
|
313 |
$link .= ( $large_icons && ! isset( $custom_icons ) && ! $custom_service ) ? "" : "<img src=\"$src\"" . $width_attr . $height_attr . " alt=\"$name\"/>";
|
314 |
$link .= "</a>" . $html_wrap_close;
|
315 |
}
|
569 |
}
|
570 |
}
|
571 |
|
572 |
+
function ADDTOANY_FOLLOW_KIT( $args = array() ) {
|
573 |
+
// Args are passed on to ADDTOANY_SHARE_SAVE_KIT
|
574 |
+
$defaults = array(
|
575 |
+
'linkname' => '',
|
576 |
+
'linkurl' => '',
|
577 |
+
'linkname_enc' => '',
|
578 |
+
'linkurl_enc' => '',
|
579 |
+
'use_current_page' => true,
|
580 |
+
'output_later' => false,
|
581 |
+
'is_follow' => true,
|
582 |
+
'is_kit' => true,
|
583 |
+
'no_special_services' => true,
|
584 |
+
'no_universal_button' => true,
|
585 |
+
//'no_small_icons' => true,
|
586 |
+
'kit_additional_classes' => '',
|
587 |
+
'kit_style' => '',
|
588 |
+
'services' => array(),
|
589 |
+
);
|
590 |
+
|
591 |
+
$args = wp_parse_args( $args, $defaults );
|
592 |
+
|
593 |
+
// Add a2a_follow className to Kit classes
|
594 |
+
$args['kit_additional_classes'] = 'a2a_follow';
|
595 |
+
|
596 |
+
$follow_html = ADDTOANY_SHARE_SAVE_KIT( $args );
|
597 |
+
|
598 |
+
if ( isset( $args['output_later'] ) && $args['output_later'] == true )
|
599 |
+
return $follow_html;
|
600 |
+
else
|
601 |
+
echo $follow_html;
|
602 |
+
}
|
603 |
+
|
604 |
function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
|
605 |
$options = get_option( 'addtoany_options' );
|
606 |
|
622 |
}
|
623 |
}
|
624 |
|
625 |
+
// Args are passed on to ADDTOANY_SHARE_SAVE_KIT
|
626 |
$defaults = array(
|
627 |
'linkname' => '',
|
628 |
'linkurl' => '',
|
1137 |
|
1138 |
add_filter( 'admin_menu', 'A2A_SHARE_SAVE_add_menu_link' );
|
1139 |
|
1140 |
+
function A2A_SHARE_SAVE_widgets_init() {
|
1141 |
global $A2A_SHARE_SAVE_plugin_dir;
|
1142 |
|
1143 |
+
include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.widgets.php' );
|
1144 |
register_widget( 'A2A_SHARE_SAVE_Widget' );
|
1145 |
+
register_widget( 'A2A_Follow_Widget' );
|
1146 |
}
|
1147 |
|
1148 |
+
add_action( 'widgets_init', 'A2A_SHARE_SAVE_widgets_init' );
|
1149 |
|
1150 |
// Place in Option List on Settings > Plugins page
|
1151 |
function A2A_SHARE_SAVE_actlinks( $links, $file ) {
|
addtoany.services.php
CHANGED
@@ -383,4 +383,82 @@ $A2A_SHARE_SAVE_services = array(
|
|
383 |
"icon" => "yummly",
|
384 |
),
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
);
|
383 |
"icon" => "yummly",
|
384 |
),
|
385 |
|
386 |
+
);
|
387 |
+
|
388 |
+
$A2A_FOLLOW_services = array(
|
389 |
+
'facebook' => array(
|
390 |
+
'name' => 'Facebook',
|
391 |
+
'href' => 'https://www.facebook.com/${id}',
|
392 |
+
'icon' => 'facebook',
|
393 |
+
),
|
394 |
+
'twitter' => array(
|
395 |
+
'name' => 'Twitter',
|
396 |
+
'href' => 'https://twitter.com/${id}',
|
397 |
+
'icon' => 'twitter',
|
398 |
+
),
|
399 |
+
'instagram' => array(
|
400 |
+
'name' => 'Instagram',
|
401 |
+
'href' => 'https://instagram.com/${id}',
|
402 |
+
'icon' => 'instagram',
|
403 |
+
),
|
404 |
+
'pinterest' => array(
|
405 |
+
'name' => 'Pinterest',
|
406 |
+
'href' => 'https://www.pinterest.com/${id}',
|
407 |
+
'icon' => 'pinterest',
|
408 |
+
),
|
409 |
+
'behance' => array(
|
410 |
+
'name' => 'Behance',
|
411 |
+
'href' => 'https://www.behance.net/${id}',
|
412 |
+
'icon' => 'behance',
|
413 |
+
),
|
414 |
+
'flickr' => array(
|
415 |
+
'name' => 'Flickr',
|
416 |
+
'href' => 'https://www.flickr.com/photos/${id}',
|
417 |
+
'icon' => 'flickr',
|
418 |
+
),
|
419 |
+
'foursquare' => array(
|
420 |
+
'name' => 'Foursquare',
|
421 |
+
'href' => 'https://foursquare.com/${id}',
|
422 |
+
'icon' => 'foursquare',
|
423 |
+
),
|
424 |
+
'google_plus' => array(
|
425 |
+
'name' => 'Google+',
|
426 |
+
'href' => 'https://plus.google.com/+${id}',
|
427 |
+
'icon' => 'google_plus',
|
428 |
+
),
|
429 |
+
'linkedin' => array(
|
430 |
+
'name' => 'LinkedIn',
|
431 |
+
'href' => 'https://www.linkedin.com/in/${id}',
|
432 |
+
'icon' => 'linkedin',
|
433 |
+
),
|
434 |
+
'linkedin_company' => array(
|
435 |
+
'name' => 'LinkedIn Company',
|
436 |
+
'href' => 'https://www.linkedin.com/company/${id}',
|
437 |
+
'icon' => 'linkedin',
|
438 |
+
),
|
439 |
+
'tumblr' => array(
|
440 |
+
'name' => 'Tumblr',
|
441 |
+
'href' => 'http://${id}.tumblr.com',
|
442 |
+
'icon' => 'tumblr',
|
443 |
+
),
|
444 |
+
'vimeo' => array(
|
445 |
+
'name' => 'Vimeo',
|
446 |
+
'href' => 'https://vimeo.com/${id}',
|
447 |
+
'icon' => 'vimeo',
|
448 |
+
),
|
449 |
+
'youtube' => array(
|
450 |
+
'name' => 'YouTube',
|
451 |
+
'href' => 'https://www.youtube.com/user/${id}',
|
452 |
+
'icon' => 'youtube',
|
453 |
+
),
|
454 |
+
'youtube_channel' => array(
|
455 |
+
'name' => 'YouTube Channel',
|
456 |
+
'href' => 'https://www.youtube.com/channel/${id}',
|
457 |
+
'icon' => 'youtube',
|
458 |
+
),
|
459 |
+
'feed' => array(
|
460 |
+
'name' => 'RSS Feed',
|
461 |
+
'href' => 'http://www.example.com/feed/',
|
462 |
+
'icon' => 'feed',
|
463 |
+
),
|
464 |
);
|
addtoany.widget.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* AddToAny WordPress Widget
|
5 |
-
*/
|
6 |
-
|
7 |
-
class A2A_SHARE_SAVE_Widget extends WP_Widget {
|
8 |
-
/** constructor */
|
9 |
-
function A2A_SHARE_SAVE_Widget() {
|
10 |
-
parent::WP_Widget('', 'AddToAny Sharing', array('description' => 'Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, StumbleUpon, Digg and many more.'), array('width' => 400));
|
11 |
-
}
|
12 |
-
|
13 |
-
/** Backwards compatibility for A2A_SHARE_SAVE_Widget::display(); usage */
|
14 |
-
function display( $args = false ) {
|
15 |
-
self::widget($args, NULL);
|
16 |
-
}
|
17 |
-
|
18 |
-
/** @see WP_Widget::widget */
|
19 |
-
function widget($args = array(), $instance) {
|
20 |
-
|
21 |
-
global $A2A_SHARE_SAVE_plugin_url_path;
|
22 |
-
|
23 |
-
$defaults = array(
|
24 |
-
'before_widget' => '',
|
25 |
-
'after_widget' => '',
|
26 |
-
'before_title' => '',
|
27 |
-
'after_title' => '',
|
28 |
-
);
|
29 |
-
|
30 |
-
$args = wp_parse_args( $args, $defaults );
|
31 |
-
extract( $args );
|
32 |
-
$title = apply_filters('widget_title', $instance['title']);
|
33 |
-
|
34 |
-
echo $before_widget;
|
35 |
-
|
36 |
-
if ($title) {
|
37 |
-
echo $before_title . $title . $after_title;
|
38 |
-
}
|
39 |
-
|
40 |
-
ADDTOANY_SHARE_SAVE_KIT(array(
|
41 |
-
"use_current_page" => TRUE
|
42 |
-
));
|
43 |
-
|
44 |
-
echo $after_widget;
|
45 |
-
}
|
46 |
-
|
47 |
-
/** @see WP_Widget::update */
|
48 |
-
function update($new_instance, $old_instance) {
|
49 |
-
$instance = $old_instance;
|
50 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
51 |
-
return $instance;
|
52 |
-
}
|
53 |
-
|
54 |
-
/** @see WP_Widget::form */
|
55 |
-
function form($instance) {
|
56 |
-
$title = (isset($instance) && isset($instance['title'])) ? esc_attr($instance['title']) : '';
|
57 |
-
?>
|
58 |
-
<p>
|
59 |
-
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
|
60 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
|
61 |
-
</p>
|
62 |
-
<p>
|
63 |
-
<a href="options-general.php?page=add-to-any.php"><?php _e("AddToAny Settings", "add-to-any"); ?>...</a>
|
64 |
-
</p>
|
65 |
-
<?php
|
66 |
-
}
|
67 |
-
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addtoany.widgets.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* AddToAny WordPress Widgets
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* AddToAny Share widget class
|
9 |
+
*
|
10 |
+
* @since add-to-any .9.9.8
|
11 |
+
*/
|
12 |
+
class A2A_SHARE_SAVE_Widget extends WP_Widget {
|
13 |
+
|
14 |
+
/** constructor */
|
15 |
+
function __construct() {
|
16 |
+
$widget_ops = array( 'description' => 'Share buttons for sharing your content.' );
|
17 |
+
parent::__construct( '', 'AddToAny Share', $widget_ops );
|
18 |
+
}
|
19 |
+
|
20 |
+
/** Backwards compatibility for A2A_SHARE_SAVE_Widget::display(); usage */
|
21 |
+
public function display( $args = false ) {
|
22 |
+
self::widget( $args, NULL );
|
23 |
+
}
|
24 |
+
|
25 |
+
/** @see WP_Widget::widget */
|
26 |
+
public function widget( $args = array(), $instance ) {
|
27 |
+
|
28 |
+
global $A2A_SHARE_SAVE_plugin_url_path;
|
29 |
+
|
30 |
+
$defaults = array(
|
31 |
+
'before_widget' => '',
|
32 |
+
'after_widget' => '',
|
33 |
+
'before_title' => '',
|
34 |
+
'after_title' => '',
|
35 |
+
);
|
36 |
+
|
37 |
+
$args = wp_parse_args( $args, $defaults );
|
38 |
+
extract( $args );
|
39 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
40 |
+
|
41 |
+
echo $before_widget;
|
42 |
+
|
43 |
+
if ( $title ) {
|
44 |
+
echo $before_title . $title . $after_title;
|
45 |
+
}
|
46 |
+
|
47 |
+
ADDTOANY_SHARE_SAVE_KIT( array(
|
48 |
+
"use_current_page" => true,
|
49 |
+
) );
|
50 |
+
|
51 |
+
echo $after_widget;
|
52 |
+
}
|
53 |
+
|
54 |
+
/** @see WP_Widget::update */
|
55 |
+
public function update( $new_instance, $old_instance ) {
|
56 |
+
$instance = $old_instance;
|
57 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
58 |
+
return $instance;
|
59 |
+
}
|
60 |
+
|
61 |
+
/** @see WP_Widget::form */
|
62 |
+
public function form( $instance ) {
|
63 |
+
$title = isset( $instance ) && ! empty( $instance['title'] ) ? __( $instance['title'] ) : '';
|
64 |
+
?>
|
65 |
+
<p>
|
66 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
67 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
68 |
+
</p>
|
69 |
+
<p>
|
70 |
+
<a href="options-general.php?page=add-to-any.php"><?php _e('AddToAny Settings', 'add-to-any'); ?>...</a>
|
71 |
+
</p>
|
72 |
+
<?php
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* AddToAny Follow widget class
|
79 |
+
*
|
80 |
+
* @since add-to-any 1.6
|
81 |
+
*/
|
82 |
+
class A2A_Follow_Widget extends WP_Widget {
|
83 |
+
|
84 |
+
/** constructor */
|
85 |
+
function __construct() {
|
86 |
+
$widget_ops = array( 'description' => 'Follow buttons link to your social media.' );
|
87 |
+
parent::__construct( '', 'AddToAny Follow', $widget_ops );
|
88 |
+
}
|
89 |
+
|
90 |
+
/** @see WP_Widget::widget */
|
91 |
+
public function widget( $args = array(), $instance ) {
|
92 |
+
|
93 |
+
global $A2A_SHARE_SAVE_plugin_url_path;
|
94 |
+
|
95 |
+
$defaults = array(
|
96 |
+
'before_widget' => '',
|
97 |
+
'after_widget' => '',
|
98 |
+
'before_title' => '',
|
99 |
+
'after_title' => '',
|
100 |
+
);
|
101 |
+
|
102 |
+
$args = wp_parse_args( $args, $defaults );
|
103 |
+
extract( $args );
|
104 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
105 |
+
|
106 |
+
echo $before_widget;
|
107 |
+
|
108 |
+
if ( $title ) {
|
109 |
+
echo $before_title . $title . $after_title;
|
110 |
+
}
|
111 |
+
|
112 |
+
$active_services = array();
|
113 |
+
|
114 |
+
// See which services have IDs set
|
115 |
+
$services = $this->get_follow_services();
|
116 |
+
foreach ( $services as $code => $service ) {
|
117 |
+
$code_id = $code . '_id';
|
118 |
+
if ( ! empty( $instance[ $code_id ] ) ) {
|
119 |
+
// Set ID value
|
120 |
+
$active_services[ $code ] = array( 'id' => $instance[ $code_id ] );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
ADDTOANY_FOLLOW_KIT( array(
|
125 |
+
'buttons' => $active_services,
|
126 |
+
) );
|
127 |
+
|
128 |
+
echo $after_widget;
|
129 |
+
}
|
130 |
+
|
131 |
+
/** @see WP_Widget::update */
|
132 |
+
public function update( $new_instance, $old_instance ) {
|
133 |
+
$instance = $old_instance;
|
134 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
135 |
+
|
136 |
+
// Accept service IDs
|
137 |
+
$services = $this->get_follow_services();
|
138 |
+
foreach ( $services as $code => $service ) {
|
139 |
+
$code_id = $code . '_id';
|
140 |
+
if ( isset( $new_instance[ $code_id ] ) ) {
|
141 |
+
$instance[ $code_id ] = strip_tags( $new_instance[ $code_id ] );
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
return $instance;
|
146 |
+
}
|
147 |
+
|
148 |
+
/** @see WP_Widget::form */
|
149 |
+
public function form( $instance ) {
|
150 |
+
$services = $this->get_follow_services();
|
151 |
+
|
152 |
+
$title = isset( $instance ) && ! empty( $instance['title'] ) ? __( $instance['title'] ) : '';
|
153 |
+
?>
|
154 |
+
<p>
|
155 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
156 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
157 |
+
</p>
|
158 |
+
<?php foreach ( $services as $code => $service ) :
|
159 |
+
$code_id = $code . '_id';
|
160 |
+
$id_value = ! empty( $instance[ $code_id ] ) ? $instance[ $code_id ] : '';
|
161 |
+
$label_text = 'feed' == $code ? sprintf( __('%s URL:'), $service['name'] ) : sprintf( __('%s ID:'), $service['name'] );
|
162 |
+
?>
|
163 |
+
<p>
|
164 |
+
<label for="<?php echo $this->get_field_id( $code_id ); ?>"><?php echo $label_text; ?></label>
|
165 |
+
<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 echo esc_attr( $id_value ); ?>">
|
166 |
+
<br>
|
167 |
+
<small><?php echo str_replace( '${id}', '<u>ID</u>', $service['href'] ); ?></small>
|
168 |
+
</p>
|
169 |
+
<?php endforeach; ?>
|
170 |
+
<p>
|
171 |
+
<a href="options-general.php?page=add-to-any.php"><?php _e('AddToAny Settings', 'add-to-any'); ?>...</a>
|
172 |
+
</p>
|
173 |
+
<?php
|
174 |
+
}
|
175 |
+
|
176 |
+
private function get_follow_services() {
|
177 |
+
global $A2A_FOLLOW_services;
|
178 |
+
|
179 |
+
// Make available services extensible via plugins, themes (functions.php), etc.
|
180 |
+
$services = apply_filters( 'A2A_FOLLOW_services', $A2A_FOLLOW_services );
|
181 |
+
$services = ( is_array( $services ) ) ? $services : array();
|
182 |
+
|
183 |
+
return $services;
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|