Changeset 1476156
- Timestamp:
- 08/17/2016 12:37:14 AM (10 years ago)
- Location:
- add-to-any/trunk
- Files:
-
- 4 added
- 8 edited
-
README.txt (modified) (9 diffs)
-
add-to-any.php (modified) (14 diffs)
-
addtoany.admin.js (modified) (1 diff)
-
addtoany.admin.php (modified) (6 diffs)
-
addtoany.min.js (added)
-
addtoany.services.php (modified) (3 diffs)
-
icons/aim.png (modified) (previous)
-
icons/facebook_messenger.png (added)
-
icons/instagram.png (modified) (previous)
-
icons/link.png (added)
-
icons/trello.png (added)
-
icons/tuenti.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
add-to-any/trunk/README.txt
r1441389 r1476156 3 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, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any 4 4 Requires at least: 3.7 5 Tested up to: 4. 56 Stable tag: 1. 6.185 Tested up to: 4. 6 Stable tag: 1. 7 7 8 8 Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too. … … 36 36 37 37 * Automatic Google Analytics integration (<a href="https://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics 38 * Track shared links with bit.ly, awe.sm,goo.gl, and custom URL shorteners38 * Track shared links with bit.ly, goo.gl, and custom URL shorteners 39 39 * Display share counts on posts and pages 40 40 … … 42 42 43 43 * Loads asynchronously so your content always loads before or in parallel with AddToAny 44 * Supports theme features such as HTML5 & XHTML, widgets, infinite scroll, post formats44 * Supports theme features such as HTML5, widgets, infinite scroll, post formats 45 45 * Supports multilingual sites and multisite networks 46 46 * No signup, no login, no account necessary … … 74 74 See also: 75 75 76 * The standard <a href="https://www.addtoany.com/buttons/for/website">share buttons</a> code77 * The universal<a href="https://www.addtoany.com/buttons/for/wordpress_com">share button for WordPress.com</a>76 * The 77 * The <a href="https://www.addtoany.com/buttons/for/wordpress_com">share button for WordPress.com</a> 78 78 79 79 <a href="https://www.addtoany.com/blog/">AddToAny Blog</a> | <a href="https://www.addtoany.com/privacy">Privacy Policy</a> … … 135 135 Use Facebook's <a href="https://developers.facebook.com/tools/debug/sharing/" target="_blank">Sharing Debugger</a> on your pages to see how Facebook reads your site. "Scrape Again" to test site changes and clear Facebook's cache of a page, or use the <a href="https://developers.facebook.com/tools/debug/sharing/batch/" target="_blank">Batch Invalidator</a> to purge Facebook's cache of multiple URLs. 136 136 137 To 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" target="_blank">Facebook's OpenGraph specification</a>. With WordPress, this can be accomplished with plugins such as <a href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a> or <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.137 To 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" target="_blank">Facebook's OpenGraph specification</a>. With WordPress, this can be accomplished with plugins such as <a href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a> or <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. 138 138 139 139 For more technical information on setting your pages up for Facebook sharing, see "Sharing Best Practices for Websites" in <a href="https://developers.facebook.com/docs/sharing/best-practices">Facebook's documentation</a>. … … 187 187 'linkname' => 'Example Page', 188 188 'linkurl' => 'https://www.example.com/page.html', 189 190 191 192 193 194 195 196 197 198 199 200 201 189 202 ) ); 190 203 } ?>` … … 291 304 = Does the plugin output W3C valid code? = 292 305 293 Yes, this plugin outputs 100% W3C valid HTML5 & XHTML and W3C valid CSS 3 by default. 294 295 If you use the Facebook Like, Twitter Tweet or Google +1 buttons in an HTML5 theme, note that the button iframes use the `scrolling` attribute, which is valid XHTML but the attribute has been deprecated in HTML5. It's needed to prevent scrollbars from appearing over the Like, Tweet, and +1 buttons inside of the iframes. 296 297 Regardless of circumstances for passing W3C tests, the plugin will always output semantically valid and robot-readable code, so publishers do not have to worry about search engine crawler errors due to invalid code. Both <a href="https://en.wikipedia.org/wiki/Web_standards">web standards</a> and <a href="https://en.wikipedia.org/wiki/Cross-browser">cross-browser</a> compatibility are taken seriously. 306 Yes, this plugin outputs 100% W3C valid HTML5 and W3C valid CSS 3 by default. 298 307 299 308 = How can I load the buttons after content insertion with AJAX and infinite scroll? = … … 302 311 `jQuery( 'body' ).trigger( 'post-load' );` 303 312 304 A fewprerequisites:313 A prerequisites: 305 314 306 315 * The request has an `HTTP_X_REQUESTED_WITH` header set to `xmlhttprequest` 307 316 * `jQuery` available 308 * AddToAny `<script>` blocks in the response need to execute, so don't use jQuery's `load` method *with a selector expression*. Selector expression usage with that method will cause `<script>` blocks in the response <a href="https://api.jquery.com/load/#script-execution">to be stripped out</a>309 317 310 318 = Why does the menu appear behind embedded objects (like Flash)? = … … 326 334 327 335 == Changelog == 336 337 338 339 340 341 342 343 344 345 346 347 348 328 349 329 350 = 1.6.18 = -
add-to-any/trunk/add-to-any.php
r1441389 r1476156 4 4 Plugin URI: https://www.addtoany.com/ 5 5 Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more. 6 Version: 1. 6.186 Version: 1. 7 7 Author: AddToAny 8 8 Author URI: https://www.addtoany.com/ … … 12 12 13 13 // Explicitly globalize to support bootstrapped WordPress 14 global $ _addtoany_counter, $_addtoany_init, $_addtoany_targets, $A2A_locale, $A2A_FOLLOW_services,14 global $A2A_locale, $A2A_FOLLOW_services, 15 15 $A2A_SHARE_SAVE_plugin_basename, $A2A_SHARE_SAVE_options, $A2A_SHARE_SAVE_plugin_dir, $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services; 16 16 … … 76 76 // Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON 77 77 function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) { 78 global $_addtoany_counter;79 80 $_addtoany_counter++;81 82 78 $options = get_option( 'addtoany_options' ); 83 79 80 81 82 83 84 85 84 86 $defaults = array( 85 'output_later' => false, 86 'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32', 87 'output_later' => false, 88 'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32', 89 'use_current_page' => false, 87 90 ); 91 88 92 89 93 $args = wp_parse_args( $args, $defaults ); … … 99 103 // Custom icons enabled? 100 104 $custom_icons = ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' && isset( $options['custom_icons_url'] ) ) ? true : false; 101 105 102 106 $kit_additional_classes = ''; 107 108 109 103 110 $kit_style = ''; 104 111 … … 141 148 142 149 if ( ! isset( $args['html_container_open'] ) ) { 143 $args['html_container_open'] = '<div class="a2a_kit' . $icon_size_classname . $kit_additional_classes . ' a2a_target"'; 144 $args['html_container_open'] .= ' id="wpa2a_' . $_addtoany_counter . '"'; // ID is later removed by JS (for AJAX) 145 $args['html_container_open'] .= $kit_style; 146 $args['html_container_open'] .= '>'; 150 $args['html_container_open'] = '<div class="a2a_kit' . $icon_size_classname . $kit_additional_classes . '"' 151 . $kit_data_url . $kit_data_title . $kit_data_media . $kit_style . '>'; 147 152 $args['is_kit'] = true; 148 153 } … … 360 365 // $args array = output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl, no_universal_button 361 366 362 global $A2A_SHARE_SAVE_plugin_url_path , $_addtoany_targets, $_addtoany_counter, $_addtoany_init;367 global $A2A_SHARE_SAVE_plugin_url_path; 363 368 364 369 $options = get_option( 'addtoany_options' ); … … 367 372 $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false; 368 373 $linkmedia = isset( $args['linkmedia'] ) ? $args['linkmedia'] : false; 369 $_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();370 374 371 375 $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl, $linkmedia)); // linkname_enc, etc. … … 393 397 extract( $args ); 394 398 395 // If not enclosed in an AddToAny Kit, count & target this button (instead of Kit) for async loading396 if ( ! $args['is_kit'] ) {397 $_addtoany_counter++;398 $button_class = ' a2a_target';399 $button_id = ' id="wpa2a_' . $_addtoany_counter . '"'; // ID is later removed by JS (for AJAX)400 } else {401 $button_class = '';402 $button_id = '';403 }404 405 /* AddToAny button */406 407 399 $is_feed = is_feed(); 408 400 $is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false; 401 402 403 404 409 405 $button_target = $is_amp ? ' target="_blank"' : ''; 410 406 $button_href_querystring = ($is_feed || $is_amp) ? '#url=' . $linkurl_enc . '&title=' . $linkname_enc : ''; … … 466 462 } 467 463 468 $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"' . $button_id469 . $ style . $button_target464 $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"' 465 . $style . $button_target 470 466 . '>' . $button . '</a>'; 471 467 … … 473 469 // Universal button disabled 474 470 $button_html = ''; 475 }476 477 // Hook to disable script output478 // Example: add_filter( 'addtoany_script_disabled', '__return_true' );479 $script_disabled = apply_filters( 'addtoany_script_disabled', false );480 // Doing AJAX? (the DOING_AJAX constant can be unreliable)481 $ajax = ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false;482 483 // If not a feed and script is not disabled,484 // and not admin (unless doing AJAX, probably through admin-ajax.php)485 if ( ! $is_feed && ! $script_disabled && ( ! is_admin() || $ajax ) ) {486 if ($use_current_page) {487 $button_config = "\n{title:document.title,"488 . "url:location.href}";489 $_addtoany_targets[] = $button_config;490 } else {491 // wp_json_encode available since 4.1492 $linkname_sanitized = function_exists( 'wp_json_encode' ) ? wp_json_encode ( $linkname ) : json_encode( $linkname );493 $linkmedia_optional = ! empty( $linkmedia ) ? ',media:"' . $linkmedia . '"' : '' ;494 $button_config = "\n{title:". $linkname_sanitized . ','495 . 'url:"' . $linkurl . '"'496 . $linkmedia_optional . '}';497 $_addtoany_targets[] = $button_config;498 }499 500 // If doing AJAX (the DOING_AJAX constant can be unreliable)501 if ( $ajax ) {502 $javascript_button_config = "<script type=\"text/javascript\"><!--\n"503 . "if(wpa2a.targets)wpa2a.targets.push("504 . $button_config505 . ");\n";506 507 if ( ! $_addtoany_init ) {508 // Catch post-load event to support infinite scroll (and more?)509 $javascript_button_config .= "\nif('function'===typeof(jQuery))"510 . "jQuery(document).ready(function($){"511 . "$('body').on('post-load',function(){"512 . "if(wpa2a.script_ready)wpa2a.init();"513 . "wpa2a.script_load();" // Load external script if not already called514 . "});"515 . "});";516 }517 518 $javascript_button_config .= "\n//--></script>\n";519 } else {520 $javascript_button_config = '';521 }522 523 if ( ! $_addtoany_init ) {524 $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"525 . "if(wpa2a)wpa2a.script_load();"526 . "\n//--></script>\n";527 } else {528 $javascript_load_early = "";529 }530 531 $button_html .= $javascript_load_early . $javascript_button_config;532 $_addtoany_init = true;533 471 } 534 472 … … 786 724 $A2A_SHARE_SAVE_external_script_called = true; 787 725 788 $javascript_header = "\n" . '<script type="text/javascript">' . "<!--\n" 789 790 . "var a2a_config=a2a_config||{}," 791 . "wpa2a={done:false," 792 . "html_done:false," 793 . "script_ready:false," 794 . "script_load:function(){" 795 . "var a=document.createElement('script')," 796 . "s=document.getElementsByTagName('script')[0];" 797 . "a.type='text/javascript';a.async=true;" 798 . "a.src='" . $static_server . "/page.js';" 799 . "s.parentNode.insertBefore(a,s);" 800 . "wpa2a.script_load=function(){};" 801 . "}," 802 . "script_onready:function(){" 803 . "wpa2a.script_ready=true;" 804 . "if(wpa2a.html_done)wpa2a.init();" 805 . "}," 806 . "init:function(){" 807 . "for(var i=0,el,target,targets=wpa2a.targets,length=targets.length;i<length;i++){" 808 . "el=document.getElementById('wpa2a_'+(i+1));" 809 . "target=targets[i];" 810 . "a2a_config.linkname=target.title;" 811 . "a2a_config.linkurl=target.url;" 812 . "a2a_config.linkmedia=target.media;" 813 . "if(el){" 814 . "a2a.init('page',{target:el});" 815 . "el.id='';" // Remove ID so AJAX can reuse the same ID 816 . "}" 817 . "wpa2a.done=true;" 818 . "}" 819 . "wpa2a.targets=[];" // Empty targets array so AJAX can reuse from index 0 820 . "}" 821 . "};" 822 726 $javascript_header = "\n" . '<script type="text/javascript">' . "\n" 727 728 . "var a2a_config=a2a_config||{};" 823 729 . "a2a_config.callbacks=a2a_config.callbacks||[];" 824 . "a2a_config.callbacks.push({ready:wpa2a.script_onready});"825 730 . "a2a_config.templates=a2a_config.templates||{};" 826 731 . A2A_menu_locale() 827 732 . $script_configs 828 733 829 . "\n//--></script>\n"; 734 . "\n</script>\n" 735 736 . '<script type="text/javascript" src="' . $static_server . '/page.js" async="async"></script>' . "\n"; 830 737 831 738 echo $javascript_header; … … 835 742 836 743 function A2A_SHARE_SAVE_footer_script() { 837 global $_addtoany_targets; 838 839 // Hook to disable script output 840 // Example: add_filter( 'addtoany_script_disabled', '__return_true' ); 841 $script_disabled = apply_filters( 'addtoany_script_disabled', false ); 842 843 if ( is_admin() || is_feed() || $script_disabled ) 744 if ( is_admin() || is_feed() ) 844 745 return; 845 846 $_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();847 746 848 747 $floating_html = ADDTOANY_SHARE_SAVE_FLOATING( array( 'output_later' => true ) ); 849 748 850 $javascript_footer = "\n" . '<script type="text/javascript">' . "<!--\n" 851 . "wpa2a.targets=[" 852 . implode( ",", $_addtoany_targets ) 853 . "];\n" 854 . "wpa2a.html_done=true;" 855 . "if(wpa2a.script_ready&&!wpa2a.done)wpa2a.init();" // External script may load before html_done=true, but will only init if html_done=true. So call wpa2a.init() if external script is ready, and if wpa2a.init() hasn't been called already. Otherwise, wait for callback to call wpa2a.init() 856 . "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button. Fixes issues where first button code is processed internally but without actual code output 857 . "\n//--></script>\n"; 858 859 echo $floating_html . $javascript_footer; 749 echo $floating_html; 860 750 } 861 751 … … 918 808 // Individual pages 919 809 ( is_page() && isset( $options['display_in_pages'] ) && $options['display_in_pages'] == '-1' ) || 810 811 920 812 // <!--nosharesave--> legacy tag 921 813 ( (strpos( $content, '<!--nosharesave-->') !== false ) ) … … 1077 969 add_action( 'wp_print_styles', 'A2A_SHARE_SAVE_stylesheet' ); 1078 970 971 972 973 974 975 976 977 978 979 980 1079 981 1080 982 /** -
add-to-any/trunk/addtoany.admin.js
r1394811 r1476156 7 7 8 8 function addtoany_init() { 9 if ( ! wpa2a ) 10 return; 11 12 if (wpa2a.script_ready) 13 wpa2a.init(); 14 15 // Load external script if not already called 16 wpa2a.script_load(); 9 if ( window.a2a ) { 10 a2a.init_all( 'page' ); 11 } 17 12 } 18 13 -
add-to-any/trunk/addtoany.admin.php
r1394811 r1476156 68 68 add_action( 'admin_init', 'A2A_SHARE_SAVE_add_meta_box' ); 69 69 add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' ); 70 70 71 71 72 /** … … 271 272 $new_options['display_in_posts'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts'] == '1' ) ? '1' : '-1'; 272 273 $new_options['display_in_pages'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_pages'] ) && $_POST['A2A_SHARE_SAVE_display_in_pages'] == '1' ) ? '1' : '-1'; 274 273 275 $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1'; 274 276 $new_options['show_title'] = ( isset( $_POST['A2A_SHARE_SAVE_show_title'] ) && $_POST['A2A_SHARE_SAVE_show_title'] == '1' ) ? '1' : '-1'; … … 360 362 361 363 ?> 362 <div class="updated fade"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>364 <div class="updated></p></div> 363 365 <?php 364 366 … … 608 610 <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content( $options, false )); ?> 609 611 </label> 612 613 614 615 616 617 618 610 619 611 620 <?php … … 645 654 </label> 646 655 <p> 647 <a href="https://www.addtoany.com/buttons/share _save/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the AddToAny Menu Styler in a new window", 'add-to-any'); ?>" target="_blank" onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus(); document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", 'add-to-any'); ?></a>656 <a href="https://www.addtoany.com/buttons/share/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the AddToAny Menu Styler in a new window", 'add-to-any'); ?>" target="_blank" onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus(); document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", 'add-to-any'); ?></a> 648 657 </p> 649 658 </fieldset></td> … … 816 825 </div> 817 826 818 <script type="text/javascript" src="http<?php if ( is_ssl() ) echo 's'; ?>://static.addtoany.com/menu/page.js"></script> 819 <script type="text/javascript">if ( a2a && a2a.svg_css ) a2a.svg_css();</script> 827 <script src="http<?php if ( is_ssl() ) echo 's'; ?>://static.addtoany.com/menu/page.js"></script> 828 <script> 829 if ( window.a2a && a2a.svg_css ) a2a.svg_css(); 830 jQuery(document).ready( function() { if ( ! window.a2a) jQuery('<div class="error"><p><strong>Something is preventing AddToAny from loading. Try disabling content blockers such as ad-blocking add-ons, or try another web browser.</strong></p></div>').insertBefore('.nav-tab-wrapper:eq(0)'); }); 831 </script> 820 832 821 833 <?php -
add-to-any/trunk/addtoany.services.php
r1394811 r1476156 107 107 "icon" => "citeulike", 108 108 ), 109 110 111 112 109 113 "delicious" => array( 110 114 "name" => "Delicious", … … 147 151 "icon" => "evernote", 148 152 ), 153 154 155 156 149 157 "fark" => array( 150 158 "name" => "Fark", … … 338 346 "name" => "Telegram", 339 347 "icon" => "telegram", 348 349 350 351 340 352 ), 341 353 "tuenti" => array(
Note: See TracChangeset
for help on using the changeset viewer.