AddToAny Share Buttons - Version 1.3

Version Description

  • Floating share buttons (major new feature!)
  • AddToAny Vertical Share Bar
  • AddToAny Horizontal Share Bar
  • Update admin interface
  • Update options
Download this release

Release Info

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

Code changes from version 1.2.9.3 to 1.3

Files changed (3) hide show
  1. README.txt +22 -6
  2. add-to-any.php +140 -40
  3. addtoany.admin.php +234 -113
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, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, buffer, stumbleupon, bitly, technorati, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 3.9.1
6
- Stable tag: 1.2.9.3
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
@@ -15,16 +15,22 @@ AddToAny's customizable platform and social share icons let you optimize your si
15
 
16
  = Share Buttons =
17
 
18
- * **New**: Vector sharing buttons (SVG sharing icons)
 
19
  * Universal Share Button and Smart Menu
20
  * Sharing Kit for individual share links
21
- * **New**: Custom sharing icons
22
  * Choose from over 100 individual services
23
  * 3rd party buttons include 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 and native apps
25
 
26
  <a href="http://www.addtoany.com/" title="Sharing buttons">Share Buttons</a> demo
27
 
 
 
 
 
 
28
  = Analytics Integration =
29
 
30
  * Automatic Google Analytics integration (<a href="http://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
@@ -39,7 +45,7 @@ AddToAny's customizable platform and social share icons let you optimize your si
39
 
40
  * AddToAny gives users the choice in sharing from a service's native app or from a web app
41
  * For example, choose between Twitter's native app or Twitter's mobile web app
42
- * AddToAny's SVG icons are lightweight and pixel-perfect at any size
43
 
44
  = Customizable & Extensible =
45
 
@@ -52,7 +58,7 @@ AddToAny's customizable platform and social share icons let you optimize your si
52
  = Wide Support =
53
 
54
  * Over 8 years of active development
55
- * Over 2.9 million downloads
56
  * Translated into dozens of languages
57
  * Ongoing support from the community
58
 
@@ -271,6 +277,13 @@ Upload the plugin directory (including all files and directories within) to the
271
 
272
  == Changelog ==
273
 
 
 
 
 
 
 
 
274
  = 1.2.9.3 =
275
  * Prevent script output in feeds on some sites
276
  * Remove constants for old WP versions (below 2.6)
@@ -1134,5 +1147,8 @@ Upload the plugin directory (including all files and directories within) to the
1134
 
1135
  == Upgrade Notice ==
1136
 
 
 
 
1137
  = 0.9.9.7 =
1138
  Upgrade now if you haven't upgraded in a while and are using WordPress 2.8+. This release incorporates a number of important fixes and performance enhacements, including some new sharing features that you'll love.
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, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, technorati, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 3.9.1
6
+ Stable tag: 1.3
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
15
 
16
  = Share Buttons =
17
 
18
+ * **New**: Floating share buttons optional & customizable, vertical & horizontal
19
+ * Vector sharing buttons (SVG sharing icons)
20
  * Universal Share Button and Smart Menu
21
  * Sharing Kit for individual share links
22
+ * Custom sharing icons
23
  * Choose from over 100 individual 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="http://www.addtoany.com/" title="Sharing buttons">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 widget within a theme
33
+
34
  = Analytics Integration =
35
 
36
  * Automatic Google Analytics integration (<a href="http://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
45
 
46
  * AddToAny gives users the choice in sharing from a service's native app or from a web app
47
  * For example, choose between Twitter's native app or Twitter's mobile web app
48
+ * AddToAny's SVG icons are super-lightweight and pixel-perfect at any size
49
 
50
  = Customizable & Extensible =
51
 
58
  = Wide Support =
59
 
60
  * Over 8 years of active development
61
+ * Over 3 million downloads
62
  * Translated into dozens of languages
63
  * Ongoing support from the community
64
 
277
 
278
  == Changelog ==
279
 
280
+ = 1.3 =
281
+ * Floating share buttons (major new feature!)
282
+ * AddToAny Vertical Share Bar
283
+ * AddToAny Horizontal Share Bar
284
+ * Update admin interface
285
+ * Update options
286
+
287
  = 1.2.9.3 =
288
  * Prevent script output in feeds on some sites
289
  * Remove constants for old WP versions (below 2.6)
1147
 
1148
  == Upgrade Notice ==
1149
 
1150
+ = 1.3 =
1151
+ Floating Share Buttons are now available! Click the "Floating" tab in Settings > AddToAny.
1152
+
1153
  = 0.9.9.7 =
1154
  Upgrade now if you haven't upgraded in a while and are using WordPress 2.8+. This release incorporates a number of important fixes and performance enhacements, including some new sharing features that you'll love.
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.2.9.3
7
  Author: AddToAny
8
  Author URI: http://www.addtoany.com/
9
  */
@@ -49,7 +49,7 @@ function A2A_SHARE_SAVE_init() {
49
  $A2A_SHARE_SAVE_plugin_url_path . '/languages',
50
  $A2A_SHARE_SAVE_plugin_basename . '/languages' );
51
 
52
- if ( $A2A_SHARE_SAVE_options['display_in_excerpts'] != '-1' ) {
53
  // Excerpts use strip_tags() for the_content, so cancel if Excerpt and append to the_excerpt instead
54
  add_filter( 'get_the_excerpt', 'A2A_SHARE_SAVE_remove_from_content', 9 );
55
  add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
@@ -98,7 +98,7 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = false ) {
98
  $options = get_option( 'addtoany_options' );
99
 
100
  // If universal button disabled, and not manually disabled through args
101
- if ( $options['button'] == 'NONE' && ! isset( $args['no_universal_button'] ) ) {
102
  // Pass this setting on to ADDTOANY_SHARE_SAVE_BUTTON
103
  // (and only via this ADDTOANY_SHARE_SAVE_KIT function because it is used for automatic placement)
104
  $args['no_universal_button'] = true;
@@ -110,16 +110,39 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = false ) {
110
  // Set a2a_kit_size_## class name unless "icon_size" is set to '16' or custom icons are enabled
111
  if ( $custom_icons ) {
112
  $icon_size = '';
113
- } elseif ( ! $options['icon_size'] ) {
 
114
  $icon_size = ' a2a_kit_size_32';
115
- } elseif ( $options['icon_size'] == '16' ) {
116
  $icon_size = '';
117
  } else {
118
  $icon_size = ' a2a_kit_size_' . $options['icon_size'] . '';
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  if ( ! isset( $args['html_container_open'] ) ) {
122
- $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . ' a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">'; // ID is later removed by JS (for AJAX)
 
 
 
123
  $args['is_kit'] = true;
124
  }
125
  if ( ! isset( $args['html_container_close'] ) )
@@ -167,6 +190,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
167
  'html_container_close' => '',
168
  'html_wrap_open' => '',
169
  'html_wrap_close' => '',
 
170
  );
171
 
172
  $args = wp_parse_args( $args, $defaults );
@@ -177,13 +201,17 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
177
 
178
  $service_codes = ( is_array( $A2A_SHARE_SAVE_services ) ) ? array_keys( $A2A_SHARE_SAVE_services ) : array();
179
 
180
- // Include Facebook Like and Twitter Tweet etc.
181
- array_unshift( $service_codes, 'facebook_like', 'twitter_tweet', 'google_plusone', 'google_plus_share', 'pinterest_pin' );
 
 
182
 
183
  $options = get_option( 'addtoany_options' );
184
 
185
- // False only if "icon_size" is set to '16'
186
- $large_icons = ( isset( $options['icon_size'] ) && $options['icon_size'] == '16' ) ? false : true;
 
 
187
 
188
  // Directory of either custom icons or the packaged icons
189
  if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' && isset( $options['custom_icons_url'] ) ) {
@@ -195,16 +223,11 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
195
  $icons_dir = $A2A_SHARE_SAVE_plugin_url_path . '/icons/';
196
  }
197
 
198
- $active_services = $options['active_services'];
 
199
 
200
  $ind_html = "" . $html_container_open;
201
 
202
- // Use default services if options have not been set yet
203
- if ( false === $options )
204
- $active_services = array( 'facebook', 'twitter', 'google_plus' );
205
- elseif ( empty( $active_services ) )
206
- $active_services = array();
207
-
208
  foreach( $active_services as $active_service ) {
209
 
210
  if ( ! in_array( $active_service, $service_codes ) )
@@ -285,14 +308,15 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
285
  'linkurl' => '',
286
  'linkname_enc' => '',
287
  'linkurl_enc' => '',
288
- 'use_current_page' => FALSE,
289
- 'output_later' => FALSE,
290
- 'is_kit' => FALSE,
291
  'html_container_open' => '',
292
  'html_container_close' => '',
293
  'html_wrap_open' => '',
294
  'html_wrap_close' => '',
295
- 'no_universal_button' => FALSE,
 
296
  );
297
 
298
  $args = wp_parse_args( $args, $defaults );
@@ -318,14 +342,14 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
318
  // If universal button is enabled
319
  if ( ! $args['no_universal_button'] ) {
320
 
321
- if ( ! $options['button'] || $options['button'] == 'A2A_SVG_32' ) {
322
  // Skip button IMG for A2A icon insertion
323
  $button_text = '';
324
- } else if ( $options['button'] == 'CUSTOM' ) {
325
  $button_src = $options['button_custom'];
326
  $button_width = '';
327
  $button_height = '';
328
- } else if ( $options['button'] == 'TEXT' ) {
329
  $button_text = stripslashes( $options[ 'button_text'] );
330
  } else {
331
  $button_attrs = explode( '|', $options['button'] );
@@ -333,7 +357,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
333
  $button_width = ' width="' . $button_attrs[1] . '"';
334
  $button_height = ' height="' . $button_attrs[2] . '"';
335
  $button_src = $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname;
336
- $button_text = stripslashes( $options['button_text'] );
337
  }
338
 
339
  $style = '';
@@ -497,6 +521,81 @@ if ( ! function_exists( 'A2A_menu_locale' ) ) {
497
  }
498
  }
499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
  function A2A_SHARE_SAVE_head_script() {
502
  if ( is_admin() || is_feed() )
@@ -509,15 +608,15 @@ function A2A_SHARE_SAVE_head_script() {
509
  global $A2A_SHARE_SAVE_external_script_called;
510
  if ( ! $A2A_SHARE_SAVE_external_script_called ) {
511
  // Use local cache?
512
- $cache = ( $options['cache'] == '1' ) ? true : false;
513
  $upload_dir = wp_upload_dir();
514
  $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $http_or_https . '://static.addtoany.com/menu';
515
 
516
  // Enternal script call + initial JS + set-once variables
517
- $additional_js = $options['additional_js_variables'];
518
  $script_configs = ( ( $cache ) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
519
- . ( ( $options['onclick'] == '1' ) ? "\n" . 'a2a_config.onclick=1;' : '' )
520
- . ( ( $options['show_title'] == '1' ) ? "\n" . 'a2a_config.show_title=1;' : '' )
521
  . ( ( $additional_js ) ? "\n" . stripslashes( $additional_js ) : '' );
522
  $A2A_SHARE_SAVE_external_script_called = true;
523
  }
@@ -580,6 +679,8 @@ function A2A_SHARE_SAVE_footer_script() {
580
 
581
  $_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();
582
 
 
 
583
  $javascript_footer = "\n" . '<script type="text/javascript">' . "<!--\n"
584
  . "wpa2a.targets=["
585
  . implode( ",", $_addtoany_targets )
@@ -589,7 +690,7 @@ function A2A_SHARE_SAVE_footer_script() {
589
  . "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button. Fixes issues where first button code is processed internally but without actual code output
590
  . "\n//--></script>\n";
591
 
592
- echo $javascript_footer;
593
  }
594
 
595
  add_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
@@ -664,7 +765,6 @@ function A2A_SHARE_SAVE_add_to_content_next_time( $content ) {
664
 
665
  function A2A_SHARE_SAVE_add_to_content( $content ) {
666
  global $A2A_SHARE_SAVE_auto_placement_ready;
667
-
668
  $is_feed = is_feed();
669
  $options = get_option( 'addtoany_options' );
670
  $sharing_disabled = get_post_meta( get_the_ID(), 'sharing_disabled', true );
@@ -691,25 +791,25 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
691
  (
692
  // Posts
693
  // All posts
694
- ( ! is_page() && $options['display_in_posts'] == '-1' ) ||
695
  // Front page posts
696
- ( is_home() && $options['display_in_posts_on_front_page'] == '-1' ) ||
697
  // Archive page posts (Category, Tag, Author and Date pages)
698
- ( is_archive() && $options['display_in_posts_on_archive_pages'] == '-1' ) ||
699
  // Search results posts (same as Archive page posts option)
700
- ( is_search() && $options['display_in_posts_on_archive_pages'] == '-1' ) ||
701
  // Posts in feed
702
- ( $is_feed && ( $options['display_in_feed'] == '-1' ) ||
703
 
704
  // Pages
705
  // Individual pages
706
- ( is_page() && $options['display_in_pages'] == '-1' ) ||
707
  // <!--nosharesave--> legacy tag
708
  ( (strpos( $content, '<!--nosharesave-->') !== false ) )
709
  )
710
- )
711
- )
712
  return $content;
 
713
 
714
  $kit_args = array(
715
  "output_later" => true,
@@ -769,7 +869,7 @@ function A2A_SHARE_SAVE_stylesheet() {
769
  global $A2A_SHARE_SAVE_options, $A2A_SHARE_SAVE_plugin_url_path;
770
 
771
  // Use stylesheet?
772
- if ( $A2A_SHARE_SAVE_options['inline_css'] != '-1' && ! is_admin() ) {
773
  wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.6' );
774
  }
775
  }
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.3
7
  Author: AddToAny
8
  Author URI: http://www.addtoany.com/
9
  */
49
  $A2A_SHARE_SAVE_plugin_url_path . '/languages',
50
  $A2A_SHARE_SAVE_plugin_basename . '/languages' );
51
 
52
+ if ( ! isset( $A2A_SHARE_SAVE_options['display_in_excerpts'] ) || $A2A_SHARE_SAVE_options['display_in_excerpts'] != '-1' ) {
53
  // Excerpts use strip_tags() for the_content, so cancel if Excerpt and append to the_excerpt instead
54
  add_filter( 'get_the_excerpt', 'A2A_SHARE_SAVE_remove_from_content', 9 );
55
  add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
98
  $options = get_option( 'addtoany_options' );
99
 
100
  // If universal button disabled, and not manually disabled through args
101
+ if ( isset( $options['button'] ) && $options['button'] == 'NONE' && ! isset( $args['no_universal_button'] ) ) {
102
  // Pass this setting on to ADDTOANY_SHARE_SAVE_BUTTON
103
  // (and only via this ADDTOANY_SHARE_SAVE_KIT function because it is used for automatic placement)
104
  $args['no_universal_button'] = true;
110
  // Set a2a_kit_size_## class name unless "icon_size" is set to '16' or custom icons are enabled
111
  if ( $custom_icons ) {
112
  $icon_size = '';
113
+ // a2a_kit_size_32 if no icon size, or no_small_icons arg is true
114
+ } elseif ( ! isset( $options['icon_size'] ) || isset( $args['no_small_icons'] ) && true == $args['no_small_icons'] ) {
115
  $icon_size = ' a2a_kit_size_32';
116
+ } elseif ( isset( $options['icon_size'] ) && $options['icon_size'] == '16' ) {
117
  $icon_size = '';
118
  } else {
119
  $icon_size = ' a2a_kit_size_' . $options['icon_size'] . '';
120
  }
121
 
122
+ $kit_additional_classes = '';
123
+ $kit_style = '';
124
+
125
+ // Add additional classNames to .a2a_kit
126
+ if ( isset( $args['kit_additional_classes'] ) ) {
127
+ // Append space and className(s)
128
+ $kit_additional_classes .= ' ' . $args['kit_additional_classes'];
129
+ }
130
+
131
+ // Add addtoany_list className unless disabled (for floating buttons)
132
+ if ( ! isset( $args['no_addtoany_list_classname'] ) ) {
133
+ $kit_additional_classes .= ' addtoany_list';
134
+ }
135
+
136
+ // Add style attribute if set
137
+ if ( isset( $args['kit_style'] ) ) {
138
+ $kit_style = ' style="' . $args['kit_style'] . '"';
139
+ }
140
+
141
  if ( ! isset( $args['html_container_open'] ) ) {
142
+ $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . $kit_additional_classes . ' a2a_target"';
143
+ $args['html_container_open'] .= ' id="wpa2a_' . $_addtoany_counter . '"'; // ID is later removed by JS (for AJAX)
144
+ $args['html_container_open'] .= $kit_style;
145
+ $args['html_container_open'] .= '>';
146
  $args['is_kit'] = true;
147
  }
148
  if ( ! isset( $args['html_container_close'] ) )
190
  'html_container_close' => '',
191
  'html_wrap_open' => '',
192
  'html_wrap_close' => '',
193
+ 'no_universal_button' => false,
194
  );
195
 
196
  $args = wp_parse_args( $args, $defaults );
201
 
202
  $service_codes = ( is_array( $A2A_SHARE_SAVE_services ) ) ? array_keys( $A2A_SHARE_SAVE_services ) : array();
203
 
204
+ // Include Facebook Like and Twitter Tweet etc. unless no_special_services arg is true
205
+ if ( ! isset( $no_special_services ) || false == $no_special_services ) {
206
+ array_unshift( $service_codes, 'facebook_like', 'twitter_tweet', 'google_plusone', 'google_plus_share', 'pinterest_pin' );
207
+ }
208
 
209
  $options = get_option( 'addtoany_options' );
210
 
211
+ // False if "icon_size" is set to '16' or no_small_icons arg is true
212
+ $large_icons = ( isset( $options['icon_size'] ) && $options['icon_size'] == '16' &&
213
+ ( ! isset( $no_small_icons ) || false == $no_small_icons )
214
+ ) ? false : true;
215
 
216
  // Directory of either custom icons or the packaged icons
217
  if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' && isset( $options['custom_icons_url'] ) ) {
223
  $icons_dir = $A2A_SHARE_SAVE_plugin_url_path . '/icons/';
224
  }
225
 
226
+ // Use default services if services have not been selected yet
227
+ $active_services = ( isset( $options['active_services'] ) ) ? $options['active_services'] : array( 'facebook', 'twitter', 'google_plus' );
228
 
229
  $ind_html = "" . $html_container_open;
230
 
 
 
 
 
 
 
231
  foreach( $active_services as $active_service ) {
232
 
233
  if ( ! in_array( $active_service, $service_codes ) )
308
  'linkurl' => '',
309
  'linkname_enc' => '',
310
  'linkurl_enc' => '',
311
+ 'use_current_page' => false,
312
+ 'output_later' => false,
313
+ 'is_kit' => false,
314
  'html_container_open' => '',
315
  'html_container_close' => '',
316
  'html_wrap_open' => '',
317
  'html_wrap_close' => '',
318
+ 'no_small_icons' => false,
319
+ 'no_universal_button' => false,
320
  );
321
 
322
  $args = wp_parse_args( $args, $defaults );
342
  // If universal button is enabled
343
  if ( ! $args['no_universal_button'] ) {
344
 
345
+ if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] || isset( $no_small_icons ) && true == $no_small_icons ) {
346
  // Skip button IMG for A2A icon insertion
347
  $button_text = '';
348
+ } else if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) {
349
  $button_src = $options['button_custom'];
350
  $button_width = '';
351
  $button_height = '';
352
+ } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) {
353
  $button_text = stripslashes( $options[ 'button_text'] );
354
  } else {
355
  $button_attrs = explode( '|', $options['button'] );
357
  $button_width = ' width="' . $button_attrs[1] . '"';
358
  $button_height = ' height="' . $button_attrs[2] . '"';
359
  $button_src = $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname;
360
+ $button_text = ( isset( $options['button_text'] ) ) ? stripslashes( $options['button_text'] ) : 'Share' ;
361
  }
362
 
363
  $style = '';
521
  }
522
  }
523
 
524
+ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
525
+ $options = get_option( 'addtoany_options' );
526
+
527
+ $floating_html = '';
528
+ $vertical_type = ( isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ) ? $options['floating_vertical'] : false;
529
+ $horizontal_type = ( isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ) ? $options['floating_horizontal'] : false;
530
+
531
+ // Args are just passed on to ADDTOANY_SHARE_SAVE_KIT for now
532
+ $defaults = array(
533
+ 'linkname' => '',
534
+ 'linkurl' => '',
535
+ 'linkname_enc' => '',
536
+ 'linkurl_enc' => '',
537
+ 'use_current_page' => true,
538
+ 'output_later' => true,
539
+ 'is_kit' => true,
540
+ 'no_universal_button' => false,
541
+ 'no_addtoany_list_classname' => true,
542
+ 'no_special_services' => true,
543
+ 'no_small_icons' => true,
544
+ 'kit_additional_classes' => '',
545
+ 'kit_style' => '',
546
+ );
547
+
548
+ $args = wp_parse_args( $args, $defaults );
549
+
550
+ // If either floating type is enabled
551
+ if ( $vertical_type || $horizontal_type ) {
552
+ // Vertical type?
553
+ if ( $vertical_type ) {
554
+ // Top position
555
+ $position = ( isset( $options['floating_vertical_position'] ) ) ? $options['floating_vertical_position'] . 'px' : '100px';
556
+ // Left or right offset
557
+ $offset = ( isset( $options['floating_vertical_offset'] ) ) ? $options['floating_vertical_offset'] . 'px' : '0px';
558
+
559
+ // Add a2a_vertical_style className to Kit classes
560
+ $args['kit_additional_classes'] = 'a2a_floating_style a2a_vertical_style';
561
+
562
+ // Add declarations to Kit style attribute
563
+ if ( 'left_docked' == $vertical_type ) {
564
+ $args['kit_style'] = 'left:' . $offset . ';top:' . $position . ';';
565
+ } elseif ( 'right_docked' == $vertical_type ) {
566
+ $args['kit_style'] = 'right:' . $offset . ';top:' . $position . ';';
567
+ }
568
+
569
+ $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $args );
570
+ }
571
+
572
+ // Horizontal type?
573
+ if ( $horizontal_type ) {
574
+ // Left or right position
575
+ $position = ( isset( $options['floating_horizontal_position'] ) ) ? $options['floating_horizontal_position'] . 'px' : '0px';
576
+ // Bottom offset
577
+ $offset = ( isset( $options['floating_horizontal_offset'] ) ) ? $options['floating_horizontal_offset'] . 'px' : '0px';
578
+
579
+ // Add a2a_default_style className to Kit classes
580
+ $args['kit_additional_classes'] = 'a2a_floating_style a2a_default_style';
581
+
582
+ // Add declarations to Kit style attribute
583
+ if ( 'left_docked' == $horizontal_type ) {
584
+ $args['kit_style'] = 'bottom:' . $offset . ';left:' . $position . ';';
585
+ } elseif ( 'right_docked' == $horizontal_type ) {
586
+ $args['kit_style'] = 'bottom:' . $offset . ';right:' . $position . ';';
587
+ }
588
+
589
+ $floating_html .= ADDTOANY_SHARE_SAVE_KIT( $args );
590
+ }
591
+ }
592
+
593
+ if ( isset( $args['output_later'] ) && $args['output_later'] == true )
594
+ return $floating_html;
595
+ else
596
+ echo $floating_html;
597
+ }
598
+
599
 
600
  function A2A_SHARE_SAVE_head_script() {
601
  if ( is_admin() || is_feed() )
608
  global $A2A_SHARE_SAVE_external_script_called;
609
  if ( ! $A2A_SHARE_SAVE_external_script_called ) {
610
  // Use local cache?
611
+ $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false;
612
  $upload_dir = wp_upload_dir();
613
  $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $http_or_https . '://static.addtoany.com/menu';
614
 
615
  // Enternal script call + initial JS + set-once variables
616
+ $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
617
  $script_configs = ( ( $cache ) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
618
+ . ( ( isset( $options['onclick'] ) && '1' == $options['onclick'] ) ? "\n" . 'a2a_config.onclick=1;' : '' )
619
+ . ( ( isset( $options['show_title'] ) && '1' == $options['show_title'] ) ? "\n" . 'a2a_config.show_title=1;' : '' )
620
  . ( ( $additional_js ) ? "\n" . stripslashes( $additional_js ) : '' );
621
  $A2A_SHARE_SAVE_external_script_called = true;
622
  }
679
 
680
  $_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();
681
 
682
+ $floating_html = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) );
683
+
684
  $javascript_footer = "\n" . '<script type="text/javascript">' . "<!--\n"
685
  . "wpa2a.targets=["
686
  . implode( ",", $_addtoany_targets )
690
  . "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button. Fixes issues where first button code is processed internally but without actual code output
691
  . "\n//--></script>\n";
692
 
693
+ echo $floating_html . $javascript_footer;
694
  }
695
 
696
  add_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
765
 
766
  function A2A_SHARE_SAVE_add_to_content( $content ) {
767
  global $A2A_SHARE_SAVE_auto_placement_ready;
 
768
  $is_feed = is_feed();
769
  $options = get_option( 'addtoany_options' );
770
  $sharing_disabled = get_post_meta( get_the_ID(), 'sharing_disabled', true );
791
  (
792
  // Posts
793
  // All posts
794
+ ( ! is_page() && isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) ||
795
  // Front page posts
796
+ ( is_home() && isset( $options['display_in_posts_on_front_page'] ) && $options['display_in_posts_on_front_page'] == '-1' ) ||
797
  // Archive page posts (Category, Tag, Author and Date pages)
798
+ ( is_archive() && isset( $options['display_in_posts_on_archive_pages'] ) && $options['display_in_posts_on_archive_pages'] == '-1' ) ||
799
  // Search results posts (same as Archive page posts option)
800
+ ( is_search() && isset( $options['display_in_posts_on_archive_pages'] ) && $options['display_in_posts_on_archive_pages'] == '-1' ) ||
801
  // Posts in feed
802
+ ( $is_feed && isset( $options['display_in_feed'] ) && $options['display_in_feed'] == '-1' ) ||
803
 
804
  // Pages
805
  // Individual pages
806
+ ( is_page() && isset( $options['display_in_pages'] ) && $options['display_in_pages'] == '-1' ) ||
807
  // <!--nosharesave--> legacy tag
808
  ( (strpos( $content, '<!--nosharesave-->') !== false ) )
809
  )
810
+ ) {
 
811
  return $content;
812
+ }
813
 
814
  $kit_args = array(
815
  "output_later" => true,
869
  global $A2A_SHARE_SAVE_options, $A2A_SHARE_SAVE_plugin_url_path;
870
 
871
  // Use stylesheet?
872
+ if ( ! isset( $A2A_SHARE_SAVE_options['inline_css'] ) || $A2A_SHARE_SAVE_options['inline_css'] != '-1' && ! is_admin() ) {
873
  wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.6' );
874
  }
875
  }
addtoany.admin.php CHANGED
@@ -188,70 +188,115 @@ function A2A_SHARE_SAVE_options_page() {
188
 
189
  // Make available services extensible via plugins, themes (functions.php), etc.
190
  $A2A_SHARE_SAVE_services = apply_filters( 'A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services );
191
-
 
 
 
 
192
  if ( isset( $_POST['Submit'] ) ) {
193
 
194
  // Nonce verification
195
  check_admin_referer( 'add-to-any-update-options' );
196
-
197
- $new_options['position'] = ($_POST['A2A_SHARE_SAVE_position']) ? @$_POST['A2A_SHARE_SAVE_position'] : 'bottom';
198
- $new_options['display_in_posts_on_front_page'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] == '1') ? '1' : '-1';
199
- $new_options['display_in_posts_on_archive_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] == '1') ? '1' : '-1';
200
- $new_options['display_in_excerpts'] = (@$_POST['A2A_SHARE_SAVE_display_in_excerpts']=='1') ? '1' : '-1';
201
- $new_options['display_in_posts'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts']=='1') ? '1' : '-1';
202
- $new_options['display_in_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_pages']=='1') ? '1' : '-1';
203
- $new_options['display_in_feed'] = (@$_POST['A2A_SHARE_SAVE_display_in_feed']=='1') ? '1' : '-1';
204
- $new_options['show_title'] = (@$_POST['A2A_SHARE_SAVE_show_title']=='1') ? '1' : '-1';
205
- $new_options['onclick'] = (@$_POST['A2A_SHARE_SAVE_onclick'] == '1') ? '1' : '-1';
206
- $new_options['icon_size'] = @$_POST['A2A_SHARE_SAVE_icon_size'];
207
- $new_options['button'] = @$_POST['A2A_SHARE_SAVE_button'];
208
- $new_options['button_custom'] = @$_POST['A2A_SHARE_SAVE_button_custom'];
209
- $new_options['additional_js_variables'] = trim( @$_POST['A2A_SHARE_SAVE_additional_js_variables'] );
210
- $new_options['custom_icons'] = (@$_POST['A2A_SHARE_SAVE_custom_icons']=='url') ? 'url' : '-1';
211
- $new_options['custom_icons_url'] = @$_POST['A2A_SHARE_SAVE_custom_icons_url'];
212
- $new_options['inline_css'] = (@$_POST['A2A_SHARE_SAVE_inline_css']=='1') ? '1' : '-1';
213
- $new_options['cache'] = (@$_POST['A2A_SHARE_SAVE_cache']=='1') ? '1' : '-1';
214
-
215
- // Schedule cache refresh?
216
- if ( @$_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
217
- A2A_SHARE_SAVE_schedule_cache();
218
- A2A_SHARE_SAVE_refresh_cache();
 
 
 
 
 
 
219
  } else {
220
- A2A_SHARE_SAVE_unschedule_cache();
221
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
 
223
- // Store desired text if 16 x 16px buttons or text-only is chosen:
224
- if ( $new_options['button'] == 'favicon.png|16|16' )
225
- $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text'];
226
- elseif ( $new_options['button'] == 'share_16_16.png|16|16' )
227
- $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_share_16_16_text'];
228
- else
229
- $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any');
230
-
231
- // Store chosen individual services to make active
232
- $active_services = Array();
233
- if ( ! isset( $_POST['A2A_SHARE_SAVE_active_services'] ) )
234
- $_POST['A2A_SHARE_SAVE_active_services'] = array();
235
- foreach ( $_POST['A2A_SHARE_SAVE_active_services'] as $dummy=>$sitename )
236
- $active_services[] = substr( $sitename, 7 );
237
- $new_options['active_services'] = $active_services;
238
-
239
- // Store special service options
240
- $new_options['special_facebook_like_options'] = array(
241
- 'verb' => ( (@$_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' )
242
- );
243
- $new_options['special_twitter_tweet_options'] = array(
244
- 'show_count' => ( ( @$_POST['addtoany_twitter_tweet_show_count'] == '1' ) ? '1' : '-1' )
245
- );
246
- $new_options['special_google_plusone_options'] = array(
247
- 'show_count' => ( ( @$_POST['addtoany_google_plusone_show_count'] == '1' ) ? '1' : '-1' )
248
- );
249
- $new_options['special_google_plus_share_options'] = array(
250
- 'show_count' => ( ( @$_POST['addtoany_google_plus_share_show_count'] == '1' ) ? '1' : '-1' )
251
- );
252
- $new_options['special_pinterest_pin_options'] = array(
253
- 'show_count' => ( ( @$_POST['addtoany_pinterest_pin_show_count'] == '1' ) ? '1' : '-1' )
254
- );
255
 
256
  update_option( 'addtoany_options', $new_options );
257
 
@@ -314,22 +359,26 @@ function A2A_SHARE_SAVE_options_page() {
314
 
315
  <div class="wrap">
316
 
317
- <div id="icon-options-general" class="icon32"></div>
318
-
319
  <h2><?php _e( 'AddToAny Share Settings', 'add-to-any' ); ?></h2>
 
 
 
 
 
320
 
321
  <form id="addtoany_admin_form" method="post" action="">
322
 
323
  <?php wp_nonce_field('add-to-any-update-options'); ?>
324
-
325
  <table class="form-table">
326
-
 
327
  <tr valign="top">
328
  <th scope="row"><?php _e("Icon Size", "add-to-any"); ?></th>
329
  <td><fieldset>
330
- <label><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="32"<?php if( !$options['icon_size'] || $options['icon_size']=='32' ) echo ' checked="checked"'; ?>> <?php _e('Large', 'add-to-any'); ?></label>
331
  <br>
332
- <label><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="16"<?php if($options['icon_size']=='16') echo ' checked="checked"'; ?>> <?php _e('Small', 'add-to-any'); ?></label>
333
  </fieldset></td>
334
  </tr>
335
 
@@ -380,7 +429,7 @@ function A2A_SHARE_SAVE_options_page() {
380
  <td><fieldset>
381
  <div class="addtoany_icon_size_large">
382
  <label class="addtoany_override a2a_kit_size_32">
383
- <input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if( !$options['button'] || $options['button']=='A2A_SVG_32' ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
384
  <span class="a2a_svg a2a_s_a2a" onclick="this.parentNode.firstChild.checked=true" style="margin-left:9px"></span>
385
  </label>
386
  <br>
@@ -388,95 +437,96 @@ function A2A_SHARE_SAVE_options_page() {
388
 
389
  <div class="addtoany_icon_size_small">
390
  <label>
391
- <input name="A2A_SHARE_SAVE_button" value="favicon.png|16|16" id="A2A_SHARE_SAVE_button_is_favicon_16" type="radio"<?php if($options['button']=='favicon.png|16|16') echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
392
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/favicon.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
393
  </label>
394
- <input name="A2A_SHARE_SAVE_button_favicon_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_favicon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
395
  <label style="padding-left:9px">
396
- <input name="A2A_SHARE_SAVE_button" value="share_16_16.png|16|16" id="A2A_SHARE_SAVE_button_is_share_icon_16" type="radio"<?php if($options['button']=='share_16_16.png|16|16') echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
397
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_16_16.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
398
  </label>
399
- <input name="A2A_SHARE_SAVE_button_share_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_share_icon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
400
  <br>
401
  <label>
402
- <input name="A2A_SHARE_SAVE_button" value="share_save_120_16.png|120|16" type="radio"<?php if($options['button']=='share_save_120_16.png|120|16') echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
403
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_120_16.png'; ?>" width="120" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
404
  </label>
405
  <br>
406
  <label>
407
- <input name="A2A_SHARE_SAVE_button" value="share_save_171_16.png|171|16" type="radio"<?php if($options['button']=='share_save_171_16.png|171|16') echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
408
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_171_16.png'; ?>" width="171" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
409
  </label>
410
  <br>
411
  <label>
412
- <input name="A2A_SHARE_SAVE_button" value="share_save_256_24.png|256|24" type="radio"<?php if($options['button']=='share_save_256_24.png|256|24') echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
413
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_256_24.png'; ?>" width="256" height="24" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
414
  </label>
415
  <br>
416
  </div>
417
 
418
  <label>
419
- <input name="A2A_SHARE_SAVE_button" value="CUSTOM" id="A2A_SHARE_SAVE_button_is_custom" type="radio"<?php if( $options['button'] == 'CUSTOM' ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
420
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
421
  </label>
422
- <input name="A2A_SHARE_SAVE_button_custom" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_custom').checked=true" style="vertical-align:middle" value="<?php echo $options['button_custom']; ?>" />
423
  <br>
424
  <label>
425
- <input name="A2A_SHARE_SAVE_button" value="TEXT" id="A2A_SHARE_SAVE_button_is_text" type="radio"<?php if( $options['button'] == 'TEXT' ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
426
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
427
  </label>
428
- <input name="A2A_SHARE_SAVE_button_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_text').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
429
  <br>
430
  <label>
431
- <input name="A2A_SHARE_SAVE_button" value="NONE" type="radio"<?php if( $options['button'] == 'NONE' ) echo ' checked="checked"'; ?> onclick="return confirm('<?php _e('This option will disable universal sharing. Are you sure you want to disable universal sharing?', 'add-to-any' ) ?>')" style="margin:9px 0;vertical-align:middle">
432
  <span style="margin:0 9px;vertical-align:middle"><?php _e("None"); ?></span>
433
  </label>
434
 
435
  </fieldset></td>
436
  </tr>
 
437
  <tr valign="top">
438
  <th scope="row"><?php _e('Placement', 'add-to-any'); ?></th>
439
  <td><fieldset>
440
  <label>
441
  <input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php
442
- if($options['display_in_posts']!='-1') echo ' checked="checked"'; ?> value="1"/>
443
  <?php printf(__('Display at the %s of posts', 'add-to-any'), position_in_content($options, TRUE)); ?> <strong>*</strong>
444
  </label>
445
  <br/>
446
  <label>
447
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php
448
- if($options['display_in_excerpts']!='-1') echo ' checked="checked"';
449
- if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
450
  ?> value="1"/>
451
  <?php printf(__('Display at the %s of post excerpts', 'add-to-any'), position_in_content($options)); ?>
452
  </label>
453
  <br/>
454
  <label>
455
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?php
456
- if($options['display_in_posts_on_front_page']!='-1') echo ' checked="checked"';
457
- if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
458
  ?> value="1"/>
459
  <?php printf(__('Display at the %s of posts on the front page', 'add-to-any'), position_in_content($options)); ?>
460
  </label>
461
  <br/>
462
  <label>
463
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_archive_pages" type="checkbox"<?php
464
- if($options['display_in_posts_on_archive_pages']!='-1') echo ' checked="checked"';
465
- if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
466
  ?> value="1"/>
467
  <?php printf(__('Display at the %s of posts on archive pages', 'add-to-any'), position_in_content($options)); ?>
468
  </label>
469
  <br/>
470
  <label>
471
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_feed" type="checkbox"<?php
472
- if($options['display_in_feed']!='-1') echo ' checked="checked"';
473
- if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
474
  ?> value="1"/>
475
  <?php printf(__('Display at the %s of posts in the feed', 'add-to-any'), position_in_content($options)); ?>
476
  </label>
477
  <br/>
478
  <label>
479
- <input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if($options['display_in_pages']!='-1') echo ' checked="checked"'; ?> value="1"/>
480
  <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content($options, TRUE)); ?>
481
  </label>
482
  <br/><br/>
@@ -489,16 +539,17 @@ function A2A_SHARE_SAVE_options_page() {
489
  </div>
490
  </fieldset></td>
491
  </tr>
 
492
  <tr valign="top">
493
  <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
494
  <td><fieldset>
495
  <label>
496
- <input name="A2A_SHARE_SAVE_onclick" type="checkbox"<?php if($options['onclick']=='1') echo ' checked="checked"'; ?> value="1"/>
497
  <?php _e('Only show the universal share menu when the user <em>clicks</em> the universal share button', 'add-to-any'); ?>
498
  </label>
499
  <br />
500
  <label>
501
- <input name="A2A_SHARE_SAVE_show_title" type="checkbox"<?php if($options['show_title']=='1') echo ' checked="checked"'; ?> value="1"/>
502
  <?php _e('Show the title of the page within the universal share menu', 'add-to-any'); ?>
503
  </label>
504
  <label>
@@ -522,9 +573,9 @@ function A2A_SHARE_SAVE_options_page() {
522
  <?php _e("Advanced users should explore AddToAny's <a href=\"http://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", "add-to-any"); ?></p>
523
  </label>
524
  <p>
525
- <textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php echo stripslashes($options['additional_js_variables']); ?></textarea>
526
  </p>
527
- <?php if( $options['additional_js_variables']!='' ) { ?>
528
  <label for="A2A_SHARE_SAVE_additional_js_variables" class="setting-description"><?php _e("<strong>Note</strong>: If you're adding new code, be careful not to accidentally overwrite any previous code.</label>", 'add-to-any'); ?>
529
  <?php } ?>
530
  </fieldset></td>
@@ -533,16 +584,16 @@ function A2A_SHARE_SAVE_options_page() {
533
  <th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
534
  <td><fieldset>
535
  <label for="A2A_SHARE_SAVE_custom_icons">
536
- <input name="A2A_SHARE_SAVE_custom_icons" id="A2A_SHARE_SAVE_custom_icons" type="checkbox"<?php if($options['custom_icons']=='url') echo ' checked="checked"'; ?> value="url"/>
537
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
538
  </label>
539
- <input name="A2A_SHARE_SAVE_custom_icons_url" type="text" class="code" size="50" style="vertical-align:middle" placeholder="//example.com/blog/uploads/addtoany/icons/custom/" value="<?php echo $options['custom_icons_url']; ?>" />
540
  <p class="description">
541
  <?php _e("Specify the URL of the directory containing your custom icons. For example, a URL of <code>//example.com/blog/uploads/addtoany/icons/custom/</code> containing <code>facebook.png</code> and <code>twitter.png</code>. Be sure that custom icon filenames match the icon filenames in <code>plugins/add-to-any/icons</code>. For AddToAny's Universal Button, select Image URL and specify the URL of your AddToAny universal share icon (<a href=\"#\" onclick=\"document.getElementsByName('A2A_SHARE_SAVE_button_custom')[0].focus();return false\">above</a>).", "add-to-any"); ?>
542
  </p>
543
  <br/>
544
  <label for="A2A_SHARE_SAVE_inline_css">
545
- <input name="A2A_SHARE_SAVE_inline_css" id="A2A_SHARE_SAVE_inline_css" type="checkbox"<?php if($options['inline_css']!='-1') echo ' checked="checked"'; ?> value="1"/>
546
  <?php _e('Use default CSS', 'add-to-any'); ?>
547
  </label>
548
  <p class="description">
@@ -550,7 +601,7 @@ function A2A_SHARE_SAVE_options_page() {
550
  </p>
551
  <br/>
552
  <label for="A2A_SHARE_SAVE_cache">
553
- <input name="A2A_SHARE_SAVE_cache" id="A2A_SHARE_SAVE_cache" type="checkbox"<?php if($options['cache']=='1') echo ' checked="checked"'; ?> value="1"/>
554
  <?php _e('Cache AddToAny locally with daily cache updates', 'add-to-any'); ?>
555
  </label>
556
  <p class="description">
@@ -558,6 +609,69 @@ function A2A_SHARE_SAVE_options_page() {
558
  </p>
559
  </fieldset></td>
560
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  </table>
562
 
563
  <p class="submit">
@@ -568,8 +682,8 @@ function A2A_SHARE_SAVE_options_page() {
568
  </form>
569
 
570
  <h2><?php _e('Like this plugin?','add-to-any'); ?></h2>
571
- <p><?php _e('<a href="http://wordpress.org/extend/plugins/add-to-any/">Give it a good rating</a> on WordPress.org.','add-to-any'); ?> <a href="http://www.facebook.com/AddToAny">Facebook</a> / <a href="http://twitter.com/AddToAny">Twitter</a></p>
572
- <p><?php _e('<a href="http://www.addtoany.com/share_save?linkname=WordPress%20Share%20%2F%20Bookmark%20Plugin%20by%20AddToAny.com&amp;linkurl=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fadd-to-any%2F">Share it</a> with your friends.','add-to-any'); ?></p>
573
 
574
  <h2><?php _e('Need support?','add-to-any'); ?></h2>
575
  <p><?php _e('See the <a href="http://wordpress.org/extend/plugins/add-to-any/faq/">FAQs</a>.','add-to-any'); ?></p>
@@ -782,14 +896,16 @@ function A2A_SHARE_SAVE_admin_head() {
782
 
783
  // Auto-select active services
784
  <?php
785
- $admin_services_saved = isset($_POST['A2A_SHARE_SAVE_active_services']) || isset($_POST['Submit']);
786
- $active_services = ( $admin_services_saved ) ? @$_POST['A2A_SHARE_SAVE_active_services'] : $options['active_services'];
787
 
788
- // Use default services if options have not been set yet (and no services were just saved in the form)
789
- if ( false === $options && ! $admin_services_saved )
 
 
 
 
790
  $active_services = array( 'facebook', 'twitter', 'google_plus' );
791
- elseif ( empty( $active_services ) )
792
- $active_services = array();
793
 
794
  $active_services_last = end($active_services);
795
  if($admin_services_saved)
@@ -808,24 +924,29 @@ function A2A_SHARE_SAVE_admin_head() {
808
 
809
  <?php
810
  // Special service options
811
- if ( isset($_POST['addtoany_facebook_like_verb']) && $_POST['addtoany_facebook_like_verb'] == 'recommend'
812
- || ! isset($_POST['addtoany_facebook_like_verb']) && $options['special_facebook_like_options']['verb'] == 'recommend') {
 
813
  ?>service_options.facebook_like = {verb: 'recommend'};<?php
814
  }
815
- if ( isset($_POST['addtoany_twitter_tweet_show_count']) && $_POST['addtoany_twitter_tweet_show_count'] == '1'
816
- || ! isset($_POST['addtoany_twitter_tweet_show_count']) && $options['special_twitter_tweet_options']['show_count'] == '1') {
 
817
  ?>service_options.twitter_tweet = {show_count: 1};<?php
818
  }
819
- if ( isset($_POST['addtoany_google_plusone_show_count']) && $_POST['addtoany_google_plusone_show_count'] == '1'
820
- || ! isset($_POST['addtoany_google_plusone_show_count']) && $options['special_google_plusone_options']['show_count'] == '1') {
 
821
  ?>service_options.google_plusone = {show_count: 1};<?php
822
  }
823
- if ( isset($_POST['addtoany_google_plus_share_show_count']) && $_POST['addtoany_google_plus_share_show_count'] == '1'
824
- || ! isset($_POST['addtoany_google_plus_share_show_count']) && $options['special_google_plus_share_options']['show_count'] == '1') {
 
825
  ?>service_options.google_plus_share = {show_count: 1};<?php
826
  }
827
- if ( isset($_POST['addtoany_pinterest_pin_show_count']) && $_POST['addtoany_pinterest_pin_show_count'] == '1'
828
- || ! isset($_POST['addtoany_pinterest_pin_show_count']) && $options['special_pinterest_pin_options']['show_count'] == '1') {
 
829
  ?>service_options.pinterest_pin = {show_count: 1};<?php
830
  }
831
  ?>
188
 
189
  // Make available services extensible via plugins, themes (functions.php), etc.
190
  $A2A_SHARE_SAVE_services = apply_filters( 'A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services );
191
+
192
+ // Which tab is selected?
193
+ $possible_screens = array( 'default', 'floating' );
194
+ $current_screen = ( isset( $_GET['action'] ) && in_array( $_GET['action'], $possible_screens ) ) ? $_GET['action'] : 'default';
195
+
196
  if ( isset( $_POST['Submit'] ) ) {
197
 
198
  // Nonce verification
199
  check_admin_referer( 'add-to-any-update-options' );
200
+
201
+ if ( 'floating' == $current_screen ) {
202
+ // Floating options screen
203
+
204
+ $possible_floating_values = array( 'left_docked', 'right_docked', 'none' );
205
+
206
+ $new_options['floating_vertical'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_vertical'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_vertical'] : 'none';
207
+ $new_options['floating_horizontal'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_horizontal'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal'] : 'none';
208
+
209
+ $new_options['floating_vertical_position'] = (
210
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] ) &&
211
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] )
212
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_position'] : '100';
213
+
214
+ $new_options['floating_vertical_offset'] = (
215
+ isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
216
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] )
217
+ ) ? $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] : '0';
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'] )
222
+ ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] : '0';
223
+
224
+ $new_options['floating_horizontal_offset'] = (
225
+ isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] ) &&
226
+ is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] )
227
+ ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] : '0';
228
+
229
  } else {
230
+ // Standard options screen
231
+
232
+ $new_options['position'] = ($_POST['A2A_SHARE_SAVE_position']) ? @$_POST['A2A_SHARE_SAVE_position'] : 'bottom';
233
+ $new_options['display_in_posts_on_front_page'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] == '1') ? '1' : '-1';
234
+ $new_options['display_in_posts_on_archive_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] == '1') ? '1' : '-1';
235
+ $new_options['display_in_excerpts'] = (@$_POST['A2A_SHARE_SAVE_display_in_excerpts']=='1') ? '1' : '-1';
236
+ $new_options['display_in_posts'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts']=='1') ? '1' : '-1';
237
+ $new_options['display_in_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_pages']=='1') ? '1' : '-1';
238
+ $new_options['display_in_feed'] = (@$_POST['A2A_SHARE_SAVE_display_in_feed']=='1') ? '1' : '-1';
239
+ $new_options['show_title'] = (@$_POST['A2A_SHARE_SAVE_show_title']=='1') ? '1' : '-1';
240
+ $new_options['onclick'] = (@$_POST['A2A_SHARE_SAVE_onclick'] == '1') ? '1' : '-1';
241
+ $new_options['icon_size'] = @$_POST['A2A_SHARE_SAVE_icon_size'];
242
+ $new_options['button'] = @$_POST['A2A_SHARE_SAVE_button'];
243
+ $new_options['button_custom'] = @$_POST['A2A_SHARE_SAVE_button_custom'];
244
+ $new_options['additional_js_variables'] = trim( @$_POST['A2A_SHARE_SAVE_additional_js_variables'] );
245
+ $new_options['custom_icons'] = (@$_POST['A2A_SHARE_SAVE_custom_icons']=='url') ? 'url' : '-1';
246
+ $new_options['custom_icons_url'] = @$_POST['A2A_SHARE_SAVE_custom_icons_url'];
247
+ $new_options['inline_css'] = (@$_POST['A2A_SHARE_SAVE_inline_css']=='1') ? '1' : '-1';
248
+ $new_options['cache'] = (@$_POST['A2A_SHARE_SAVE_cache']=='1') ? '1' : '-1';
249
+
250
+ // Schedule cache refresh?
251
+ if ( @$_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
252
+ A2A_SHARE_SAVE_schedule_cache();
253
+ A2A_SHARE_SAVE_refresh_cache();
254
+ } else {
255
+ A2A_SHARE_SAVE_unschedule_cache();
256
+ }
257
+
258
+ // Store desired text if 16 x 16px buttons or text-only is chosen:
259
+ if ( $new_options['button'] == 'favicon.png|16|16' )
260
+ $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text'];
261
+ elseif ( $new_options['button'] == 'share_16_16.png|16|16' )
262
+ $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_share_16_16_text'];
263
+ else
264
+ $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any');
265
+
266
+ // Store chosen individual services to make active
267
+ $active_services = array();
268
+ if ( ! isset( $_POST['A2A_SHARE_SAVE_active_services'] ) )
269
+ $_POST['A2A_SHARE_SAVE_active_services'] = array();
270
+ foreach ( $_POST['A2A_SHARE_SAVE_active_services'] as $dummy=>$sitename )
271
+ $active_services[] = substr( $sitename, 7 );
272
+ $new_options['active_services'] = $active_services;
273
+
274
+ // Store special service options
275
+ $new_options['special_facebook_like_options'] = array(
276
+ 'verb' => ( (@$_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' )
277
+ );
278
+ $new_options['special_twitter_tweet_options'] = array(
279
+ 'show_count' => ( ( @$_POST['addtoany_twitter_tweet_show_count'] == '1' ) ? '1' : '-1' )
280
+ );
281
+ $new_options['special_google_plusone_options'] = array(
282
+ 'show_count' => ( ( @$_POST['addtoany_google_plusone_show_count'] == '1' ) ? '1' : '-1' )
283
+ );
284
+ $new_options['special_google_plus_share_options'] = array(
285
+ 'show_count' => ( ( @$_POST['addtoany_google_plus_share_show_count'] == '1' ) ? '1' : '-1' )
286
+ );
287
+ $new_options['special_pinterest_pin_options'] = array(
288
+ 'show_count' => ( ( @$_POST['addtoany_pinterest_pin_show_count'] == '1' ) ? '1' : '-1' )
289
+ );
290
+
291
+ }
292
 
293
+ // Get all existing AddToAny options
294
+ $existing_options = get_option( 'addtoany_options' );
295
+
296
+ // Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs
297
+ if ( $existing_options ) {
298
+ $new_options = array_merge( $existing_options, $new_options );
299
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  update_option( 'addtoany_options', $new_options );
302
 
359
 
360
  <div class="wrap">
361
 
 
 
362
  <h2><?php _e( 'AddToAny Share Settings', 'add-to-any' ); ?></h2>
363
+
364
+ <h2 class="nav-tab-wrapper">
365
+ <a href="<?php echo admin_url( 'options-general.php?page=add-to-any.php' ); ?>" class="nav-tab<?php if ( 'default' == $current_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Standard' ); ?></a>
366
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'floating' ), admin_url( 'options-general.php?page=add-to-any.php' ) ) ); ?>" class="nav-tab<?php if ( 'floating' == $current_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Floating' ); ?></a>
367
+ </h2>
368
 
369
  <form id="addtoany_admin_form" method="post" action="">
370
 
371
  <?php wp_nonce_field('add-to-any-update-options'); ?>
372
+
373
  <table class="form-table">
374
+
375
+ <?php if ( 'default' == $current_screen ) : ?>
376
  <tr valign="top">
377
  <th scope="row"><?php _e("Icon Size", "add-to-any"); ?></th>
378
  <td><fieldset>
379
+ <label><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="32"<?php if ( ! isset( $options['icon_size'] ) || '32' == $options['icon_size'] ) echo ' checked="checked"'; ?>> <?php _e('Large', 'add-to-any'); ?></label>
380
  <br>
381
+ <label><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="16"<?php if ( isset( $options['icon_size'] ) && '16' == $options['icon_size'] ) echo ' checked="checked"'; ?>> <?php _e('Small', 'add-to-any'); ?></label>
382
  </fieldset></td>
383
  </tr>
384
 
429
  <td><fieldset>
430
  <div class="addtoany_icon_size_large">
431
  <label class="addtoany_override a2a_kit_size_32">
432
+ <input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
433
  <span class="a2a_svg a2a_s_a2a" onclick="this.parentNode.firstChild.checked=true" style="margin-left:9px"></span>
434
  </label>
435
  <br>
437
 
438
  <div class="addtoany_icon_size_small">
439
  <label>
440
+ <input name="A2A_SHARE_SAVE_button" value="favicon.png|16|16" id="A2A_SHARE_SAVE_button_is_favicon_16" type="radio"<?php if ( isset( $options['button'] ) && 'favicon.png|16|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
441
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/favicon.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
442
  </label>
443
+ <input name="A2A_SHARE_SAVE_button_favicon_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_favicon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && '' != trim( $options['button_text'] ) ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
444
  <label style="padding-left:9px">
445
+ <input name="A2A_SHARE_SAVE_button" value="share_16_16.png|16|16" id="A2A_SHARE_SAVE_button_is_share_icon_16" type="radio"<?php if ( isset( $options['button'] ) && 'share_16_16.png|16|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
446
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_16_16.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
447
  </label>
448
+ <input name="A2A_SHARE_SAVE_button_share_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_share_icon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && '' != trim( $options['button_text'] ) ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
449
  <br>
450
  <label>
451
+ <input name="A2A_SHARE_SAVE_button" value="share_save_120_16.png|120|16" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_120_16.png|120|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
452
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_120_16.png'; ?>" width="120" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
453
  </label>
454
  <br>
455
  <label>
456
+ <input name="A2A_SHARE_SAVE_button" value="share_save_171_16.png|171|16" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_171_16.png|171|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
457
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_171_16.png'; ?>" width="171" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
458
  </label>
459
  <br>
460
  <label>
461
+ <input name="A2A_SHARE_SAVE_button" value="share_save_256_24.png|256|24" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_256_24.png|256|24' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
462
  <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_256_24.png'; ?>" width="256" height="24" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
463
  </label>
464
  <br>
465
  </div>
466
 
467
  <label>
468
+ <input name="A2A_SHARE_SAVE_button" value="CUSTOM" id="A2A_SHARE_SAVE_button_is_custom" type="radio"<?php if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
469
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
470
  </label>
471
+ <input name="A2A_SHARE_SAVE_button_custom" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_custom').checked=true" style="vertical-align:middle" value="<?php if ( isset( $options['button_custom'] ) ) echo $options['button_custom']; ?>" />
472
  <br>
473
  <label>
474
+ <input name="A2A_SHARE_SAVE_button" value="TEXT" id="A2A_SHARE_SAVE_button_is_text" type="radio"<?php if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
475
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
476
  </label>
477
+ <input name="A2A_SHARE_SAVE_button_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_text').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && trim( '' != $options['button_text'] ) ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
478
  <br>
479
  <label>
480
+ <input name="A2A_SHARE_SAVE_button" value="NONE" type="radio"<?php if ( isset( $options['button'] ) && 'NONE' == $options['button'] ) echo ' checked="checked"'; ?> onclick="return confirm('<?php _e('This option will disable universal sharing. Are you sure you want to disable universal sharing?', 'add-to-any' ) ?>')" style="margin:9px 0;vertical-align:middle">
481
  <span style="margin:0 9px;vertical-align:middle"><?php _e("None"); ?></span>
482
  </label>
483
 
484
  </fieldset></td>
485
  </tr>
486
+
487
  <tr valign="top">
488
  <th scope="row"><?php _e('Placement', 'add-to-any'); ?></th>
489
  <td><fieldset>
490
  <label>
491
  <input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php
492
+ if ( ! isset( $options['display_in_posts'] ) || $options['display_in_posts'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
493
  <?php printf(__('Display at the %s of posts', 'add-to-any'), position_in_content($options, TRUE)); ?> <strong>*</strong>
494
  </label>
495
  <br/>
496
  <label>
497
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php
498
+ if ( ! isset( $options['display_in_excerpts'] ) || $options['display_in_excerpts'] != '-1' ) echo ' checked="checked"';
499
+ if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
500
  ?> value="1"/>
501
  <?php printf(__('Display at the %s of post excerpts', 'add-to-any'), position_in_content($options)); ?>
502
  </label>
503
  <br/>
504
  <label>
505
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?php
506
+ if ( ! isset( $options['display_in_posts_on_front_page'] ) || $options['display_in_posts_on_front_page'] != '-1' ) echo ' checked="checked"';
507
+ if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
508
  ?> value="1"/>
509
  <?php printf(__('Display at the %s of posts on the front page', 'add-to-any'), position_in_content($options)); ?>
510
  </label>
511
  <br/>
512
  <label>
513
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_archive_pages" type="checkbox"<?php
514
+ if ( ! isset( $options['display_in_posts_on_archive_pages'] ) || $options['display_in_posts_on_archive_pages'] != '-1' ) echo ' checked="checked"';
515
+ if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
516
  ?> value="1"/>
517
  <?php printf(__('Display at the %s of posts on archive pages', 'add-to-any'), position_in_content($options)); ?>
518
  </label>
519
  <br/>
520
  <label>
521
  &nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_feed" type="checkbox"<?php
522
+ if ( ! isset( $options['display_in_feed'] ) || $options['display_in_feed'] != '-1' ) echo ' checked="checked"';
523
+ if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
524
  ?> value="1"/>
525
  <?php printf(__('Display at the %s of posts in the feed', 'add-to-any'), position_in_content($options)); ?>
526
  </label>
527
  <br/>
528
  <label>
529
+ <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"/>
530
  <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content($options, TRUE)); ?>
531
  </label>
532
  <br/><br/>
539
  </div>
540
  </fieldset></td>
541
  </tr>
542
+
543
  <tr valign="top">
544
  <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
545
  <td><fieldset>
546
  <label>
547
+ <input name="A2A_SHARE_SAVE_onclick" type="checkbox"<?php if ( isset( $options['onclick'] ) && $options['onclick'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
548
  <?php _e('Only show the universal share menu when the user <em>clicks</em> the universal share button', 'add-to-any'); ?>
549
  </label>
550
  <br />
551
  <label>
552
+ <input name="A2A_SHARE_SAVE_show_title" type="checkbox"<?php if ( isset( $options['show_title'] ) && $options['show_title'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
553
  <?php _e('Show the title of the page within the universal share menu', 'add-to-any'); ?>
554
  </label>
555
  <label>
573
  <?php _e("Advanced users should explore AddToAny's <a href=\"http://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", "add-to-any"); ?></p>
574
  </label>
575
  <p>
576
+ <textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_js_variables'] ) ) echo stripslashes( $options['additional_js_variables'] ); ?></textarea>
577
  </p>
578
+ <?php if ( isset( $options['additional_js_variables'] ) && $options['additional_js_variables'] != '' ) { ?>
579
  <label for="A2A_SHARE_SAVE_additional_js_variables" class="setting-description"><?php _e("<strong>Note</strong>: If you're adding new code, be careful not to accidentally overwrite any previous code.</label>", 'add-to-any'); ?>
580
  <?php } ?>
581
  </fieldset></td>
584
  <th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
585
  <td><fieldset>
586
  <label for="A2A_SHARE_SAVE_custom_icons">
587
+ <input name="A2A_SHARE_SAVE_custom_icons" id="A2A_SHARE_SAVE_custom_icons" type="checkbox"<?php if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' ) echo ' checked="checked"'; ?> value="url"/>
588
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
589
  </label>
590
+ <input name="A2A_SHARE_SAVE_custom_icons_url" type="text" class="code" size="50" style="vertical-align:middle" placeholder="//example.com/blog/uploads/addtoany/icons/custom/" value="<?php if ( isset( $options['custom_icons_url'] ) ) echo $options['custom_icons_url']; ?>" />
591
  <p class="description">
592
  <?php _e("Specify the URL of the directory containing your custom icons. For example, a URL of <code>//example.com/blog/uploads/addtoany/icons/custom/</code> containing <code>facebook.png</code> and <code>twitter.png</code>. Be sure that custom icon filenames match the icon filenames in <code>plugins/add-to-any/icons</code>. For AddToAny's Universal Button, select Image URL and specify the URL of your AddToAny universal share icon (<a href=\"#\" onclick=\"document.getElementsByName('A2A_SHARE_SAVE_button_custom')[0].focus();return false\">above</a>).", "add-to-any"); ?>
593
  </p>
594
  <br/>
595
  <label for="A2A_SHARE_SAVE_inline_css">
596
+ <input name="A2A_SHARE_SAVE_inline_css" id="A2A_SHARE_SAVE_inline_css" type="checkbox"<?php if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
597
  <?php _e('Use default CSS', 'add-to-any'); ?>
598
  </label>
599
  <p class="description">
601
  </p>
602
  <br/>
603
  <label for="A2A_SHARE_SAVE_cache">
604
+ <input name="A2A_SHARE_SAVE_cache" id="A2A_SHARE_SAVE_cache" type="checkbox"<?php if ( isset( $options['cache'] ) && $options['cache'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
605
  <?php _e('Cache AddToAny locally with daily cache updates', 'add-to-any'); ?>
606
  </label>
607
  <p class="description">
609
  </p>
610
  </fieldset></td>
611
  </tr>
612
+ <?php endif; ?>
613
+
614
+ </table>
615
+
616
+ <?php if ( 'floating' == $current_screen ) : ?>
617
+
618
+ <p><?php _e('AddToAny &quot;floating&quot; share buttons stay in a fixed position even when the user scrolls.', "add-to-any"); ?></p>
619
+ <p><?php _e('Large icons from your currently selected buttons are displayed in your floating bar(s). 3rd party buttons (Like, Tweet, etc.) are not displayed.', "add-to-any"); ?></p>
620
+
621
+ <h3><?php _e('Vertical Buttons', "add-to-any"); ?></h3>
622
+ <table class="form-table">
623
+ <tr valign="top">
624
+ <th scope="row"><?php _e("Placement", "add-to-any"); ?></th>
625
+ <td><fieldset>
626
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="left_docked"<?php if ( isset( $options['floating_vertical'] ) && 'left_docked' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('Left docked', 'add-to-any'); ?></label>
627
+ <br>
628
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="right_docked"<?php if ( isset( $options['floating_vertical'] ) && 'right_docked' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('Right docked', 'add-to-any'); ?></label>
629
+ <br>
630
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="none"<?php if ( ! isset( $options['floating_vertical'] ) || 'none' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('None', 'add-to-any'); ?></label>
631
+ </fieldset></td>
632
+ </tr>
633
+ <tr valign="top">
634
+ <th scope="row"><?php _e("Position", "add-to-any"); ?></th>
635
+ <td><fieldset>
636
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_position'] ) ) echo $options['floating_vertical_position']; else echo '100'; ?>" class="small-text" /> pixels from top</label>
637
+ </fieldset></td>
638
+ </tr>
639
+ <tr valign="top">
640
+ <th scope="row"><?php _e("Offset", "add-to-any"); ?></th>
641
+ <td><fieldset>
642
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_offset'] ) ) echo $options['floating_vertical_offset']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
643
+ </fieldset></td>
644
+ </tr>
645
+ </table>
646
+
647
+ <h3><?php _e('Horizontal Buttons', "add-to-any"); ?></h3>
648
+ <table class="form-table">
649
+ <tr valign="top">
650
+ <th scope="row"><?php _e("Placement", "add-to-any"); ?></th>
651
+ <td><fieldset>
652
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="left_docked"<?php if ( isset( $options['floating_horizontal'] ) && 'left_docked' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('Left docked', 'add-to-any'); ?></label>
653
+ <br>
654
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="right_docked"<?php if ( isset( $options['floating_horizontal'] ) && 'right_docked' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('Right docked', 'add-to-any'); ?></label>
655
+ <br>
656
+ <label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="none"<?php if ( ! isset( $options['floating_horizontal'] ) || 'none' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('None', 'add-to-any'); ?></label>
657
+ </fieldset></td>
658
+ </tr>
659
+ <tr valign="top">
660
+ <th scope="row"><?php _e("Position", "add-to-any"); ?></th>
661
+ <td><fieldset>
662
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_position" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_position'] ) ) echo $options['floating_horizontal_position']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
663
+ </fieldset></td>
664
+ </tr>
665
+ <tr valign="top">
666
+ <th scope="row"><?php _e("Offset", "add-to-any"); ?></th>
667
+ <td><fieldset>
668
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_offset" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_offset'] ) ) echo $options['floating_horizontal_offset']; else echo '0'; ?>" class="small-text" /> pixels from bottom</label>
669
+ </fieldset></td>
670
+ </tr>
671
+ </table>
672
+
673
+ <?php endif; ?>
674
+
675
  </table>
676
 
677
  <p class="submit">
682
  </form>
683
 
684
  <h2><?php _e('Like this plugin?','add-to-any'); ?></h2>
685
+ <p><?php _e('<a href="http://wordpress.org/extend/plugins/add-to-any/">Give it a good rating</a> on WordPress.org.','add-to-any'); ?></p>
686
+ <p><?php _e('<a href="http://www.addtoany.com/share_save?linkname=WordPress%20Share%20%2F%20Bookmark%20Plugin%20by%20AddToAny.com&amp;linkurl=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fadd-to-any%2F">Share it</a> with your friends.','add-to-any'); ?> <a href="https://www.facebook.com/AddToAny" target="_blank">Facebook</a> / <a href="https://twitter.com/AddToAny" target="_blank">Twitter</a></p>
687
 
688
  <h2><?php _e('Need support?','add-to-any'); ?></h2>
689
  <p><?php _e('See the <a href="http://wordpress.org/extend/plugins/add-to-any/faq/">FAQs</a>.','add-to-any'); ?></p>
896
 
897
  // Auto-select active services
898
  <?php
899
+ $admin_services_saved = isset( $_POST['A2A_SHARE_SAVE_active_services'] ) && isset( $_POST['Submit'] );
 
900
 
901
+ if ( $admin_services_saved ) {
902
+ $active_services = $_POST['A2A_SHARE_SAVE_active_services'];
903
+ } elseif ( ! $admin_services_saved && isset( $options['active_services'] ) ) {
904
+ $active_services = $options['active_services'];
905
+ } else {
906
+ // Use default services if options have not been set yet (and no services were just saved in the form)
907
  $active_services = array( 'facebook', 'twitter', 'google_plus' );
908
+ }
 
909
 
910
  $active_services_last = end($active_services);
911
  if($admin_services_saved)
924
 
925
  <?php
926
  // Special service options
927
+ if ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend'
928
+ || ! isset( $_POST['addtoany_facebook_like_verb'] )
929
+ && isset( $options['special_facebook_like_options'] ) && $options['special_facebook_like_options']['verb'] == 'recommend' ) {
930
  ?>service_options.facebook_like = {verb: 'recommend'};<?php
931
  }
932
+ if ( isset( $_POST['addtoany_twitter_tweet_show_count'] ) && $_POST['addtoany_twitter_tweet_show_count'] == '1'
933
+ || ! isset( $_POST['addtoany_twitter_tweet_show_count'] )
934
+ && isset( $options['special_twitter_tweet_options'] ) && $options['special_twitter_tweet_options']['show_count'] == '1' ) {
935
  ?>service_options.twitter_tweet = {show_count: 1};<?php
936
  }
937
+ if ( isset( $_POST['addtoany_google_plusone_show_count'] ) && $_POST['addtoany_google_plusone_show_count'] == '1'
938
+ || ! isset( $_POST['addtoany_google_plusone_show_count'] )
939
+ && isset( $options['special_google_plusone_options'] ) && $options['special_google_plusone_options']['show_count'] == '1' ) {
940
  ?>service_options.google_plusone = {show_count: 1};<?php
941
  }
942
+ if ( isset( $_POST['addtoany_google_plus_share_show_count'] ) && $_POST['addtoany_google_plus_share_show_count'] == '1'
943
+ || ! isset( $_POST['addtoany_google_plus_share_show_count'] )
944
+ && isset( $options['special_google_plus_share_options'] ) && $options['special_google_plus_share_options']['show_count'] == '1' ) {
945
  ?>service_options.google_plus_share = {show_count: 1};<?php
946
  }
947
+ if ( isset( $_POST['addtoany_pinterest_pin_show_count'] ) && $_POST['addtoany_pinterest_pin_show_count'] == '1'
948
+ || ! isset( $_POST['addtoany_pinterest_pin_show_count'] )
949
+ && isset( $options['special_pinterest_pin_options'] ) && $options['special_pinterest_pin_options']['show_count'] == '1' ) {
950
  ?>service_options.pinterest_pin = {show_count: 1};<?php
951
  }
952
  ?>