WordPress.org

Plugin Directory

Changeset 1394811 for add-to-any


Ignore:
Timestamp:
04/13/2016 10:22:33 PM (2 years ago)
Author:
micropat
Message:
  • AddToAny widgets support new selective refresh in the WordPress 4.5 Customizer
  • AddToAny share endpoints default to HTTPS on HTTPS sites
  • Permit changing the target attribute for custom services (thanks Jasper)
  • The meta box ("Show sharing buttons") below the WordPress editor will no longer show when standard placement is disabled for the current post type
  • Add Kik share button
  • Add Skype share button
  • Add Viber share button
  • Add WeChat share button
  • Add Snapchat follow button
Location:
add-to-any/trunk
Files:
6 added
5 edited

Legend:

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

    r1363025 r1394811  
    11=== AddToAny Share Buttons ===
    22Contributors: micropat, addtoany
    3 Tags: AddToAny, sharing, share, social, share button, share buttons, share links, social icons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, amp, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
     3Tags: AddToAny, sharing, share, social, share button, share buttons, share links, social icons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, amp, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
    44Requires at least: 2.8
    55Tested up to: 4.5
    6 Stable tag: 1.6.14
     6Stable tag: 1.6.15
    77
    88Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
     
    6363= Wide Support =
    6464
    65 * Over 8 years of active development
    66 * Over 4 million downloads
     65* Over 9 years of active development
     66* Over 5 million downloads
    6767* Translated into dozens of languages
    6868* Ongoing support from the community
     
    9797= Where are the options, and how can I customize the sharing plugin? =
    9898
    99 In your Admin panel, go to `Settings` > `AddToAny`. Among other options, you can choose individual sharing icons, a universal share button, and official 3rd party sharing buttons (Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button, Google +1 Button) to display, and where and how to display them.
    100 
    101 To place the buttons as a "widget" in your theme (if your theme supports WordPress Widgets), go to `Appearance` > `Widgets`, then drag AddToAny to an available Widget Area and click `Save`.
    102 
    103 To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one or more lines of JavaScript code into "Additional JavaScript" box. The Additional JavaScript box is in `Settings` > `AddToAny`.
     99In your Admin panel, go to `Settings` > `AddToAny`.
     100
     101Setup Follow buttons (like Instagram, YouTube, etc.) using the AddToAny Follow widget in `Appearance` > `Widgets` (or `Appearance` > `Customize`).
     102
     103To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one or more lines of code into your "Additional JavaScript" or "Additional CSS" box. Those boxes are in `Settings` > `AddToAny`.
    104104
    105105= Something is wrong. What should I try first? =
     
    128128= For Facebook sharing, how can I set the thumbnail image and description Facebook uses? =
    129129
    130 Facebook expects the Title, Description, and Thumbnail of a shared page to be defined in the actual HTML code of a shared page. Unlike other services that accept common parameters, Facebook only accepts a URL, then Facebook scans the actual page for details. To change the title, description or image on Facebook, you will need to modify your theme or use another plugin that filters your theme.
    131 
    132 Use Facebook's <a href="https://developers.facebook.com/tools/debug/">URL Debugger</a> on your pages to see how Facebook reads your site. "Fetch new scrape information" to test site changes and clear Facebook's cache of a page.
     130Facebook expects the Title, Description, and Thumbnail of a shared page to be defined in the Open Graph <a href="https://www.addtoany.com/ext/meta-tags/" target="_blank">meta tags</a> of a shared page.
     131
     132Use Facebook's <a href="https://developers.facebook.com/tools/debug/og/object/">URL Debugger</a> on your pages to see how Facebook reads your site. "Fetch new scrape information" to test site changes and clear Facebook's cache of a page.
    133133
    134134To change the title, description and/or image on Facebook, your theme's header file should be modified according to <a href="https://developers.facebook.com/docs/sharing/opengraph">Facebook's OpenGraph specification</a>. With WordPress, this can be accomplished with plugins such as the <a href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a> or the <a href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>. Please see those plugins for details, and post in the WordPress or plugin author's forums for more support.
     
    165165
    166166= How can I add a custom standalone share button? =
    167 You can create a plugin or customize the following example PHP code to add to your theme's function.php file:
     167You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
    168168
    169169`function addtoany_add_services( $services ) {
     
    180180
    181181= How can I add a custom follow button? =
    182 You can create a plugin or customize the following example PHP code to add to your theme's function.php file:
     182You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
    183183
    184184`function addtoany_add_follow_services( $services ) {
     
    300300
    301301== Changelog ==
     302
     303= 1.6.15 =
     304* AddToAny widgets support new selective refresh in the WordPress 4.5 Customizer
     305* AddToAny share endpoints default to HTTPS on HTTPS sites
     306* Permit changing the target attribute for custom services (thanks Jasper)
     307* The meta box ("Show sharing buttons") below the WordPress editor will no longer show when standard placement is disabled for the current post type
     308* Add Kik share button
     309* Add Skype share button
     310* Add Viber share button
     311* Add WeChat share button
     312* Add Snapchat follow button
    302313
    303314= 1.6.14 =
  • add-to-any/trunk/add-to-any.php

    r1363025 r1394811  
    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.  [<a href="options-general.php?page=addtoany">Settings</a>]
    6 Version: 1.6.14
     6Version: 1.6.15
    77Author: AddToAny
    88Author URI: https://www.addtoany.com/
     
    203203    extract( $args );
    204204   
     205    $https_or_http = is_ssl() ? 'https' : 'http';
    205206    $is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
    206207   
     
    317318            $height_attr = $is_amp && isset( $icon_size ) ? ' height="' . $icon_size . '"' : $height_attr;
    318319           
    319             $url = ( isset( $href ) ) ? $href : "http://www.addtoany.com/add_to/" . $safe_name . "?linkurl=" . $linkurl_enc . "&amp;linkname=" . $linkname_enc;
     320            $url = ( isset( $href ) ) ? $href : $https_or_http . '://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&amp;linkname=' . $linkname_enc;
    320321            $src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
    321322            $counter = ( $counter_enabled ) ? ' a2a_counter' : '';
    322323            $class_attr = ( $custom_service ) ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
    323324            $rel_nofollow = $is_follow ? '' : ' rel="nofollow"'; // ($is_follow indicates a Follow Kit. 'nofollow' is for search crawlers. Different things)
     325           
     326            if ( isset( $service['target'] ) ) {
     327                $target_attr = empty( $service['target'] ) ? '' : ' target="' . $service['target'] . '"';
     328            } else {
     329                $target_attr = ' target="_blank"';
     330            }
    324331           
    325332            // Set dimension attributes if using custom icons and dimension is specified
     
    329336            }
    330337           
    331             $link = $html_wrap_open . "<a$class_attr href=\"$url\" title=\"$name\"$rel_nofollow target=\"_blank\">";
     338            $link = $html_wrap_open . "<a$class_attr href=\"$url\" title=\"$name\"$rel_nofollow$target_attr>";
    332339            $link .= ( $large_icons && ! isset( $custom_icons ) && ! $custom_service ) ? "" : "<img src=\"$src\"" . $width_attr . $height_attr . " alt=\"$name\"/>";
    333340            $link .= "</a>" . $html_wrap_close;
     
    753760    $options = get_option( 'addtoany_options' );
    754761   
    755     $http_or_https = ( is_ssl() ) ? 'https' : 'http';
     762    $https_or_http = is_ssl() ? 'https' : 'http';
    756763
    757764    // Use local cache?
    758765    $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false;
    759766    $upload_dir = wp_upload_dir();
    760     $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $http_or_https . '://static.addtoany.com/menu';
     767    $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $https_or_http . '://static.addtoany.com/menu';
    761768   
    762769    // Enternal script call + initial JS + set-once variables
  • add-to-any/trunk/addtoany.admin.php

    r1346380 r1394811  
    88    $post_types = ( function_exists( 'get_post_types' ) ) ? get_post_types( array( 'public' => true ) ) : array( 'post', 'page' ) ;
    99   
     10    $options = get_option( 'addtoany_options' );
     11   
    1012    $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) );
    1113    foreach( $post_types as $post_type ) {
     14        // If automatic placement is disabled for the post type
     15        if (
     16            'post' == $post_type && isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ||
     17            'page' == $post_type && isset( $options['display_in_pages'] ) && $options['display_in_pages'] == '-1' ||
     18            // Custom post type
     19            isset( $options['display_in_cpt_' . $post_type] ) && $options['display_in_cpt_' . $post_type] == '-1'
     20        ) {
     21            // Skip current post type
     22            continue;
     23        }
     24       
     25        // Add meta box (unless we skipped this post type above)
    1226        add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'advanced', 'high' );
    1327    }
  • add-to-any/trunk/addtoany.services.php

    r1338434 r1394811  
    191191        "icon" => "kakao",
    192192    ),
     193    "kik" => array(
     194        "name" => "Kik",
     195        "icon" => "kik",
     196    ),
    193197    "kindle_it" => array(
    194198        "name" => "Kindle It",
     
    307311        "icon" => "sitejot",
    308312    ),
     313    "skype" => array(
     314        "name" => "Skype",
     315        "icon" => "skype",
     316    ),
    309317    "slashdot" => array(
    310318        "name" => "Slashdot",
     
    347355        "icon" => "viadeo",
    348356    ),
     357    "viber" => array(
     358        "name" => "Viber",
     359        "icon" => "viber",
     360    ),
    349361    "vk" => array(
    350362        "name" => "VK",
     
    358370        "name" => "Webnews",
    359371        "icon" => "webnews",
     372    ),
     373    "wechat" => array(
     374        "name" => "WeChat",
     375        "icon" => "wechat",
    360376    ),
    361377    "wordpress" => array(
     
    399415
    400416$A2A_FOLLOW_services = array(
     417   
    401418    'facebook' => array(
    402419        'name' => 'Facebook',
     
    454471        'icon' => 'linkedin',
    455472    ),
     473    'snapchat' => array(
     474        'name' => 'Snapchat',
     475        'href' => 'https://www.snapchat.com/add/${id}',
     476        'icon' => 'snapchat',
     477    ),
    456478    'tumblr' => array(
    457479        'name' => 'Tumblr',
     
    479501        'icon' => 'feed',
    480502    ),
     503   
    481504);
  • add-to-any/trunk/addtoany.widgets.php

    r1346380 r1394811  
    1414    /** constructor */
    1515    function __construct() {
    16         $widget_ops = array( 'description' => 'Share buttons for sharing your content.' );
    17         parent::__construct( '', 'AddToAny Share', $widget_ops );   
    18     }
     16        $widget_ops = array(
     17            'description' => 'Share buttons for sharing your content.',
     18            'customize_selective_refresh' => true,
     19        );
     20        parent::__construct( '', 'AddToAny Share', $widget_ops );
     21       
     22        // Enqueue script if widget is active (appears in a sidebar) or if in Customizer preview.
     23        if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
     24            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     25        }
     26    }
     27   
     28    public function enqueue_scripts() {
     29        wp_enqueue_script( 'addtoany-widget-init', plugins_url( 'addtoany.admin.js', __FILE__ ), array(), '0.1', true );
     30    }
    1931   
    2032    /** Backwards compatibility for A2A_SHARE_SAVE_Widget::display(); usage */
     
    93105    /** constructor */
    94106    function __construct() {
    95         $widget_ops = array( 'description' => 'Follow buttons link to your social media.' );
     107        $widget_ops = array(
     108            'description' => 'Follow buttons link to your social media.',
     109            'customize_selective_refresh' => true,
     110        );
    96111        parent::__construct( '', 'AddToAny Follow', $widget_ops ); 
    97     }
     112       
     113        // Enqueue script if widget is active (appears in a sidebar) or if in Customizer preview.
     114        if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
     115            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     116        }
     117    }
     118   
     119    /**
     120     * Enqueue a script with jQuery as a dependency.
     121     */
     122    public function enqueue_scripts() {
     123        wp_enqueue_script( 'addtoany-widget-init', plugins_url( 'addtoany.admin.js', __FILE__ ), array('jquery'), '0.1', true );
     124    }
    98125
    99126    /**
Note: See TracChangeset for help on using the changeset viewer.