WordPress.org

Plugin Directory

Changeset 1655520


Ignore:
Timestamp:
05/11/17 22:26:05 (3 months ago)
Author:
micropat
Message:

1.7.11

  • Add icon size option to Follow buttons widget
  • Replace "Large" and "Small" icon size options with single field
  • Replace old universal buttons with custom button URLs
  • Update CSS to apply style to custom icon sizes
  • Always use HTTPS script and endpoints
Location:
add-to-any/trunk
Files:
1 added
8 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • add-to-any/trunk/README.txt

    r1646130 r1655520  
    33Tags: 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 
    44Requires at least: 3.7 
    5 Tested up to: 4.7 
    6 Stable tag: 1.7.10 
     5Tested up to: 4.8 
     6Stable tag: 1.7.11 
    77 
    88Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too. 
     
    217217You can create a plugin or customize the following example PHP code to add to your theme's functions.php file: 
    218218 
    219 `function addtoany_add_services( $services ) { 
     219`function addtoany_add_share_services( $services ) { 
    220220    $services['example_share_service'] = array( 
    221221        'name'        => 'Example Share Service', 
    222         'icon_url'    => 'https://www.google.com/favicon.ico', 
     222        'icon_url'    => 'https://www.example.com/my-icon.svg', 
    223223        'icon_width'  => 32, 
    224224        'icon_height' => 32, 
    225         'href'        => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME', 
     225        'href'        => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME', 
    226226    ); 
    227227    return $services; 
    228228} 
    229 add_filter( 'A2A_SHARE_SAVE_services', 'addtoany_add_services', 10, 1 );` 
     229add_filter( 'A2A_SHARE_SAVE_services', 'addtoany_add_share_services', 10, 1 );` 
    230230 
    231231= How can I add a custom follow button? = 
     
    235235    $services['example_follow_service'] = array( 
    236236        'name'        => 'Example Follow Service', 
    237         'icon_url'    => 'https://www.google.com/favicon.ico', 
     237        'icon_url'    => 'https://www.example.com/my-icon.svg', 
    238238        'icon_width'  => 32, 
    239239        'icon_height' => 32, 
     
    346346 
    347347== Changelog == 
     348 
     349= 1.7.11 = 
     350* Add icon size option to Follow buttons widget 
     351* Replace "Large" and "Small" icon size options with single field 
     352* Replace old universal buttons with custom button URLs 
     353* Update CSS to apply style to custom icon sizes 
     354* Always use HTTPS script and endpoints 
    348355 
    349356= 1.7.10 = 
  • add-to-any/trunk/add-to-any.php

    r1646130 r1655520  
    44Plugin URI: https://www.addtoany.com/ 
    55Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more. 
    6 Version: 1.7.10 
     6Version: 1.7.11 
    77Author: AddToAny 
    88Author URI: https://www.addtoany.com/ 
     
    2525$A2A_locale = ! isset ( $A2A_locale ) ? '' : $A2A_locale; 
    2626// Set plugin options 
    27 $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' ); 
    28  
    29 include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.compat.php' ); 
    30 include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.services.php' ); 
     27$A2A_SHARE_SAVE_options = get_option( 'addtoany_options', array() ); 
     28 
     29include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.compat.php'; 
     30include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.services.php'; 
    3131 
    3232function A2A_SHARE_SAVE_init() { 
    33     global $A2A_SHARE_SAVE_plugin_url_path, 
     33    global $A2A_SHARE_SAVE_plugin_dir, 
    3434        $A2A_SHARE_SAVE_plugin_basename,  
    3535        $A2A_SHARE_SAVE_options; 
    3636     
    37     if ( get_option( 'A2A_SHARE_SAVE_button' ) ) { 
    38         A2A_SHARE_SAVE_migrate_options(); 
    39         $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' ); 
    40     } 
    41      
     37    // Load the textdomain for translations 
    4238    load_plugin_textdomain( 'add-to-any', false, $A2A_SHARE_SAVE_plugin_basename . '/languages/' ); 
     39     
     40    // Update plugin options     
     41    $options = $A2A_SHARE_SAVE_options; 
     42    $old_buttons = array(  
     43        'share_save_256_24.gif|256|24', 'share_save_171_16.gif|171|16', 'share_save_120_16.gif|120|16', 
     44        'share_save_256_24.png|256|24', 'share_save_171_16.png|171|16', 'share_save_120_16.png|120|16', 
     45        'share_16_16.png|16|16', 'favicon.png|16|16', 
     46    ); 
     47     
     48    // If old button enabled 
     49    if ( ! empty( $options['button'] ) && in_array( $options['button'], $old_buttons ) ) { 
     50        include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.update.php'; 
     51        addtoany_update_options(); 
     52    } 
    4353} 
    4454add_filter( 'init', 'A2A_SHARE_SAVE_init' ); 
     
    8191// Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON 
    8292function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) { 
    83     $options = get_option( 'addtoany_options' ); 
     93    $options = get_option( 'addtoany_options', array() ); 
    8494     
    8595    $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false; 
     
    94104        'icon_size'        => isset( $options['icon_size'] ) ? $options['icon_size'] : '32', 
    95105    ); 
    96      
    97106     
    98107    $args = wp_parse_args( $args, $defaults ); 
     
    121130    } 
    122131     
    123     // Set a2a_kit_size_## class name unless "icon_size" is set to '16' 
     132    // Set a2a_kit_size_## class name 
    124133    if ( $custom_icons ) { 
    125134        // If vertical style (.a2a_vertical_style) 
     
    183192        $A2A_SHARE_SAVE_amp_icons_css; 
    184193     
    185     $options = get_option( 'addtoany_options' ); 
     194    $options = get_option( 'addtoany_options', array() ); 
    186195     
    187196    $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false; 
     
    212221    extract( $args ); 
    213222     
    214     $https_or_http = is_ssl() ? 'https' : 'http'; 
    215223    $is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false; 
    216224    $amp_css = '.a2a_dd img{background-color:#0166FF;}'; 
     
    228236        $custom_icons = true; 
    229237    } else { 
    230         // Packaged 16px icons 
     238        // Default to local SVGs (not an option currently) 
    231239        $icons_dir = $A2A_SHARE_SAVE_plugin_url_path . '/icons/'; 
    232         $icons_type = 'png'; 
     240        $icons_type = 'svg'; 
    233241    } 
    234242     
     
    329337            $amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . $safe_name . ' img{background-color:#' . $service['color'] . ';}' : ''; 
    330338             
    331             $url = ( isset( $href ) ) ? $href : $https_or_http . '://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&linkname=' . $linkname_enc; 
     339            $url = ( isset( $href ) ) ? $href : 'https://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&linkname=' . $linkname_enc; 
    332340            $src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type; 
    333341            $counter = ( $counter_enabled ) ? ' a2a_counter' : ''; 
     
    374382    global $A2A_SHARE_SAVE_plugin_url_path; 
    375383     
    376     $options = get_option( 'addtoany_options' ); 
     384    $options = get_option( 'addtoany_options', array() ); 
    377385     
    378386    $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false; 
     
    399407        'button_additional_classes' => '', 
    400408        'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32', 
    401         'no_small_icons' => false, 
    402409        'no_universal_button' => false, 
    403410    ); 
     
    417424    // If universal button is enabled 
    418425    if ( ! $args['no_universal_button'] ) { 
    419      
    420         if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button']  
    421             // Or, no_small_icons is true and a custom universal icon is not enabled (permitting a custom universal button in floating bar)  
    422             || isset( $no_small_icons ) && true == $no_small_icons && ( ! isset( $options['button'] ) || 'CUSTOM' != $options['button'] ) 
    423         ) { 
    424             // If AMP (Accelerated Mobile Page) 
    425             if ( $is_amp ) { 
    426                 $button_src    = 'https://static.addtoany.com/buttons/a2a.svg'; 
    427                 $button_width  = ! empty( $icon_size ) ? ' width="' . $icon_size .'"'  : ' width="32"'; 
    428                 $button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"'  : ' height="32"'; 
    429             } else { 
    430                 // Skip button IMG for A2A icon insertion 
    431                 $button_text = '';   
    432             } 
    433         } else if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) { 
     426         
     427        if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) { 
     428            // Custom button 
    434429            $button_src     = $options['button_custom']; 
    435430            $button_width   = ''; 
    436431            $button_height  = ''; 
    437432        } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) { 
     433            // Text-only button 
    438434            $button_text    = stripslashes( $options[ 'button_text'] ); 
    439             // Do not display universal icon (when large icons are used) 
     435            // Do not display universal icon 
    440436            $button_class  .= ' addtoany_no_icon'; 
    441437        } else { 
    442             $button_attrs   = explode( '|', $options['button'] ); 
    443             $button_fname   = $button_attrs[0]; 
    444             $button_width   = ' width="' . $button_attrs[1] . '"'; 
    445             $button_height  = ' height="' . $button_attrs[2] . '"'; 
    446             $button_src     = $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname; 
    447             $button_text    = ( isset( $options['button_text'] ) ) ? stripslashes( $options['button_text'] ) : 'Share' ; 
     438            // Default AddToAny button 
     439            if ( $is_amp ) { 
     440                // AMP (Accelerated Mobile Page) 
     441                $button_src    = 'https://static.addtoany.com/buttons/a2a.svg'; 
     442                $button_width  = ! empty( $icon_size ) ? ' width="' . $icon_size .'"'  : ' width="32"'; 
     443                $button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"'  : ' height="32"'; 
     444            } 
     445        } 
     446         
     447        if ( ! empty( $html_content ) ) { 
     448            $button = $html_content; 
     449        } elseif ( ! empty( $button_text ) ) { 
     450            $button = $button_text; 
     451        } elseif ( ! empty( $button_src ) ) { 
     452            $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share">'; 
     453        } else { 
     454            $button = ''; 
    448455        } 
    449456         
     
    451458        $button_additional_classes = ! empty( $args['button_additional_classes'] ) ? ' ' . $args['button_additional_classes'] : ''; 
    452459         
    453         $style = ''; 
    454          
    455         if ( isset( $button_fname ) && ( $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) ) { 
    456             if ( ! $is_feed ) { 
    457                 $style_bg   = 'background:url(' . $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname . ') no-repeat scroll 4px 0px;'; 
    458                 $style      = ' style="' . $style_bg . 'padding:0 0 0 25px;display:inline-block;height:16px;vertical-align:middle"'; // padding-left:21+4 (4=other icons padding) 
    459                  
    460                 // Wrap in <span> to avoid showing the core-AddToAny Kit icon in addition to plugin's icon 
    461                 $button_text = ( isset( $button_text ) ) ? '<span>' . $button_text . '</span>' : '<span></span>'; 
    462             } 
    463         } 
    464          
    465         if ( ! empty( $html_content ) ) { 
    466             $button = $html_content; 
    467         } elseif ( isset( $button_text ) && ( ! isset( $button_fname) || ! $button_fname || $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) ) { 
    468             $button = $button_text; 
    469         } else { 
    470             $style = ''; 
    471             $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share"/>'; 
    472         } 
    473          
    474460        if ( isset( $options['button_show_count'] ) && $options['button_show_count'] == '1' ) { 
    475461            $button_class .= ' a2a_counter'; 
     
    477463         
    478464        $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . $button_additional_classes . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"' 
    479             . $button_data_url . $button_data_title . $button_data_media . $style . $button_target 
     465            . $button_data_url . $button_data_title . $button_data_media . $button_target 
    480466            . '>' . $button . '</a>'; 
    481467     
     
    501487    } 
    502488     
    503     $options = get_option( 'addtoany_options' ); 
     489    $options = get_option( 'addtoany_options', array() ); 
    504490     
    505491    $linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : false; 
     
    583569 
    584570function ADDTOANY_FOLLOW_KIT( $args = array() ) { 
     571    $options = get_option( 'addtoany_options', array() ); 
     572     
    585573    // Args are passed on to ADDTOANY_SHARE_SAVE_KIT 
    586574    $defaults = array( 
     
    596584        'no_special_services' => true, 
    597585        'no_universal_button' => true, 
    598         //'no_small_icons' => true, 
    599586        'kit_additional_classes' => '', 
    600587        'kit_style' => '', 
     588        'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32', 
    601589        'services' => array(), 
    602590    ); 
     
    623611 
    624612function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) { 
    625     $options = get_option( 'addtoany_options' ); 
     613    $options = get_option( 'addtoany_options', array() ); 
    626614     
    627615    $floating_html = ''; 
     
    655643        'no_addtoany_list_classname' => true, 
    656644        'no_special_services' => true, 
    657         'no_small_icons' => true, 
    658645        'kit_additional_classes' => '', 
    659646        'kit_style' => '', 
     
    739726        return; 
    740727         
    741     $options = get_option( 'addtoany_options' ); 
    742      
    743     $https_or_http = is_ssl() ? 'https' : 'http'; 
     728    $options = get_option( 'addtoany_options', array() ); 
    744729 
    745730    // Use local cache? 
    746731    $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false; 
    747732    $upload_dir = wp_upload_dir(); 
    748     $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $https_or_http . '://static.addtoany.com/menu'; 
     733    $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu'; 
    749734     
    750735    // Enternal script call + initial JS + set-once variables 
     
    807792     
    808793    $is_feed = is_feed(); 
    809     $options = get_option( 'addtoany_options' ); 
     794    $options = get_option( 'addtoany_options', array() ); 
    810795    $post_type = get_post_type( get_the_ID() ); 
    811796     
     
    931916    if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' && ! is_admin() ) { 
    932917     
    933         wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.13' ); 
     918        wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.14' ); 
    934919     
    935920        // wp_add_inline_style requires WP 3.3+ 
     
    10691054 
    10701055if ( is_admin() ) { 
    1071     include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.admin.php' ); 
     1056    include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.admin.php'; 
    10721057} 
    10731058 
     
    10901075    global $A2A_SHARE_SAVE_plugin_dir; 
    10911076     
    1092     include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.widgets.php' ); 
     1077    include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.widgets.php'; 
    10931078    register_widget( 'A2A_SHARE_SAVE_Widget' ); 
    10941079    register_widget( 'A2A_Follow_Widget' ); 
  • add-to-any/trunk/addtoany.admin.php

    r1645343 r1655520  
    77    $post_types = get_post_types( array( 'public' => true ) ); 
    88     
    9     $options = get_option( 'addtoany_options' ); 
     9    $options = get_option( 'addtoany_options', array() ); 
    1010     
    1111    $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) ); 
     
    7070add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' ); 
    7171add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' ); 
    72  
    73 /** 
    74  * Migrate old AddToAny options 
    75  */ 
    76 function A2A_SHARE_SAVE_migrate_options() { 
    77      
    78     $options = array( 
    79         'inline_css' => '1', // Modernly used for "Use CSS Stylesheet?" 
    80         'cache' => '-1', 
    81         'display_in_posts_on_front_page' => '1', 
    82         'display_in_posts_on_archive_pages' => '1', 
    83         'display_in_posts' => '1', 
    84         'display_in_pages' => '1', 
    85         'display_in_feed' => '1', 
    86         'onclick' => '-1', 
    87         'button' => 'A2A_SVG_32', 
    88         'button_custom' => '', 
    89         'additional_js_variables' => '', 
    90         'button_text' => 'Share', 
    91         'display_in_excerpts' => '1', 
    92         'active_services' => Array(), 
    93     ); 
    94      
    95     $namespace = 'A2A_SHARE_SAVE_'; 
    96      
    97     foreach ( $options as $option_name => $option_value ) { 
    98         $old_option_name = $namespace . $option_name; 
    99         $old_option_value = get_option( $old_option_name ); 
    100          
    101         if( $old_option_value === false ) { 
    102             // Default value 
    103             $options[ $option_name ] = $option_value; 
    104         } else { 
    105             // Old value 
    106             $options[ $option_name ] = $old_option_value; 
    107         } 
    108          
    109         delete_option( $old_option_name ); 
    110     } 
    111      
    112     update_option( 'addtoany_options', $options ); 
    113      
    114     $deprecated_options = array( 
    115         'button_opens_new_window', 
    116         'hide_embeds', 
    117         'show_title', 
    118     ); 
    119      
    120     foreach ( $deprecated_options as $option_name ) { 
    121         delete_option( $namespace . $option_name ); 
    122     } 
    123      
    124 } 
    12572 
    12673/** 
     
    286233            $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1'; 
    287234            $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1'; 
    288             $new_options['icon_size'] = ( isset( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : ''; 
     235            $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32'; 
    289236            $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : ''; 
    290237            $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : ''; 
     
    316263            } 
    317264             
    318             // Store desired text if 16 x 16px buttons or text-only is chosen: 
    319             if ( $new_options['button'] == 'favicon.png|16|16' ) 
    320                 $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text']; 
    321             elseif ( $new_options['button'] == 'share_16_16.png|16|16' ) 
    322                 $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_share_16_16_text']; 
    323             else 
    324                 $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any'); 
     265            // Store desired text for text-only: 
     266            $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any'); 
    325267                 
    326268            // Store chosen individual services to make active 
     
    362304         
    363305        // Get all existing AddToAny options 
    364         $existing_options = get_option( 'addtoany_options' ); 
     306        $existing_options = get_option( 'addtoany_options', array() ); 
    365307         
    366308        // Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs 
     
    382324    } 
    383325 
    384     $options = get_option( 'addtoany_options' ); 
     326    $options = get_option( 'addtoany_options', array() ); 
    385327     
    386328    function position_in_content( $options, $option_box = false ) { 
     
    445387            <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th> 
    446388            <td><fieldset> 
    447                 <label title="32px"><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> 
    448                 <br> 
    449                 <label title="16px"><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> 
    450                 <br> 
    451                 <label><input type="radio" name="A2A_SHARE_SAVE_icon_size"<?php if ( isset( $options['icon_size'] ) && ! in_array( $options['icon_size'], array( '32', '16' ) ) ) echo ' value="' . $options['icon_size'] . '" checked="checked"'; ?>> <?php _e('Custom', 'add-to-any'); ?></label> 
    452                 <input class="addtoany_icon_size_custom small-text" id="A2A_SHARE_SAVE_icon_size_custom" maxlength="3" type="text" onclick="document.getElementsByName('A2A_SHARE_SAVE_icon_size')[2].checked=true" value="<?php if ( isset( $options['icon_size'] ) && ! in_array( $options['icon_size'], array( '32', '16' ) ) ) echo $options['icon_size']; ?>"> 
    453                 <label class="addtoany_icon_size_custom" for="A2A_SHARE_SAVE_icon_size_custom">pixels</label> 
     389                <label><input class="small-text" name="A2A_SHARE_SAVE_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo ! empty( $options['icon_size'] ) ? $options['icon_size'] : '32'; ?>"> pixels</label> 
    454390            </fieldset></td> 
    455391            </tr> 
     
    512448                </div> 
    513449                 
    514                 <div class="addtoany_icon_size_small"> 
    515                     <label> 
    516                         <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"> 
    517                         <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"/> 
    518                     </label> 
    519                     <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'); ?>" /> 
    520                     <label style="padding-left:9px"> 
    521                         <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"> 
    522                         <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"/> 
    523                     </label> 
    524                     <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'); ?>" /> 
    525                     <br> 
    526                     <label> 
    527                         <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"> 
    528                         <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"/> 
    529                     </label> 
    530                     <br> 
    531                     <label> 
    532                         <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"> 
    533                         <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"/> 
    534                     </label> 
    535                     <br> 
    536                     <label> 
    537                         <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"> 
    538                         <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"/> 
    539                     </label> 
    540                     <br> 
    541                 </div> 
    542                  
    543450                <label> 
    544451                    <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"> 
     
    705612                <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'; ?>" /> 
    706613                <label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width'); ?></label> 
    707                 <input name="A2A_SHARE_SAVE_custom_icons_width" type="number" step="1" min="0" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) echo $options['custom_icons_width']; ?>" class="small-text" /> 
     614                <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" /> 
    708615                <label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height'); ?></label> 
    709                 <input name="A2A_SHARE_SAVE_custom_icons_height" type="number" step="1" min="0" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) echo $options['custom_icons_height']; ?>" class="small-text" /> 
     616                <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" /> 
    710617                <p class="description"> 
    711618                    <?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'); ?> 
     
    756663                    <input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php  
    757664                        if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" /> 
    758                     Only display when screen is larger than <input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" step="1" 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 
     665                    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 
    759666                </label> 
    760667            </fieldset></td> 
     
    763670            <th scope="row"><?php _e("Position", 'add-to-any'); ?></th> 
    764671            <td><fieldset> 
    765                 <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> 
     672                <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> 
    766673            </fieldset></td> 
    767674            </tr> 
     
    769676            <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th> 
    770677            <td><fieldset> 
    771                 <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> 
     678                <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> 
    772679            </fieldset></td> 
    773680            </tr> 
     
    775682            <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th> 
    776683            <td><fieldset> 
    777                 <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" maxlength="3" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label> 
     684                <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label> 
    778685            </fieldset></td> 
    779686            </tr> 
     
    798705                    <input id="A2A_SHARE_SAVE_floating_horizontal_responsive" name="A2A_SHARE_SAVE_floating_horizontal_responsive" type="checkbox"<?php  
    799706                        if ( ! isset( $options['floating_horizontal_responsive'] ) || $options['floating_horizontal_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" /> 
    800                     Only display when screen is smaller than <input name="A2A_SHARE_SAVE_floating_horizontal_responsive_min_width" type="number" step="1" 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 
     707                    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 
    801708                </label> 
    802709            </fieldset></td> 
     
    805712            <th scope="row"><?php _e("Position", 'add-to-any'); ?></th> 
    806713            <td><fieldset> 
    807                 <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> 
     714                <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> 
    808715            </fieldset></td> 
    809716            </tr> 
     
    811718            <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th> 
    812719            <td><fieldset> 
    813                 <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> 
     720                <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> 
    814721            </fieldset></td> 
    815722            </tr> 
     
    817724            <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th> 
    818725            <td><fieldset> 
    819                 <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" maxlength="3" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label> 
     726                <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label> 
    820727            </fieldset></td> 
    821728            </tr> 
     
    856763    if ( isset( $_GET['page'] ) && $_GET['page'] == 'addtoany' ) { 
    857764         
    858         $options = get_option( 'addtoany_options' ); 
     765        $options = get_option( 'addtoany_options', array() ); 
    859766         
    860767    ?> 
    861768    <script type="text/javascript"><!-- 
    862769    jQuery(document).ready(function(){ 
    863          
    864         var show_appropriate_universal_buttons = function() { 
    865              
    866             // Note the currently checkmarked radio button 
    867             jQuery('input[name="A2A_SHARE_SAVE_button"]:visible').removeClass('addtoany_last_universal_selected').filter(':checked').addClass('addtoany_last_universal_selected'); 
    868              
    869             var select_proper_radio = function() { 
    870                 // Select the last-selected visible radio 
    871                 jQuery('input[name="A2A_SHARE_SAVE_button"].addtoany_last_universal_selected:radio:visible').attr('checked', true); 
    872                  
    873                 // Otherwise select the first visible radio 
    874                 if ( jQuery('input[name="A2A_SHARE_SAVE_button"]:visible:checked').length < 1 ) 
    875                     jQuery('input[name="A2A_SHARE_SAVE_button"]:radio:visible:first').attr('checked', true); 
    876             }; 
    877              
    878             var icon_size_value = jQuery('input[name="A2A_SHARE_SAVE_icon_size"]:checked').val(); 
    879              
    880             if ( '16' == icon_size_value ) { 
    881                 // Hide large universal buttons 
    882                 jQuery('.addtoany_icon_size_large').hide('fast'); 
    883                 // Show small universal button 
    884                 jQuery('.addtoany_icon_size_small').show('fast', select_proper_radio); 
    885             } 
    886             else { 
    887                 // Hide small universal buttons 
    888                 jQuery('.addtoany_icon_size_small').hide('fast'); 
    889                 // Show large universal button 
    890                 jQuery('.addtoany_icon_size_large').show('fast', select_proper_radio); 
    891             } 
    892              
    893             if ( 0 < icon_size_value.length && 16 != icon_size_value && 32 != icon_size_value ) { 
    894                 jQuery('.addtoany_icon_size_custom').show('fast'); 
    895             } 
    896         }; 
    897          
    898         show_appropriate_universal_buttons(); 
    899          
    900         // Display buttons/icons of the selected icon size 
    901         jQuery('input[name="A2A_SHARE_SAVE_icon_size"]').bind('change', function(e){ 
    902             show_appropriate_universal_buttons(); 
    903         }); 
    904          
    905         // Set value on radio from custom text input 
    906         jQuery('#A2A_SHARE_SAVE_icon_size_custom').bind('change', function(e){ 
    907             jQuery('input[name="A2A_SHARE_SAVE_icon_size"]').eq(2).val( jQuery('#A2A_SHARE_SAVE_icon_size_custom').val() ); 
    908         }); 
    909770         
    910771        // Toggle child options of 'Display in posts' 
     
    1003864            } 
    1004865             
    1005             var icon_size = jQuery('input:radio[name=A2A_SHARE_SAVE_icon_size]:checked').val(); 
    1006             icon_size = ('16' == icon_size) ? '16' : '32'; 
    1007              
    1008866            var new_service = this_service.toggleClass('addtoany_selected') 
    1009867                    .unbind('click', moveToSortableList) 
     
    1011869                    .clone(); 
    1012870             
    1013             new_service.data('a2a_16_icon_html', this_service.find('img').clone().attr('alt', this_service.attr('title')).wrap('<p>').parent().html() + configurable_html); 
    1014              
    1015             // Set the same HTML as used for '16px icon size' 
    1016             new_service.data( 'a2a_32_icon_html', new_service.data('a2a_16_icon_html') ); 
     871            new_service.data('a2a_32_icon_html', this_service.find('img').clone().attr('alt', this_service.attr('title')).wrap('<p>').parent().html() + configurable_html); 
    1017872                 
    1018             new_service.html( new_service.data('a2a_' + icon_size + '_icon_html') ) 
     873            new_service.html( new_service.data('a2a_32_icon_html') ) 
    1019874                .click(function(){ 
    1020875                    jQuery(this).not('.addtoany_special_service_options_selected').find('.special_options').slideDown('fast').parent().addClass('addtoany_special_service_options_selected'); 
     
    11531008    .addtoany_admin_list li{border-radius:6px;} 
    11541009     
    1155     .addtoany_icon_size_custom, 
    1156       /* Override WP display */ 
    1157       .form-table td fieldset label.addtoany_icon_size_custom{display:none;} 
    1158      
    11591010    #addtoany_services_selectable{clear:left;display:none;} 
    11601011    #addtoany_services_selectable li{cursor:pointer;float:left;width:150px;font-size:12px;line-height:24px;margin:0;padding:6px;border:1px solid transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;} 
  • add-to-any/trunk/addtoany.min.css

    r1534026 r1655520  
    1 .addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a,.widget .addtoany_list a{border:0;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;display:inline-block;height:auto;opacity:1;overflow:hidden;vertical-align:baseline;width:auto}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a > span{border-radius:4px;display:inline-block;height:32px;line-height:32px;opacity:1;width:32px}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover,.widget .addtoany_list a:hover{border:0;box-shadow:none}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service iframe,.addtoany_special_service div.fb_iframe_widget,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{display:inline;max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto} 
     1.addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a,.widget .addtoany_list a{border:0;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;display:inline-block;opacity:1;overflow:hidden;vertical-align:baseline}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a>span{height:32px;line-height:32px;width:32px}.addtoany_list a>span{border-radius:4px;display:inline-block;opacity:1}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover,.widget .addtoany_list a:hover{border:0;box-shadow:none}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service div.fb_iframe_widget,.addtoany_special_service iframe,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{display:inline;max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto} 
  • add-to-any/trunk/addtoany.widgets.php

    r1397479 r1655520  
    7575    public function update( $new_instance, $old_instance ) { 
    7676        $instance = $old_instance; 
    77         $instance['title'] = strip_tags( $new_instance['title'] ); 
     77        $instance['title'] = sanitize_text_field( $new_instance['title'] ); 
    7878        return $instance; 
    7979    } 
     
    131131     */ 
    132132    public function widget( $args = array(), $instance ) { 
    133      
    134133        global $A2A_SHARE_SAVE_plugin_url_path; 
    135134         
     
    146145        echo $before_widget; 
    147146         
    148         if ( isset( $instance ) && ! empty( $instance['title'] ) ) { 
     147        $instance = is_array( $instance ) ? $instance : array(); 
     148         
     149        if ( ! empty( $instance['title'] ) ) { 
    149150            $title = apply_filters( 'widget_title', $instance['title'] ); 
    150151            echo $before_title . $title . $after_title; 
     
    165166        ADDTOANY_FOLLOW_KIT( array( 
    166167            'buttons' => $active_services, 
     168            'icon_size' => ! empty( $instance['icon_size'] ) ? $instance['icon_size'] : '32', 
    167169        ) ); 
    168170 
     
    176178     */ 
    177179    public function update( $new_instance, $old_instance ) { 
    178         $instance = $old_instance; 
    179         $instance['title'] = strip_tags( $new_instance['title'] ); 
     180        $instance = (array) $old_instance; 
     181        $instance['title'] = sanitize_text_field( $new_instance['title'] ); 
     182        $instance['icon_size'] = sanitize_text_field( $new_instance['icon_size'] ); 
    180183         
    181184        // Accept service IDs 
     
    184187            $code_id = $code . '_id'; 
    185188            if ( isset( $new_instance[ $code_id ] ) ) { 
    186                 $instance[ $code_id ] = strip_tags( $new_instance[ $code_id ] ); 
     189                $instance[ $code_id ] = sanitize_text_field( $new_instance[ $code_id ] ); 
    187190            } 
    188191        } 
     
    195198     */ 
    196199    public function form( $instance ) { 
     200        $instance = is_array( $instance ) ? $instance : array(); 
     201        $options = get_option( 'addtoany_options', array() ); 
    197202        $services = $this->get_follow_services(); 
    198203         
    199         $title = isset( $instance ) && ! empty( $instance['title'] ) ? __( $instance['title'] ) : ''; 
     204        $title = ! empty( $instance['title'] ) ? __( $instance['title'] ) : ''; 
     205         
     206        if ( ! empty( $instance['icon_size'] ) ) { 
     207            $icon_size = $instance['icon_size']; 
     208        } elseif ( ! empty( $options['icon_size'] ) ) { 
     209            // Fallback to standard icon size if saved 
     210            $icon_size = $options['icon_size']; 
     211        } else { 
     212            $icon_size = '32'; 
     213        } 
     214         
    200215        ?> 
    201216        <p> 
    202217            <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>  
    203218            <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> 
    204224        </p> 
    205225<?php foreach ( $services as $code => $service ) :  
Note: See TracChangeset for help on using the changeset viewer.