AddToAny Share Buttons - Version 1.7.18

Version Description

  • New icon color options in AddToAny settings
  • New background color options for floating bars
  • The background for floating bars now defaults to transparent
  • Add a tip for AddToAny Follow buttons (Instagram, YouTube, Snapchat, etc.) in Add/Remove Services
  • Update YouTube icon
Download this release

Release Info

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

Code changes from version 1.7.17 to 1.7.18

Files changed (4) hide show
  1. README.txt +33 -21
  2. add-to-any.php +29 -6
  3. addtoany.admin.php +203 -106
  4. addtoany.services.php +2 -2
README.txt CHANGED
@@ -3,15 +3,15 @@ Contributors: micropat, addtoany
3
  Tags: AddToAny, share, sharing, social, share buttons, share button, social media, media, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed, icons
4
  Requires at least: 3.7
5
  Tested up to: 4.8
6
- Stable tag: 1.7.17
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
10
  == Description ==
11
 
12
- The AddToAny WordPress sharing plugin helps people share your posts and pages to any service, such as Facebook, Twitter, Pinterest, Google, WhatsApp, LinkedIn, Tumblr, Reddit, and over 100 more sharing and social media sites & apps.
13
 
14
- AddToAny is the universal sharing platform, and AddToAny's plugin is the most popular share plugin for WordPress, making sites social media ready since 2006.
15
 
16
  = Share Buttons & Follow Buttons =
17
 
@@ -20,13 +20,11 @@ AddToAny is the universal sharing platform, and AddToAny's plugin is the most po
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
26
 
27
- <a href="https://www.addtoany.com/">Share Buttons</a> demo
28
-
29
- = Custom Placement =
30
  * Before content, after content, or before & after content
31
  * Vertical Floating Share Bar, and Horizontal Floating Share Bar
32
  * As a shortcode, or a widget within a theme's layout
@@ -35,19 +33,19 @@ AddToAny is the universal sharing platform, and AddToAny's plugin is the most po
35
  = Analytics Integration =
36
 
37
  * Automatic Google Analytics integration (<a href="https://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
38
- * Track shared links with Bitly, Google URL Shortener, and custom URL shorteners
39
  * Display share counts on posts and pages
40
 
41
  = WordPress Optimized =
42
 
43
  * Loads asynchronously so your content always loads before or in parallel with AddToAny
44
  * Supports theme features such as HTML5, widgets, infinite scroll, post formats
45
- * Supports WooCommerce, multilingual sites, and multisite networks
46
  * No signup, no login, no account necessary
47
 
48
  = Mobile Optimized & Retina Ready =
49
 
50
- * AddToAny gives users the choice in sharing from a service's native app or from a web app. For example, choose between Twitter's native app or Twitter's mobile web app
51
  * Responsive Floating Share Buttons are mobile ready by default, and configurable breakpoints make floating buttons work with any theme
52
  * AddToAny's SVG icons are super-lightweight and pixel-perfect at any size, and AddToAny's responsive share menu fits on all displays
53
  * Automatic <a href="https://wordpress.org/plugins/amp/">AMP</a> (Accelerated Mobile Pages) support for social share buttons on AMP pages
@@ -56,25 +54,25 @@ AddToAny is the universal sharing platform, and AddToAny's plugin is the most po
56
 
57
  * Choose exactly where you want AddToAny to appear
58
  * Easily <a href="https://www.addtoany.com/buttons/customize/wordpress">customize sharing</a> on your WordPress site
59
- * <a href="/plugins/add-to-any/faq/">Highly extensible</a> for developers and designers
60
- * Custom icons let you use any icons at any location (media uploads directory, CDN, etc.)
61
  * Many more publisher and user features
62
 
63
  = Wide Support =
64
 
65
  * Over 10 years of development
66
- * Over 6 million downloads
67
  * Translated into dozens of languages
68
  * Ongoing support from the community
69
 
70
- This plugin always strives to be the best WordPress plugin for sharing. Development is fueled by your praise and feedback.
71
 
72
  <a href="https://www.addtoany.com/share#url=https%3A%2F%2Fwordpress.org%2Fplugins%2Fadd-to-any%2F&title=AddToAny%20Sharing%20Plugin%20for%20WordPress" title="Share">Share</a> this plugin
73
 
74
  See also:
75
 
76
  * The <a href="https://www.addtoany.com/buttons/">share buttons</a> for all platforms
77
- * The <a href="https://www.addtoany.com/buttons/for/wordpress_com">share button for WordPress.com</a>
78
 
79
  <a href="https://www.addtoany.com/blog/">AddToAny Blog</a> | <a href="https://www.addtoany.com/privacy">Privacy Policy</a>
80
 
@@ -131,9 +129,9 @@ Display specific share buttons by specifying comma-separated <a href="https://ww
131
 
132
  `[addtoany buttons="facebook,twitter,google_plus"]`
133
 
134
- Share a specific image or video to certain services that accept arbitrary media (Pinterest, Yummly):
135
 
136
- `[addtoany buttons="pinterest,yummly" media="https://www.example.com/media/picture.jpg"]`
137
 
138
  = For Facebook sharing, how can I set the thumbnail image and description Facebook uses? =
139
 
@@ -149,6 +147,10 @@ For more technical information on setting your pages up for Facebook sharing, se
149
 
150
  Since 2006, AddToAny is trusted across the web to always route to each service's current endpoint. This routing enables publisher customization, visitor personalization, and keeps the AddToAny plugin remarkably lightweight without the need for constant plugin updates. In AddToAny menus, visitors see the services they actually use. On mobile, AddToAny presents the choice of sharing to a service's native app or mobile site and the preference is used on the next share. Publishers take advantage of AddToAny services such as <a href="https://www.addtoany.com/buttons/customize/wordpress/email_template">email templates</a>, <a href="https://www.addtoany.com/buttons/customize/wordpress/twitter_message">Twitter templates</a>, <a href="https://www.addtoany.com/buttons/customize/wordpress/link_tracking">URL shortener & parameters</a>, and more. Just as service icons change, service endpoints change too, and AddToAny is updated daily to reflect service endpoint and API changes.
151
 
 
 
 
 
152
  = How can I use custom icons? =
153
 
154
  Upload sharing icons in a single directory to a public location, and make sure the icon filenames match the icon filenames packaged in the AddToAny plugin. In WordPress, go to `Settings` > `AddToAny` > `Advanced Options` > check the "Use custom icons" checkbox and specify the URL to your custom icons directory (including the trailing `/`). For AddToAny's universal button, go to Universal Button, select `Image URL` and specify the exact location of your AddToAny universal share icon (including the filename).
@@ -216,7 +218,7 @@ See the [supported follow services](https://www.addtoany.com/buttons/customize/f
216
  ) );
217
  } ?>`
218
 
219
- = How can I add a custom standalone share button? =
220
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
221
 
222
  `function addtoany_add_share_services( $services ) {
@@ -240,7 +242,7 @@ You can create a plugin or customize the following example PHP code to add to yo
240
  'icon_url' => 'https://www.example.com/my-icon.svg',
241
  'icon_width' => 32,
242
  'icon_height' => 32,
243
- 'href' => 'https://www.example.com/ID',
244
  );
245
  return $services;
246
  }
@@ -349,6 +351,13 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
349
 
350
  == Changelog ==
351
 
 
 
 
 
 
 
 
352
  = 1.7.17 =
353
  * Add Threema
354
  * Add Houzz
@@ -903,6 +912,9 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
903
 
904
  == Upgrade Notice ==
905
 
 
 
 
906
  = 1.7.13 =
907
  For [WooCommerce](https://woocommerce.com/) sites, the default standard placement for share buttons has moved from the product description to after the product meta block. You can customize exactly where share buttons display by [editing](https://docs.woocommerce.com/document/editing-projects-templates-safely/) your `share.php` Single Product Share template.
908
 
3
  Tags: AddToAny, share, sharing, social, share buttons, share button, social media, media, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed, icons
4
  Requires at least: 3.7
5
  Tested up to: 4.8
6
+ Stable tag: 1.7.18
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
10
  == Description ==
11
 
12
+ The AddToAny sharing plugin for WordPress increases traffic & engagement by helping people share your posts and pages to any service. Services include Facebook, Twitter, Pinterest, Google, WhatsApp, LinkedIn, Tumblr, Reddit, and over 100 more sharing and social media sites & apps.
13
 
14
+ AddToAny is the universal sharing platform, and the AddToAny plugin is the most popular share plugin for WordPress, making sites social media ready since 2006.
15
 
16
  = Share Buttons & Follow Buttons =
17
 
20
  * **Vector** share & follow buttons (SVG icons)
21
  * **Universal** Share Button and Smart Menu
22
  * Individual share links and custom share icons
23
+ * Official buttons including the Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button and Google +1 Button
24
+ * Universal email sharing makes it easy to share via Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web or native apps
25
+ * <a href="https://www.addtoany.com/">Share Buttons</a> demo
26
 
27
+ = Custom Placement & Appearance =
 
 
28
  * Before content, after content, or before & after content
29
  * Vertical Floating Share Bar, and Horizontal Floating Share Bar
30
  * As a shortcode, or a widget within a theme's layout
33
  = Analytics Integration =
34
 
35
  * Automatic Google Analytics integration (<a href="https://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
36
+ * Track shared links with Bitly, the Google URL Shortener, and custom URL shorteners
37
  * Display share counts on posts and pages
38
 
39
  = WordPress Optimized =
40
 
41
  * Loads asynchronously so your content always loads before or in parallel with AddToAny
42
  * Supports theme features such as HTML5, widgets, infinite scroll, post formats
43
+ * Supports WooCommerce, multilingual sites, multisite networks, and accessibility standards
44
  * No signup, no login, no account necessary
45
 
46
  = Mobile Optimized & Retina Ready =
47
 
48
+ * AddToAny gives users the choice in sharing from a service's native app or from a web app
49
  * Responsive Floating Share Buttons are mobile ready by default, and configurable breakpoints make floating buttons work with any theme
50
  * AddToAny's SVG icons are super-lightweight and pixel-perfect at any size, and AddToAny's responsive share menu fits on all displays
51
  * Automatic <a href="https://wordpress.org/plugins/amp/">AMP</a> (Accelerated Mobile Pages) support for social share buttons on AMP pages
54
 
55
  * Choose exactly where you want AddToAny to appear
56
  * Easily <a href="https://www.addtoany.com/buttons/customize/wordpress">customize sharing</a> on your WordPress site
57
+ * <a href="https://wordpress.org/plugins/add-to-any/#faq">Highly extensible</a> for developers and designers
58
+ * Custom icons let you use any icons from any location (media uploads directory, CDN, etc.)
59
  * Many more publisher and user features
60
 
61
  = Wide Support =
62
 
63
  * Over 10 years of development
64
+ * Over 7 million downloads
65
  * Translated into dozens of languages
66
  * Ongoing support from the community
67
 
68
+ This plugin always strives to be the best WordPress plugin for sharing. Development is fueled by your kind words and feedback.
69
 
70
  <a href="https://www.addtoany.com/share#url=https%3A%2F%2Fwordpress.org%2Fplugins%2Fadd-to-any%2F&title=AddToAny%20Sharing%20Plugin%20for%20WordPress" title="Share">Share</a> this plugin
71
 
72
  See also:
73
 
74
  * The <a href="https://www.addtoany.com/buttons/">share buttons</a> for all platforms
75
+ * The <a href="https://www.addtoany.com/buttons/for/wordpress_com">share buttons for WordPress.com</a>
76
 
77
  <a href="https://www.addtoany.com/blog/">AddToAny Blog</a> | <a href="https://www.addtoany.com/privacy">Privacy Policy</a>
78
 
129
 
130
  `[addtoany buttons="facebook,twitter,google_plus"]`
131
 
132
+ Share a specific image or video to certain services that accept arbitrary media (Pinterest, Yummly, Houzz, Polyvore):
133
 
134
+ `[addtoany buttons="pinterest,yummly,houzz,polyvore" media="https://www.example.com/media/picture.jpg"]`
135
 
136
  = For Facebook sharing, how can I set the thumbnail image and description Facebook uses? =
137
 
147
 
148
  Since 2006, AddToAny is trusted across the web to always route to each service's current endpoint. This routing enables publisher customization, visitor personalization, and keeps the AddToAny plugin remarkably lightweight without the need for constant plugin updates. In AddToAny menus, visitors see the services they actually use. On mobile, AddToAny presents the choice of sharing to a service's native app or mobile site and the preference is used on the next share. Publishers take advantage of AddToAny services such as <a href="https://www.addtoany.com/buttons/customize/wordpress/email_template">email templates</a>, <a href="https://www.addtoany.com/buttons/customize/wordpress/twitter_message">Twitter templates</a>, <a href="https://www.addtoany.com/buttons/customize/wordpress/link_tracking">URL shortener & parameters</a>, and more. Just as service icons change, service endpoints change too, and AddToAny is updated daily to reflect service endpoint and API changes.
149
 
150
+ = Where are buttons such as Instagram, YouTube, Snapchat? =
151
+
152
+ Configure your social media profile links by adding the "AddToAny Follow" widget in Appearance > Customize or Appearance > Widgets.
153
+
154
  = How can I use custom icons? =
155
 
156
  Upload sharing icons in a single directory to a public location, and make sure the icon filenames match the icon filenames packaged in the AddToAny plugin. In WordPress, go to `Settings` > `AddToAny` > `Advanced Options` > check the "Use custom icons" checkbox and specify the URL to your custom icons directory (including the trailing `/`). For AddToAny's universal button, go to Universal Button, select `Image URL` and specify the exact location of your AddToAny universal share icon (including the filename).
218
  ) );
219
  } ?>`
220
 
221
+ = How can I add a custom share button? =
222
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
223
 
224
  `function addtoany_add_share_services( $services ) {
242
  'icon_url' => 'https://www.example.com/my-icon.svg',
243
  'icon_width' => 32,
244
  'icon_height' => 32,
245
+ 'href' => 'https://www.example.com/${id}',
246
  );
247
  return $services;
248
  }
351
 
352
  == Changelog ==
353
 
354
+ = 1.7.18 =
355
+ * New icon color options in AddToAny settings
356
+ * New background color options for floating bars
357
+ * The background for floating bars now defaults to `transparent`
358
+ * Add a tip for AddToAny Follow buttons (Instagram, YouTube, Snapchat, etc.) in Add/Remove Services
359
+ * Update YouTube icon
360
+
361
  = 1.7.17 =
362
  * Add Threema
363
  * Add Houzz
912
 
913
  == Upgrade Notice ==
914
 
915
+ = 1.7.18 =
916
+ * The background for floating bars now defaults to `transparent`. You can change the background for your floating bars in the "Floating" tab of Settings > AddToAny.
917
+
918
  = 1.7.13 =
919
  For [WooCommerce](https://woocommerce.com/) sites, the default standard placement for share buttons has moved from the product description to after the product meta block. You can customize exactly where share buttons display by [editing](https://docs.woocommerce.com/document/editing-projects-templates-safely/) your `share.php` Single Product Share template.
920
 
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.17
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -684,6 +684,12 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
684
  } elseif ( 'right_docked' === $vertical_type ) {
685
  $vertical_args['kit_style'] = 'right:' . $offset . ';top:' . $position . ';';
686
  }
 
 
 
 
 
 
687
 
688
  $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $vertical_args );
689
  }
@@ -709,6 +715,12 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
709
  } elseif ( 'right_docked' === $horizontal_type ) {
710
  $horizontal_args['kit_style'] = 'bottom:' . $offset . ';right:' . $position . ';';
711
  }
 
 
 
 
 
 
712
 
713
  $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $horizontal_args );
714
  }
@@ -736,18 +748,29 @@ function A2A_SHARE_SAVE_head_script() {
736
  $upload_dir = wp_upload_dir();
737
  $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu';
738
 
 
 
 
 
 
 
 
 
 
 
739
  // Enternal script call + initial JS + set-once variables
740
  $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
741
  $script_configs = ( ( $cache ) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
742
- . ( ( isset( $options['onclick'] ) && '1' == $options['onclick'] ) ? "\n" . 'a2a_config.onclick=1;' : '' )
743
- . ( ( $additional_js ) ? "\n" . stripslashes( $additional_js ) : '' );
 
744
  $A2A_SHARE_SAVE_external_script_called = true;
745
 
746
  $javascript_header = "\n" . '<script type="text/javascript">' . "\n"
747
 
748
- . "var a2a_config=a2a_config||{};"
749
- . "a2a_config.callbacks=a2a_config.callbacks||[];"
750
- . "a2a_config.templates=a2a_config.templates||{};"
751
  . A2A_menu_locale()
752
  . $script_configs
753
 
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.18
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
684
  } elseif ( 'right_docked' === $vertical_type ) {
685
  $vertical_args['kit_style'] = 'right:' . $offset . ';top:' . $position . ';';
686
  }
687
+ // Background color
688
+ if ( ! empty( $options['floating_vertical_bg'] ) && 'custom' === $options['floating_vertical_bg'] ) {
689
+ $vertical_args['kit_style'] .= ! empty( $options['floating_vertical_bg_color'] ) ? 'background-color:' . $options['floating_vertical_bg_color'] . ';' : '';
690
+ } else {
691
+ $vertical_args['kit_style'] .= 'background-color:transparent;';
692
+ }
693
 
694
  $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $vertical_args );
695
  }
715
  } elseif ( 'right_docked' === $horizontal_type ) {
716
  $horizontal_args['kit_style'] = 'bottom:' . $offset . ';right:' . $position . ';';
717
  }
718
+ // Background color
719
+ if ( ! empty( $options['floating_horizontal_bg'] ) && 'custom' === $options['floating_horizontal_bg'] ) {
720
+ $horizontal_args['kit_style'] .= ! empty( $options['floating_horizontal_bg_color'] ) ? 'background-color:' . $options['floating_horizontal_bg_color'] . ';' : '';
721
+ } else {
722
+ $horizontal_args['kit_style'] .= 'background-color:transparent;';
723
+ }
724
 
725
  $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $horizontal_args );
726
  }
748
  $upload_dir = wp_upload_dir();
749
  $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu';
750
 
751
+ // Icon colors
752
+ $icon_bg = ! empty( $options['icon_bg'] ) && in_array( $options['icon_bg'], array( 'custom', 'transparent' ) ) ? $options['icon_bg'] : false;
753
+ $icon_bg_color = 'custom' === $icon_bg && ! empty( $options['icon_bg_color'] ) ? $options['icon_bg_color'] : '';
754
+ $icon_bg_color = 'transparent' === $icon_bg ? 'transparent' : $icon_bg_color;
755
+ $icon_fg = ! empty( $options['icon_fg'] ) && 'custom' === $options['icon_fg'] ? true : false;
756
+ $icon_fg_color = $icon_fg && ! empty( $options['icon_fg_color'] ) ? ',' . $options['icon_fg_color'] : '';
757
+ // Use "unset" keyword for background if only the foreground is set
758
+ $icon_bg_color = empty( $icon_bg_color ) && ! empty( $icon_fg_color ) ? 'unset' : $icon_bg_color;
759
+ $icon_color = $icon_bg_color . $icon_fg_color;
760
+
761
  // Enternal script call + initial JS + set-once variables
762
  $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
763
  $script_configs = ( ( $cache ) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
764
+ . ( $icon_color ? "\n" . 'a2a_config.icon_color="' . $icon_color . '";' : '' )
765
+ . ( isset( $options['onclick'] ) && '1' == $options['onclick'] ? "\n" . 'a2a_config.onclick=1;' : '' )
766
+ . ( $additional_js ? "\n" . stripslashes( $additional_js ) : '' );
767
  $A2A_SHARE_SAVE_external_script_called = true;
768
 
769
  $javascript_header = "\n" . '<script type="text/javascript">' . "\n"
770
 
771
+ . 'var a2a_config=a2a_config||{};'
772
+ . 'a2a_config.callbacks=a2a_config.callbacks||[];'
773
+ . 'a2a_config.templates=a2a_config.templates||{};'
774
  . A2A_menu_locale()
775
  . $script_configs
776
 
addtoany.admin.php CHANGED
@@ -71,52 +71,45 @@ add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' );
71
  add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' );
72
 
73
  /**
74
- * Adds a WordPress pointer to Settings menu, so user knows where to configure AddToAny
75
  */
76
  function A2A_SHARE_SAVE_enqueue_pointer_script_style( $hook_suffix ) {
77
-
78
- // Requires WP 3.3
79
- if ( get_bloginfo( 'version' ) < '3.3' ) {
80
  return;
81
  }
82
-
83
- // Assume pointer shouldn't be shown
84
- $enqueue_pointer_script_style = false;
85
 
86
  // Get array list of dismissed pointers for current user and convert it to array
87
  $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
88
 
89
- // Check if our pointer is not among dismissed ones
90
- if ( !in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) {
91
- $enqueue_pointer_script_style = true;
 
 
 
 
92
 
93
  // Add footer scripts using callback function
94
  add_action( 'admin_print_footer_scripts', 'A2A_SHARE_SAVE_pointer_print_scripts' );
95
- }
96
-
97
- // Enqueue pointer CSS and JS files, if needed
98
- if ( $enqueue_pointer_script_style ) {
99
- wp_enqueue_style( 'wp-pointer' );
100
- wp_enqueue_script( 'wp-pointer' );
101
- }
102
-
103
- }
104
- if ( ! $A2A_SHARE_SAVE_options ) {
105
- // Only show the pointer when no AddToAny options have been set
106
- add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' );
107
  }
108
 
109
- function A2A_SHARE_SAVE_pointer_print_scripts() {
110
 
111
- $pointer_content = '<h3>AddToAny Sharing Settings</h3>';
112
- $pointer_content .= '<p>To customize your AddToAny share buttons, click &quot;AddToAny&quot; in the Settings menu.</p>';
 
 
 
 
113
  ?>
114
 
115
- <script type="text/javascript">
116
- //<![CDATA[
117
  jQuery(document).ready( function($) {
118
  $('#menu-settings').pointer({
119
- content: '<?php echo $pointer_content; ?>',
120
  position: {
121
  edge: 'left', // arrow direction
122
  align: 'center' // vertical alignment
@@ -130,12 +123,66 @@ function A2A_SHARE_SAVE_pointer_print_scripts() {
130
  }
131
  }).pointer('open');
132
  });
133
- //]]>
134
  </script>
135
 
136
  <?php
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  function A2A_SHARE_SAVE_options_page() {
140
 
141
  global $A2A_SHARE_SAVE_plugin_url_path,
@@ -169,31 +216,6 @@ function A2A_SHARE_SAVE_options_page() {
169
  $new_options['floating_vertical'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_vertical'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_vertical'] : 'none';
170
  $new_options['floating_horizontal'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_horizontal'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal'] : 'none';
171
 
172
- $new_options['floating_vertical_position'] = (
173
- isset( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] ) &&
174
- is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] )
175
- ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_position'] : '100';
176
-
177
- $new_options['floating_vertical_offset'] = (
178
- isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
179
- is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] )
180
- ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] : '0';
181
-
182
- $new_options['floating_vertical_responsive'] = (
183
- isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive'] ) &&
184
- '1' == $_POST['A2A_SHARE_SAVE_floating_vertical_responsive']
185
- ) ? '1' : '-1';
186
-
187
- $new_options['floating_vertical_responsive_max_width'] = (
188
- isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] ) &&
189
- is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] )
190
- ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] : '980';
191
-
192
- $new_options['floating_vertical_icon_size'] = (
193
- isset( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] ) &&
194
- is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] )
195
- ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] : '32';
196
-
197
  $new_options['floating_horizontal_position'] = (
198
  isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] ) &&
199
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] )
@@ -220,6 +242,37 @@ function A2A_SHARE_SAVE_options_page() {
220
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] )
221
  ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] : '32';
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  } else {
224
  // Standard options screen
225
 
@@ -233,6 +286,10 @@ function A2A_SHARE_SAVE_options_page() {
233
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
234
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
235
  $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
 
 
 
 
236
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
237
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
238
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
@@ -325,46 +382,6 @@ function A2A_SHARE_SAVE_options_page() {
325
 
326
  $options = get_option( 'addtoany_options', array() );
327
 
328
- function position_in_content( $options, $option_box = false ) {
329
-
330
- if ( ! isset( $options['position'] ) ) {
331
- $options['position'] = 'bottom';
332
- }
333
-
334
- $positions = array(
335
- 'bottom' => array(
336
- 'selected' => ( 'bottom' == $options['position'] ) ? ' selected="selected"' : '',
337
- 'string' => __( 'bottom', 'add-to-any' )
338
- ),
339
- 'top' => array(
340
- 'selected' => ( 'top' == $options['position'] ) ? ' selected="selected"' : '',
341
- 'string' => __( 'top', 'add-to-any' )
342
- ),
343
- 'both' => array(
344
- 'selected' => ( 'both' == $options['position'] ) ? ' selected="selected"' : '',
345
- 'string' => __( 'top &amp; bottom', 'add-to-any' )
346
- )
347
- );
348
-
349
- if ( $option_box ) {
350
- $html = '</label>';
351
- $html .= '<label>'; // Label needed to prevent checkmark toggle on SELECT click
352
- $html .= '<select name="A2A_SHARE_SAVE_position">';
353
- $html .= '<option value="bottom"' . $positions['bottom']['selected'] . '>' . $positions['bottom']['string'] . '</option>';
354
- $html .= '<option value="top"' . $positions['top']['selected'] . '>' . $positions['top']['string'] . '</option>';
355
- $html .= '<option value="both"' . $positions['both']['selected'] . '>' . $positions['both']['string'] . '</option>';
356
- $html .= '</select>';
357
-
358
- return $html;
359
- } else {
360
- $html = '<span class="A2A_SHARE_SAVE_position">';
361
- $html .= $positions[$options['position']]['string'];
362
- $html .= '</span>';
363
-
364
- return $html;
365
- }
366
- }
367
-
368
  ?>
369
 
370
  <div class="wrap">
@@ -384,14 +401,34 @@ function A2A_SHARE_SAVE_options_page() {
384
 
385
  <?php if ( 'default' == $current_screen ) : ?>
386
  <tr valign="top">
387
- <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
388
  <td><fieldset>
389
  <label><input class="small-text" name="A2A_SHARE_SAVE_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo ! empty( $options['icon_size'] ) ? $options['icon_size'] : '32'; ?>"> pixels</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  </fieldset></td>
391
  </tr>
392
 
393
  <tr valign="top">
394
- <th scope="row"><?php _e("Standalone Buttons", 'add-to-any'); ?></th>
395
  <td><fieldset>
396
  <ul id="addtoany_services_sortable" class="addtoany_admin_list addtoany_override">
397
  <li class="dummy"><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/transparent.gif" width="32" height="32" alt="" /></li>
@@ -433,6 +470,14 @@ function A2A_SHARE_SAVE_options_page() {
433
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/pinterest_pin_2x.png'; ?>" width="80" height="40" alt="Pinterest Pin It" />
434
  </li>
435
  </ul>
 
 
 
 
 
 
 
 
436
  </fieldset></td>
437
  </tr>
438
 
@@ -488,7 +533,7 @@ function A2A_SHARE_SAVE_options_page() {
488
  <label>
489
  <input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php
490
  if ( ! isset( $options['display_in_posts'] ) || $options['display_in_posts'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
491
- <?php printf(__('Display at the %s of posts', 'add-to-any'), position_in_content( $options, true )); ?>
492
  </label>
493
  <br/>
494
  <label>
@@ -496,7 +541,7 @@ function A2A_SHARE_SAVE_options_page() {
496
  if ( ! isset( $options['display_in_posts_on_front_page'] ) || $options['display_in_posts_on_front_page'] != '-1' ) echo ' checked="checked"';
497
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
498
  ?> value="1"/>
499
- <?php printf(__('Display at the %s of posts on the front page', 'add-to-any'), position_in_content( $options )); ?>
500
  </label>
501
  <br/>
502
  <label>
@@ -504,7 +549,7 @@ function A2A_SHARE_SAVE_options_page() {
504
  if ( ! isset( $options['display_in_posts_on_archive_pages'] ) || $options['display_in_posts_on_archive_pages'] != '-1' ) echo ' checked="checked"';
505
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
506
  ?> value="1"/>
507
- <?php printf(__('Display at the %s of posts on archive pages', 'add-to-any'), position_in_content( $options )); ?>
508
  </label>
509
  <br/>
510
  <label>
@@ -512,26 +557,26 @@ function A2A_SHARE_SAVE_options_page() {
512
  if ( ! isset( $options['display_in_feed'] ) || $options['display_in_feed'] != '-1' ) echo ' checked="checked"';
513
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
514
  ?> value="1"/>
515
- <?php printf(__('Display at the %s of posts in the feed', 'add-to-any'), position_in_content( $options )); ?>
516
  </label>
517
  <br/>
518
  <label>
519
  <input name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php
520
  if ( ! isset( $options['display_in_excerpts'] ) || $options['display_in_excerpts'] != '-1' ) echo ' checked="checked"';
521
  ?> value="1"/>
522
- <?php printf(__('Display at the %s of excerpts', 'add-to-any'), position_in_content( $options, false )); ?>
523
  </label>
524
  <br/>
525
  <label>
526
  <input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
527
- <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content( $options, false )); ?>
528
  </label>
529
  <br/>
530
  <label>
531
  <input name="A2A_SHARE_SAVE_display_in_attachments" type="checkbox"<?php
532
  if ( ! isset( $options['display_in_attachments'] ) || $options['display_in_attachments'] != '-1' ) echo ' checked="checked"';
533
  ?> value="1"/>
534
- <?php printf(__('Display at the %s of media pages', 'add-to-any'), position_in_content( $options, false )); ?>
535
  </label>
536
 
537
  <?php
@@ -543,7 +588,7 @@ function A2A_SHARE_SAVE_options_page() {
543
  <br/>
544
  <label>
545
  <input name="A2A_SHARE_SAVE_display_in_cpt_<?php echo $placement_name; ?>" type="checkbox"<?php if ( ! isset( $options['display_in_cpt_' . $placement_name] ) || $options['display_in_cpt_' . $placement_name] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
546
- <?php printf(__('Display at the %s of %s', 'add-to-any'), position_in_content( $options, false ), esc_html( $placement_label ) ); ?>
547
  </label>
548
  <?php endforeach; ?>
549
 
@@ -684,6 +729,18 @@ function A2A_SHARE_SAVE_options_page() {
684
  <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
685
  </fieldset></td>
686
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
687
  </table>
688
 
689
  <h3><?php _e('Horizontal Buttons', 'add-to-any'); ?></h3>
@@ -726,6 +783,18 @@ function A2A_SHARE_SAVE_options_page() {
726
  <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
727
  </fieldset></td>
728
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
729
  </table>
730
 
731
  <?php endif; ?>
@@ -768,6 +837,28 @@ function A2A_SHARE_SAVE_admin_head() {
768
  <script type="text/javascript"><!--
769
  jQuery(document).ready(function(){
770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
  // Toggle child options of 'Display in posts'
772
  jQuery('#A2A_SHARE_SAVE_display_in_posts').bind('change click', function(e){
773
  if (jQuery(this).is(':checked'))
@@ -979,7 +1070,7 @@ function A2A_SHARE_SAVE_admin_head() {
979
  // Add/Remove Services button
980
  jQuery('#addtoany_services_sortable .dummy:first').after('<li id="addtoany_show_services"><?php _e('Add/Remove Services', 'add-to-any'); ?> &#187;</li>');
981
  jQuery('#addtoany_show_services').click(function(e) {
982
- jQuery('#addtoany_services_selectable, #addtoany_services_info').slideDown('fast');
983
  jQuery(this).fadeOut('fast');
984
  });
985
 
@@ -1003,6 +1094,8 @@ function A2A_SHARE_SAVE_admin_head() {
1003
  --></script>
1004
 
1005
  <style type="text/css">
 
 
1006
  .ui-sortable-placeholder{background-color:transparent;border:1px dashed #CCC !important;}
1007
  .addtoany_admin_list{list-style:none;padding:0;margin:0;}
1008
  .addtoany_admin_list li{border-radius:6px;}
@@ -1029,7 +1122,9 @@ function A2A_SHARE_SAVE_admin_head() {
1029
 
1030
  li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;line-height:32px;margin-left:9px;}
1031
  li#addtoany_show_services:hover{border:1px solid #CCC;}
1032
- #addtoany_services_info{clear:left;display:none;margin:10px;}
 
 
1033
 
1034
  /* No outline during ARIA focus */
1035
  .addtoany_extra_section {
@@ -1073,4 +1168,6 @@ add_filter( 'admin_head', 'A2A_SHARE_SAVE_admin_head' );
1073
 
1074
  function A2A_SHARE_SAVE_scripts() {
1075
  wp_enqueue_script( 'jquery-ui-sortable' );
 
 
1076
  }
71
  add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' );
72
 
73
  /**
74
+ * Adds feature pointers
75
  */
76
  function A2A_SHARE_SAVE_enqueue_pointer_script_style( $hook_suffix ) {
77
+ // Return if AddToAny options have been set, or WP < 3.3
78
+ if ( ! empty( get_option( 'addtoany_options', array() ) ) || get_bloginfo( 'version' ) < '3.3' ) {
 
79
  return;
80
  }
 
 
 
81
 
82
  // Get array list of dismissed pointers for current user and convert it to array
83
  $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
84
 
85
+ // If any one of our pointers is not among dismissed pointers
86
+ if (
87
+ ! in_array( 'addtoany_settings_pointer', $dismissed_pointers )
88
+ ) {
89
+ // Enqueue pointer CSS and JS files, if needed
90
+ wp_enqueue_style( 'wp-pointer' );
91
+ wp_enqueue_script( 'wp-pointer' );
92
 
93
  // Add footer scripts using callback function
94
  add_action( 'admin_print_footer_scripts', 'A2A_SHARE_SAVE_pointer_print_scripts' );
95
+ }
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
+ add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' );
99
 
100
+ function A2A_SHARE_SAVE_pointer_print_scripts() {
101
+ $pointer_content_settings = '<h3>AddToAny Sharing Settings</h3>';
102
+ $pointer_content_settings .= '<p>To customize your AddToAny share buttons, click &quot;AddToAny&quot; in the Settings menu.</p>';
103
+
104
+ // Get array list of dismissed pointers for current user and convert it to array
105
+ $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
106
  ?>
107
 
108
+ <script>
109
+ <?php if ( ! in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) : ?>
110
  jQuery(document).ready( function($) {
111
  $('#menu-settings').pointer({
112
+ content: '<?php echo $pointer_content_settings; ?>',
113
  position: {
114
  edge: 'left', // arrow direction
115
  align: 'center' // vertical alignment
123
  }
124
  }).pointer('open');
125
  });
126
+ <?php endif; ?>
127
  </script>
128
 
129
  <?php
130
  }
131
 
132
+ function _a2a_position_in_content( $options, $option_box = false ) {
133
+
134
+ if ( ! isset( $options['position'] ) ) {
135
+ $options['position'] = 'bottom';
136
+ }
137
+
138
+ $positions = array(
139
+ 'bottom' => array(
140
+ 'selected' => ( 'bottom' == $options['position'] ) ? ' selected="selected"' : '',
141
+ 'string' => __( 'bottom', 'add-to-any' )
142
+ ),
143
+ 'top' => array(
144
+ 'selected' => ( 'top' == $options['position'] ) ? ' selected="selected"' : '',
145
+ 'string' => __( 'top', 'add-to-any' )
146
+ ),
147
+ 'both' => array(
148
+ 'selected' => ( 'both' == $options['position'] ) ? ' selected="selected"' : '',
149
+ 'string' => __( 'top &amp; bottom', 'add-to-any' )
150
+ )
151
+ );
152
+
153
+ if ( $option_box ) {
154
+ $html = '</label>';
155
+ $html .= '<label>'; // Label needed to prevent checkmark toggle on SELECT click
156
+ $html .= '<select name="A2A_SHARE_SAVE_position">';
157
+ $html .= '<option value="bottom"' . $positions['bottom']['selected'] . '>' . $positions['bottom']['string'] . '</option>';
158
+ $html .= '<option value="top"' . $positions['top']['selected'] . '>' . $positions['top']['string'] . '</option>';
159
+ $html .= '<option value="both"' . $positions['both']['selected'] . '>' . $positions['both']['string'] . '</option>';
160
+ $html .= '</select>';
161
+
162
+ return $html;
163
+ } else {
164
+ $html = '<span class="A2A_SHARE_SAVE_position">';
165
+ $html .= $positions[$options['position']]['string'];
166
+ $html .= '</span>';
167
+
168
+ return $html;
169
+ }
170
+ }
171
+
172
+ function _a2a_selected_attr( $value, $option_name, $options ) {
173
+ if ( ! empty( $options[ $option_name ] ) && $value === $options[ $option_name ] ) {
174
+ echo ' selected="selected"';
175
+ }
176
+ }
177
+
178
+ function _a2a_valid_hex_color( $value ) {
179
+ if ( preg_match( '/^#[a-f0-9]{6}$/i', $value ) ) {
180
+ return true;
181
+ }
182
+
183
+ return false;
184
+ }
185
+
186
  function A2A_SHARE_SAVE_options_page() {
187
 
188
  global $A2A_SHARE_SAVE_plugin_url_path,
216
  $new_options['floating_vertical'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_vertical'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_vertical'] : 'none';
217
  $new_options['floating_horizontal'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_horizontal'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal'] : 'none';
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  $new_options['floating_horizontal_position'] = (
220
  isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] ) &&
221
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] )
242
  is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] )
243
  ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] : '32';
244
 
245
+ $new_options['floating_horizontal_bg'] = ! empty( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'] : 'transparent';
246
+ $new_options['floating_horizontal_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'] : '#ffffff';
247
+
248
+ $new_options['floating_vertical_position'] = (
249
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] ) &&
250
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] )
251
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_position'] : '100';
252
+
253
+ $new_options['floating_vertical_offset'] = (
254
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
255
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] )
256
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] : '0';
257
+
258
+ $new_options['floating_vertical_responsive'] = (
259
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive'] ) &&
260
+ '1' == $_POST['A2A_SHARE_SAVE_floating_vertical_responsive']
261
+ ) ? '1' : '-1';
262
+
263
+ $new_options['floating_vertical_responsive_max_width'] = (
264
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] ) &&
265
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] )
266
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] : '980';
267
+
268
+ $new_options['floating_vertical_icon_size'] = (
269
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] ) &&
270
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] )
271
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] : '32';
272
+
273
+ $new_options['floating_vertical_bg'] = ! empty( $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg'] : 'transparent';
274
+ $new_options['floating_vertical_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'] : '#ffffff';
275
+
276
  } else {
277
  // Standard options screen
278
 
286
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
287
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
288
  $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
289
+ $new_options['icon_bg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_bg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_bg'] : 'original';
290
+ $new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_bg_color'] : '#2a2a2a';
291
+ $new_options['icon_fg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_fg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_fg'] : 'original';
292
+ $new_options['icon_fg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_fg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_fg_color'] : '#ffffff';
293
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
294
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
295
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
382
 
383
  $options = get_option( 'addtoany_options', array() );
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  ?>
386
 
387
  <div class="wrap">
401
 
402
  <?php if ( 'default' == $current_screen ) : ?>
403
  <tr valign="top">
404
+ <th scope="row"><?php _e("Icon Style", 'add-to-any'); ?></th>
405
  <td><fieldset>
406
  <label><input class="small-text" name="A2A_SHARE_SAVE_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo ! empty( $options['icon_size'] ) ? $options['icon_size'] : '32'; ?>"> pixels</label>
407
+ <br>
408
+ <label>
409
+ <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_bg">
410
+ <option value="original"<?php _a2a_selected_attr('original', 'icon_bg', $options); ?>>Original</option>
411
+ <option value="transparent"<?php _a2a_selected_attr('transparent', 'icon_bg', $options); ?>>Transparent</option>
412
+ <option value="custom"<?php _a2a_selected_attr('custom', 'icon_bg', $options); ?>>Custom&#8230;</option>
413
+ </select>
414
+ background
415
+ </label>
416
+ <div class="color-field-container"><input name="A2A_SHARE_SAVE_icon_bg_color" class="color-field" type="text" value="<?php echo ! empty( $options['icon_bg_color'] ) ? $options['icon_bg_color'] : '#2a2a2a'; ?>" data-default-color="#2a2a2a"></div>
417
+ <br>
418
+ <label>
419
+ <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_fg">
420
+ <option value="original"<?php _a2a_selected_attr('original', 'icon_fg', $options); ?>>Original</option>
421
+ <option value="transparent" disabled="disabled">Transparent</option>
422
+ <option value="custom"<?php _a2a_selected_attr('custom', 'icon_fg', $options); ?>>Custom&#8230;</option>
423
+ </select>
424
+ foreground
425
+ </label>
426
+ <div class="color-field-container"><input name="A2A_SHARE_SAVE_icon_fg_color" class="color-field" type="text" value="<?php echo ! empty( $options['icon_fg_color'] ) ? $options['icon_fg_color'] : '#ffffff'; ?>" data-default-color="#ffffff"></div>
427
  </fieldset></td>
428
  </tr>
429
 
430
  <tr valign="top">
431
+ <th scope="row"><?php _e("Share Buttons", 'add-to-any'); ?></th>
432
  <td><fieldset>
433
  <ul id="addtoany_services_sortable" class="addtoany_admin_list addtoany_override">
434
  <li class="dummy"><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/transparent.gif" width="32" height="32" alt="" /></li>
470
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/pinterest_pin_2x.png'; ?>" width="80" height="40" alt="Pinterest Pin It" />
471
  </li>
472
  </ul>
473
+ <div id="addtoany_services_tip">
474
+ <p style="line-height:0">
475
+ <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/instagram.svg" width="24" height="24" style="margin-right:8px">
476
+ <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/youtube.svg" width="24" height="24" style="margin-right:8px">
477
+ <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/snapchat.svg" width="24" height="24">
478
+ </p>
479
+ <p>You can setup Instagram, YouTube, Snapchat, and other buttons in an AddToAny Follow widget.</p><p>Add the &quot;AddToAny Follow&quot; widget in <a href="customize.php?autofocus[panel]=widgets&amp;return=options-general.php%3Fpage%3Daddtoany">Customize</a> or <a href="widgets.php">Widgets</a>.</p>
480
+ </div>
481
  </fieldset></td>
482
  </tr>
483
 
533
  <label>
534
  <input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php
535
  if ( ! isset( $options['display_in_posts'] ) || $options['display_in_posts'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
536
+ <?php printf(__('Display at the %s of posts', 'add-to-any'), _a2a_position_in_content( $options, true )); ?>
537
  </label>
538
  <br/>
539
  <label>
541
  if ( ! isset( $options['display_in_posts_on_front_page'] ) || $options['display_in_posts_on_front_page'] != '-1' ) echo ' checked="checked"';
542
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
543
  ?> value="1"/>
544
+ <?php printf(__('Display at the %s of posts on the front page', 'add-to-any'), _a2a_position_in_content( $options )); ?>
545
  </label>
546
  <br/>
547
  <label>
549
  if ( ! isset( $options['display_in_posts_on_archive_pages'] ) || $options['display_in_posts_on_archive_pages'] != '-1' ) echo ' checked="checked"';
550
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
551
  ?> value="1"/>
552
+ <?php printf(__('Display at the %s of posts on archive pages', 'add-to-any'), _a2a_position_in_content( $options )); ?>
553
  </label>
554
  <br/>
555
  <label>
557
  if ( ! isset( $options['display_in_feed'] ) || $options['display_in_feed'] != '-1' ) echo ' checked="checked"';
558
  if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
559
  ?> value="1"/>
560
+ <?php printf(__('Display at the %s of posts in the feed', 'add-to-any'), _a2a_position_in_content( $options )); ?>
561
  </label>
562
  <br/>
563
  <label>
564
  <input name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php
565
  if ( ! isset( $options['display_in_excerpts'] ) || $options['display_in_excerpts'] != '-1' ) echo ' checked="checked"';
566
  ?> value="1"/>
567
+ <?php printf(__('Display at the %s of excerpts', 'add-to-any'), _a2a_position_in_content( $options, false )); ?>
568
  </label>
569
  <br/>
570
  <label>
571
  <input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
572
+ <?php printf(__('Display at the %s of pages', 'add-to-any'), _a2a_position_in_content( $options, false )); ?>
573
  </label>
574
  <br/>
575
  <label>
576
  <input name="A2A_SHARE_SAVE_display_in_attachments" type="checkbox"<?php
577
  if ( ! isset( $options['display_in_attachments'] ) || $options['display_in_attachments'] != '-1' ) echo ' checked="checked"';
578
  ?> value="1"/>
579
+ <?php printf(__('Display at the %s of media pages', 'add-to-any'), _a2a_position_in_content( $options, false )); ?>
580
  </label>
581
 
582
  <?php
588
  <br/>
589
  <label>
590
  <input name="A2A_SHARE_SAVE_display_in_cpt_<?php echo $placement_name; ?>" type="checkbox"<?php if ( ! isset( $options['display_in_cpt_' . $placement_name] ) || $options['display_in_cpt_' . $placement_name] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
591
+ <?php printf(__('Display at the %s of %s', 'add-to-any'), _a2a_position_in_content( $options, false ), esc_html( $placement_label ) ); ?>
592
  </label>
593
  <?php endforeach; ?>
594
 
729
  <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
730
  </fieldset></td>
731
  </tr>
732
+ <tr valign="top">
733
+ <th scope="row"><?php _e('Background', 'add-to-any'); ?></th>
734
+ <td><fieldset>
735
+ <label>
736
+ <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_floating_vertical_bg">
737
+ <option value="transparent"<?php _a2a_selected_attr('transparent', 'floating_vertical_bg', $options); ?>>Transparent</option>
738
+ <option value="custom"<?php _a2a_selected_attr('custom', 'floating_vertical_bg', $options); ?>>Custom&#8230;</option>
739
+ </select>
740
+ </label>
741
+ <div class="color-field-container"><input name="A2A_SHARE_SAVE_floating_vertical_bg_color" class="color-field" type="text" value="<?php echo ! empty( $options['floating_vertical_bg_color'] ) ? $options['floating_vertical_bg_color'] : '#ffffff'; ?>" data-default-color="#ffffff"></div>
742
+ </fieldset></td>
743
+ </tr>
744
  </table>
745
 
746
  <h3><?php _e('Horizontal Buttons', 'add-to-any'); ?></h3>
783
  <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
784
  </fieldset></td>
785
  </tr>
786
+ <tr valign="top">
787
+ <th scope="row"><?php _e('Background', 'add-to-any'); ?></th>
788
+ <td><fieldset>
789
+ <label>
790
+ <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_floating_horizontal_bg">
791
+ <option value="transparent"<?php _a2a_selected_attr('transparent', 'floating_horizontal_bg', $options); ?>>Transparent</option>
792
+ <option value="custom"<?php _a2a_selected_attr('custom', 'floating_horizontal_bg', $options); ?>>Custom&#8230;</option>
793
+ </select>
794
+ </label>
795
+ <div class="color-field-container"><input name="A2A_SHARE_SAVE_floating_horizontal_bg_color" class="color-field" type="text" value="<?php echo ! empty( $options['floating_horizontal_bg_color'] ) ? $options['floating_horizontal_bg_color'] : '#ffffff'; ?>" data-default-color="#ffffff"></div>
796
+ </fieldset></td>
797
+ </tr>
798
  </table>
799
 
800
  <?php endif; ?>
837
  <script type="text/javascript"><!--
838
  jQuery(document).ready(function(){
839
 
840
+ // Add color picker
841
+ jQuery('.color-field').wpColorPicker();
842
+
843
+ function show_color_picker_for_custom(arg_1){
844
+ var $this = jQuery(this);
845
+ var $colorFieldParent = $this.parent().next('div').first();
846
+
847
+ if ('custom' === $this.val()) {
848
+ // If first argument is a number, indicating $.each() is the caller
849
+ if (typeof arg_1 === 'number') {
850
+ $colorFieldParent.fadeIn('fast');
851
+ } else {
852
+ $colorFieldParent.slideDown('fast');
853
+ }
854
+ } else {
855
+ $colorFieldParent.hide();
856
+ }
857
+ }
858
+
859
+ // Show color picker when "Custom" color is selected
860
+ jQuery('select.addtoany_icon_color').bind('change click', show_color_picker_for_custom).each(show_color_picker_for_custom);
861
+
862
  // Toggle child options of 'Display in posts'
863
  jQuery('#A2A_SHARE_SAVE_display_in_posts').bind('change click', function(e){
864
  if (jQuery(this).is(':checked'))
1070
  // Add/Remove Services button
1071
  jQuery('#addtoany_services_sortable .dummy:first').after('<li id="addtoany_show_services"><?php _e('Add/Remove Services', 'add-to-any'); ?> &#187;</li>');
1072
  jQuery('#addtoany_show_services').click(function(e) {
1073
+ jQuery('#addtoany_services_selectable, #addtoany_services_info, #addtoany_services_tip').slideDown('fast');
1074
  jQuery(this).fadeOut('fast');
1075
  });
1076
 
1094
  --></script>
1095
 
1096
  <style type="text/css">
1097
+ .color-field-container{display:none;}
1098
+
1099
  .ui-sortable-placeholder{background-color:transparent;border:1px dashed #CCC !important;}
1100
  .addtoany_admin_list{list-style:none;padding:0;margin:0;}
1101
  .addtoany_admin_list li{border-radius:6px;}
1122
 
1123
  li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;line-height:32px;margin-left:9px;}
1124
  li#addtoany_show_services:hover{border:1px solid #CCC;}
1125
+ #addtoany_services_info, #addtoany_services_tip{clear:left;display:none;margin:12px;padding:10px 0;}
1126
+ #addtoany_services_tip{padding:20px 0 0;}
1127
+ #addtoany_services_tip img{border-radius:4px;background-color:#444;}
1128
 
1129
  /* No outline during ARIA focus */
1130
  .addtoany_extra_section {
1168
 
1169
  function A2A_SHARE_SAVE_scripts() {
1170
  wp_enqueue_script( 'jquery-ui-sortable' );
1171
+ wp_enqueue_script( 'wp-color-picker' );
1172
+ wp_enqueue_style( 'wp-color-picker' );
1173
  }
addtoany.services.php CHANGED
@@ -650,13 +650,13 @@ $A2A_FOLLOW_services = array(
650
  'name' => 'YouTube',
651
  'href' => 'https://www.youtube.com/user/${id}',
652
  'icon' => 'youtube',
653
- 'color' => 'CD201F',
654
  ),
655
  'youtube_channel' => array(
656
  'name' => 'YouTube Channel',
657
  'href' => 'https://www.youtube.com/channel/${id}',
658
  'icon' => 'youtube',
659
- 'color' => 'CD201F',
660
  ),
661
  'feed' => array(
662
  'name' => 'RSS Feed',
650
  'name' => 'YouTube',
651
  'href' => 'https://www.youtube.com/user/${id}',
652
  'icon' => 'youtube',
653
+ 'color' => 'FF0000',
654
  ),
655
  'youtube_channel' => array(
656
  'name' => 'YouTube Channel',
657
  'href' => 'https://www.youtube.com/channel/${id}',
658
  'icon' => 'youtube',
659
+ 'color' => 'FF0000',
660
  ),
661
  'feed' => array(
662
  'name' => 'RSS Feed',