AddToAny Share Buttons - Version 1.7.20

Version Description

  • Show the optional sharing header for WooCommerce standard share buttons placement
  • Harden the "Show sharing buttons" checkbox so it works when other plugins conflict
  • Escape attributes in admin (thanks Ricardo Sanchez)
  • Simplify initial a2a_config JS
Download this release

Release Info

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

Code changes from version 1.7.19 to 1.7.20

README.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.19
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
@@ -351,6 +351,12 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
351
 
352
  == Changelog ==
353
 
 
 
 
 
 
 
354
  = 1.7.19 =
355
  * Resolve issue in admin with [out-of-date PHP versions](https://secure.php.net/eol.php) below PHP 5.5
356
  * New icon color options in AddToAny settings
2
  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.9
6
+ Stable tag: 1.7.20
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
351
 
352
  == Changelog ==
353
 
354
+ = 1.7.20 =
355
+ * Show the optional sharing header for WooCommerce standard share buttons placement
356
+ * Harden the "Show sharing buttons" checkbox so it works when other plugins conflict
357
+ * Escape attributes in admin (thanks Ricardo Sanchez)
358
+ * Simplify initial `a2a_config` JS
359
+
360
  = 1.7.19 =
361
  * Resolve issue in admin with [out-of-date PHP versions](https://secure.php.net/eol.php) below PHP 5.5
362
  * New icon color options in AddToAny settings
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.19
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -768,9 +768,9 @@ function A2A_SHARE_SAVE_head_script() {
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
 
@@ -866,7 +866,7 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
866
  );
867
 
868
  // If a Sharing Header is set
869
- if ( isset( $options['header'] ) && '' != $options['header'] ) {
870
  $html_header = '<div class="addtoany_header">' . stripslashes( $options['header'] ) . '</div>';
871
  } else {
872
  $html_header = '';
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.20
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
768
 
769
  $javascript_header = "\n" . '<script type="text/javascript">' . "\n"
770
 
771
+ . 'window.a2a_config=window.a2a_config||{};'
772
+ . 'a2a_config.callbacks=a2a_config.overlays=[];'
773
+ . 'a2a_config.templates={};'
774
  . A2A_menu_locale()
775
  . $script_configs
776
 
866
  );
867
 
868
  // If a Sharing Header is set
869
+ if ( ! empty( $options['header'] ) ) {
870
  $html_header = '<div class="addtoany_header">' . stripslashes( $options['header'] ) . '</div>';
871
  } else {
872
  $html_header = '';
addtoany.admin.php CHANGED
@@ -35,7 +35,12 @@ function A2A_SHARE_SAVE_meta_box_content( $post ) {
35
 
36
  <p>
37
  <label for="enable_post_addtoany_sharing">
38
- <input type="checkbox" name="enable_post_addtoany_sharing" id="enable_post_addtoany_sharing" value="1" <?php checked( empty( $disabled ) ); ?>>
 
 
 
 
 
39
  <?php _e( 'Show sharing buttons.' , 'add-to-any'); ?>
40
  </label>
41
  <input type="hidden" name="addtoany_sharing_status_hidden" value="1" />
@@ -54,7 +59,7 @@ function A2A_SHARE_SAVE_meta_box_save( $post_id ) {
54
  if ( isset( $_POST['post_type'] ) ) {
55
  if ( current_user_can( 'edit_post', $post_id ) ) {
56
  if ( isset( $_POST['addtoany_sharing_status_hidden'] ) ) {
57
- if ( !isset( $_POST['enable_post_addtoany_sharing'] ) ) {
58
  update_post_meta( $post_id, 'sharing_disabled', 1 );
59
  } else {
60
  delete_post_meta( $post_id, 'sharing_disabled' );
@@ -288,7 +293,7 @@ function A2A_SHARE_SAVE_options_page() {
288
  $new_options['display_in_attachments'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_attachments'] ) && $_POST['A2A_SHARE_SAVE_display_in_attachments'] == '1' ) ? '1' : '-1';
289
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
290
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
291
- $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
292
  $new_options['icon_bg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_bg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_bg'] : 'original';
293
  $new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_bg_color'] : '#2a2a2a';
294
  $new_options['icon_fg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_fg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_fg'] : 'original';
@@ -383,7 +388,7 @@ function A2A_SHARE_SAVE_options_page() {
383
  delete_option( 'addtoany_options' );
384
  }
385
 
386
- $options = get_option( 'addtoany_options', array() );
387
 
388
  ?>
389
 
@@ -406,7 +411,7 @@ function A2A_SHARE_SAVE_options_page() {
406
  <tr valign="top">
407
  <th scope="row"><?php _e("Icon Style", 'add-to-any'); ?></th>
408
  <td><fieldset>
409
- <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>
410
  <br>
411
  <label>
412
  <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_bg">
@@ -416,7 +421,7 @@ function A2A_SHARE_SAVE_options_page() {
416
  </select>
417
  background
418
  </label>
419
- <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>
420
  <br>
421
  <label>
422
  <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_fg">
@@ -426,7 +431,7 @@ function A2A_SHARE_SAVE_options_page() {
426
  </select>
427
  foreground
428
  </label>
429
- <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>
430
  </fieldset></td>
431
  </tr>
432
 
@@ -499,13 +504,13 @@ function A2A_SHARE_SAVE_options_page() {
499
  <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">
500
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
501
  </label>
502
- <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']; ?>" />
503
  <br>
504
  <label>
505
  <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">
506
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
507
  </label>
508
- <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'); ?>" />
509
  <br>
510
  <label>
511
  <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">
@@ -525,7 +530,7 @@ function A2A_SHARE_SAVE_options_page() {
525
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
526
  <td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section" role="region">
527
  <label>
528
- <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( stripslashes( $options['header'] ) ); ?>" />
529
  </label>
530
  </fieldset></td>
531
  </tr>
@@ -631,7 +636,7 @@ function A2A_SHARE_SAVE_options_page() {
631
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
632
  </label>
633
  <p>
634
- <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>
635
  </p>
636
  </fieldset></td>
637
  </tr>
@@ -643,7 +648,7 @@ function A2A_SHARE_SAVE_options_page() {
643
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
644
  </label>
645
  <p>
646
- <textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_css'] ) ) echo stripslashes( $options['additional_css'] ); ?></textarea>
647
  </p>
648
  </fieldset></td>
649
  </tr>
@@ -654,14 +659,14 @@ function A2A_SHARE_SAVE_options_page() {
654
  <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"/>
655
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
656
  </label>
657
- <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']; ?>" />
658
  <br/>
659
  <label for="A2A_SHARE_SAVE_custom_icons_type"><?php _e('Filename extension', 'add-to-any'); ?></label>
660
- <input name="A2A_SHARE_SAVE_custom_icons_type" type="text" class="code" size="5" maxlength="4" placeholder="png" value="<?php if ( isset( $options['custom_icons_type'] ) ) echo $options['custom_icons_type']; else echo 'png'; ?>" />
661
  <label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width'); ?></label>
662
- <input name="A2A_SHARE_SAVE_custom_icons_width" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) echo $options['custom_icons_width']; ?>" class="small-text" />
663
  <label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height'); ?></label>
664
- <input name="A2A_SHARE_SAVE_custom_icons_height" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) echo $options['custom_icons_height']; ?>" class="small-text" />
665
  <p class="description">
666
  <?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'); ?>
667
  </p>
@@ -710,26 +715,26 @@ function A2A_SHARE_SAVE_options_page() {
710
  <label>
711
  <input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php
712
  if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
713
- Only display when screen is larger than <input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" value="<?php if ( isset( $options['floating_vertical_responsive_max_width'] ) ) echo $options['floating_vertical_responsive_max_width']; else echo '980'; ?>" class="small-text" /> pixels wide
714
  </label>
715
  </fieldset></td>
716
  </tr>
717
  <tr valign="top">
718
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
719
  <td><fieldset>
720
- <label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" value="<?php if ( isset( $options['floating_vertical_position'] ) ) echo $options['floating_vertical_position']; else echo '100'; ?>" class="small-text" /> pixels from top</label>
721
  </fieldset></td>
722
  </tr>
723
  <tr valign="top">
724
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
725
  <td><fieldset>
726
- <label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" 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>
727
  </fieldset></td>
728
  </tr>
729
  <tr valign="top">
730
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
731
  <td><fieldset>
732
- <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>
733
  </fieldset></td>
734
  </tr>
735
  <tr valign="top">
@@ -741,7 +746,7 @@ function A2A_SHARE_SAVE_options_page() {
741
  <option value="custom"<?php _a2a_selected_attr('custom', 'floating_vertical_bg', $options); ?>>Custom&#8230;</option>
742
  </select>
743
  </label>
744
- <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>
745
  </fieldset></td>
746
  </tr>
747
  </table>
@@ -764,26 +769,26 @@ function A2A_SHARE_SAVE_options_page() {
764
  <label>
765
  <input id="A2A_SHARE_SAVE_floating_horizontal_responsive" name="A2A_SHARE_SAVE_floating_horizontal_responsive" type="checkbox"<?php
766
  if ( ! isset( $options['floating_horizontal_responsive'] ) || $options['floating_horizontal_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
767
- Only display when screen is smaller than <input name="A2A_SHARE_SAVE_floating_horizontal_responsive_min_width" type="number" value="<?php if ( isset( $options['floating_horizontal_responsive_min_width'] ) ) echo $options['floating_horizontal_responsive_min_width']; else echo '981'; ?>" class="small-text" /> pixels wide
768
  </label>
769
  </fieldset></td>
770
  </tr>
771
  <tr valign="top">
772
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
773
  <td><fieldset>
774
- <label><input name="A2A_SHARE_SAVE_floating_horizontal_position" type="number" 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>
775
  </fieldset></td>
776
  </tr>
777
  <tr valign="top">
778
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
779
  <td><fieldset>
780
- <label><input name="A2A_SHARE_SAVE_floating_horizontal_offset" type="number" value="<?php if ( isset( $options['floating_horizontal_offset'] ) ) echo $options['floating_horizontal_offset']; else echo '0'; ?>" class="small-text" /> pixels from bottom</label>
781
  </fieldset></td>
782
  </tr>
783
  <tr valign="top">
784
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
785
  <td><fieldset>
786
- <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>
787
  </fieldset></td>
788
  </tr>
789
  <tr valign="top">
@@ -795,7 +800,7 @@ function A2A_SHARE_SAVE_options_page() {
795
  <option value="custom"<?php _a2a_selected_attr('custom', 'floating_horizontal_bg', $options); ?>>Custom&#8230;</option>
796
  </select>
797
  </label>
798
- <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>
799
  </fieldset></td>
800
  </tr>
801
  </table>
35
 
36
  <p>
37
  <label for="enable_post_addtoany_sharing">
38
+ <input type="checkbox" name="enable_post_addtoany_sharing" id="enable_post_addtoany_sharing" value="1"
39
+ <?php checked( empty( $disabled ) );
40
+ /* Have other known sharing checkboxes with the same option name
41
+ * inherit the AddToAny checkbox value on change
42
+ */ ?>
43
+ onchange="if (jQuery) jQuery('input[name=&quot;enable_post_sharing&quot;]').attr('checked', jQuery(this).is(':checked'))">
44
  <?php _e( 'Show sharing buttons.' , 'add-to-any'); ?>
45
  </label>
46
  <input type="hidden" name="addtoany_sharing_status_hidden" value="1" />
59
  if ( isset( $_POST['post_type'] ) ) {
60
  if ( current_user_can( 'edit_post', $post_id ) ) {
61
  if ( isset( $_POST['addtoany_sharing_status_hidden'] ) ) {
62
+ if ( ! isset( $_POST['enable_post_addtoany_sharing'] ) ) {
63
  update_post_meta( $post_id, 'sharing_disabled', 1 );
64
  } else {
65
  delete_post_meta( $post_id, 'sharing_disabled' );
293
  $new_options['display_in_attachments'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_attachments'] ) && $_POST['A2A_SHARE_SAVE_display_in_attachments'] == '1' ) ? '1' : '-1';
294
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
295
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
296
+ $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
297
  $new_options['icon_bg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_bg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_bg'] : 'original';
298
  $new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'] ) ? $_POST['A2A_SHARE_SAVE_icon_bg_color'] : '#2a2a2a';
299
  $new_options['icon_fg'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_fg'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_fg'] : 'original';
388
  delete_option( 'addtoany_options' );
389
  }
390
 
391
+ $options = stripslashes_deep( get_option( 'addtoany_options', array() ) );
392
 
393
  ?>
394
 
411
  <tr valign="top">
412
  <th scope="row"><?php _e("Icon Style", 'add-to-any'); ?></th>
413
  <td><fieldset>
414
+ <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'] ) ? esc_attr( $options['icon_size'] ) : '32'; ?>"> pixels</label>
415
  <br>
416
  <label>
417
  <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_bg">
421
  </select>
422
  background
423
  </label>
424
+ <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'] ) ? esc_attr( $options['icon_bg_color'] ) : '#2a2a2a'; ?>" data-default-color="#2a2a2a"></div>
425
  <br>
426
  <label>
427
  <select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_fg">
431
  </select>
432
  foreground
433
  </label>
434
+ <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'] ) ? esc_attr( $options['icon_fg_color'] ) : '#ffffff'; ?>" data-default-color="#ffffff"></div>
435
  </fieldset></td>
436
  </tr>
437
 
504
  <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">
505
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
506
  </label>
507
+ <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'] ) ) esc_attr_e( $options['button_custom'] ); ?>" />
508
  <br>
509
  <label>
510
  <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">
511
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
512
  </label>
513
+ <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'] ) ) ? esc_attr( $options['button_text'] ) : __('Share','add-to-any'); ?>" />
514
  <br>
515
  <label>
516
  <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">
530
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
531
  <td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section" role="region">
532
  <label>
533
+ <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) esc_attr_e( $options['header'] ); ?>" />
534
  </label>
535
  </fieldset></td>
536
  </tr>
636
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
637
  </label>
638
  <p>
639
+ <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 esc_textarea( $options['additional_js_variables'] ); ?></textarea>
640
  </p>
641
  </fieldset></td>
642
  </tr>
648
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
649
  </label>
650
  <p>
651
+ <textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_css'] ) ) echo esc_textarea( $options['additional_css'] ); ?></textarea>
652
  </p>
653
  </fieldset></td>
654
  </tr>
659
  <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"/>
660
  <?php _e('Use custom icons. URL:', 'add-to-any'); ?>
661
  </label>
662
+ <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'] ) ) esc_attr_e( $options['custom_icons_url'] ); ?>" />
663
  <br/>
664
  <label for="A2A_SHARE_SAVE_custom_icons_type"><?php _e('Filename extension', 'add-to-any'); ?></label>
665
+ <input name="A2A_SHARE_SAVE_custom_icons_type" type="text" class="code" size="5" maxlength="4" placeholder="png" value="<?php if ( isset( $options['custom_icons_type'] ) ) esc_attr_e( $options['custom_icons_type'] ); else echo 'png'; ?>" />
666
  <label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width'); ?></label>
667
+ <input name="A2A_SHARE_SAVE_custom_icons_width" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) esc_attr_e( $options['custom_icons_width'] ); ?>" class="small-text" />
668
  <label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height'); ?></label>
669
+ <input name="A2A_SHARE_SAVE_custom_icons_height" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) esc_attr_e( $options['custom_icons_height'] ); ?>" class="small-text" />
670
  <p class="description">
671
  <?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'); ?>
672
  </p>
715
  <label>
716
  <input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php
717
  if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
718
+ Only display when screen is larger than <input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" value="<?php if ( isset( $options['floating_vertical_responsive_max_width'] ) ) esc_attr_e( $options['floating_vertical_responsive_max_width'] ); else echo '980'; ?>" class="small-text" /> pixels wide
719
  </label>
720
  </fieldset></td>
721
  </tr>
722
  <tr valign="top">
723
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
724
  <td><fieldset>
725
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" value="<?php if ( isset( $options['floating_vertical_position'] ) ) esc_attr_e( $options['floating_vertical_position'] ); else echo '100'; ?>" class="small-text" /> pixels from top</label>
726
  </fieldset></td>
727
  </tr>
728
  <tr valign="top">
729
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
730
  <td><fieldset>
731
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" value="<?php if ( isset( $options['floating_vertical_offset'] ) ) esc_attr_e( $options['floating_vertical_offset'] ); else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
732
  </fieldset></td>
733
  </tr>
734
  <tr valign="top">
735
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
736
  <td><fieldset>
737
+ <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'] ) ) esc_attr_e( $options['floating_vertical_icon_size'] ); else echo '32'; ?>" class="small-text"> pixels</label>
738
  </fieldset></td>
739
  </tr>
740
  <tr valign="top">
746
  <option value="custom"<?php _a2a_selected_attr('custom', 'floating_vertical_bg', $options); ?>>Custom&#8230;</option>
747
  </select>
748
  </label>
749
+ <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'] ) ? esc_attr( $options['floating_vertical_bg_color'] ) : '#ffffff'; ?>" data-default-color="#ffffff"></div>
750
  </fieldset></td>
751
  </tr>
752
  </table>
769
  <label>
770
  <input id="A2A_SHARE_SAVE_floating_horizontal_responsive" name="A2A_SHARE_SAVE_floating_horizontal_responsive" type="checkbox"<?php
771
  if ( ! isset( $options['floating_horizontal_responsive'] ) || $options['floating_horizontal_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
772
+ Only display when screen is smaller than <input name="A2A_SHARE_SAVE_floating_horizontal_responsive_min_width" type="number" value="<?php if ( isset( $options['floating_horizontal_responsive_min_width'] ) ) esc_attr_e( $options['floating_horizontal_responsive_min_width'] ); else echo '981'; ?>" class="small-text" /> pixels wide
773
  </label>
774
  </fieldset></td>
775
  </tr>
776
  <tr valign="top">
777
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
778
  <td><fieldset>
779
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_position" type="number" value="<?php if ( isset( $options['floating_horizontal_position'] ) ) esc_attr_e( $options['floating_horizontal_position'] ); else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
780
  </fieldset></td>
781
  </tr>
782
  <tr valign="top">
783
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
784
  <td><fieldset>
785
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_offset" type="number" value="<?php if ( isset( $options['floating_horizontal_offset'] ) ) esc_attr_e( $options['floating_horizontal_offset'] ); else echo '0'; ?>" class="small-text" /> pixels from bottom</label>
786
  </fieldset></td>
787
  </tr>
788
  <tr valign="top">
789
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
790
  <td><fieldset>
791
+ <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'] ) ) esc_attr_e( $options['floating_horizontal_icon_size'] ); else echo '32'; ?>" class="small-text"> pixels</label>
792
  </fieldset></td>
793
  </tr>
794
  <tr valign="top">
800
  <option value="custom"<?php _a2a_selected_attr('custom', 'floating_horizontal_bg', $options); ?>>Custom&#8230;</option>
801
  </select>
802
  </label>
803
+ <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'] ) ? esc_attr( $options['floating_horizontal_bg_color'] ) : '#ffffff'; ?>" data-default-color="#ffffff"></div>
804
  </fieldset></td>
805
  </tr>
806
  </table>
addtoany.compat.php CHANGED
@@ -68,6 +68,13 @@ function addtoany_woocommerce_share() {
68
  ) {
69
  return;
70
  } else {
 
 
 
 
 
 
 
71
  // Display share buttons
72
  ADDTOANY_SHARE_SAVE_KIT();
73
  }
68
  ) {
69
  return;
70
  } else {
71
+ // If a Sharing Header is set
72
+ if ( ! empty( $options['header'] ) ) {
73
+ echo '<div class="addtoany_header">' . stripslashes( $options['header'] ) . '</div>';
74
+ } else {
75
+ $html_header = '';
76
+ }
77
+
78
  // Display share buttons
79
  ADDTOANY_SHARE_SAVE_KIT();
80
  }
addtoany.widgets.php CHANGED
@@ -86,7 +86,7 @@ class A2A_SHARE_SAVE_Widget extends WP_Widget {
86
  ?>
87
  <p>
88
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
89
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
90
  </p>
91
  <p>
92
  <a href="options-general.php?page=addtoany"><?php _e('AddToAny Settings', 'add-to-any'); ?>...</a>
@@ -215,11 +215,11 @@ class A2A_Follow_Widget extends WP_Widget {
215
  ?>
216
  <p>
217
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
218
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
219
  </p>
220
  <p>
221
  <label for="<?php echo $this->get_field_id( 'icon_size' ); ?>"><?php _e( 'Icon Size:', 'add-to-any' ); ?></label>
222
- <input class="widefat" id="<?php echo $this->get_field_id( 'icon_size' ); ?>" name="<?php echo $this->get_field_name( '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 $icon_size; ?>">
223
  <small>Pixels</small>
224
  </p>
225
  <?php foreach ( $services as $code => $service ) :
@@ -229,7 +229,7 @@ class A2A_Follow_Widget extends WP_Widget {
229
  ?>
230
  <p>
231
  <label for="<?php echo $this->get_field_id( $code_id ); ?>"><?php echo $label_text; ?></label>
232
- <input class="widefat" id="<?php echo $this->get_field_id( $code_id ); ?>" name="<?php echo $this->get_field_name( $code_id ); ?>" type="text" value="<?php echo esc_attr( $id_value ); ?>">
233
  <br>
234
  <small><?php echo str_replace( '${id}', '<u>ID</u>', $service['href'] ); ?></small>
235
  </p>
86
  ?>
87
  <p>
88
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
89
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>" />
90
  </p>
91
  <p>
92
  <a href="options-general.php?page=addtoany"><?php _e('AddToAny Settings', 'add-to-any'); ?>...</a>
215
  ?>
216
  <p>
217
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
218
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>" />
219
  </p>
220
  <p>
221
  <label for="<?php echo $this->get_field_id( 'icon_size' ); ?>"><?php _e( 'Icon Size:', 'add-to-any' ); ?></label>
222
+ <input class="widefat" id="<?php echo $this->get_field_id( 'icon_size' ); ?>" name="<?php echo $this->get_field_name( '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 esc_attr_e( $icon_size ); ?>">
223
  <small>Pixels</small>
224
  </p>
225
  <?php foreach ( $services as $code => $service ) :
229
  ?>
230
  <p>
231
  <label for="<?php echo $this->get_field_id( $code_id ); ?>"><?php echo $label_text; ?></label>
232
+ <input class="widefat" id="<?php echo $this->get_field_id( $code_id ); ?>" name="<?php echo $this->get_field_name( $code_id ); ?>" type="text" value="<?php esc_attr_e( $id_value ); ?>">
233
  <br>
234
  <small><?php echo str_replace( '${id}', '<u>ID</u>', $service['href'] ); ?></small>
235
  </p>