AddToAny Share Buttons - Version 1.2.1

Version Description

  • Checkbox option to disable sharing buttons on each post and page
Download this release

Release Info

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

Code changes from version 1.2 to 1.2.1

Files changed (2) hide show
  1. README.txt +13 -6
  2. add-to-any.php +58 -3
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, sidebar, widget, email, e-mail, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, messenger, stumbleupon, technorati, lockerz, addthis, sexybookmarks, sociable, sharedaddy, shareaholic, icon, icons, vector, SVG, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.7
6
- Stable tag: 1.2
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
@@ -13,16 +13,16 @@ The WordPress sharing plugin to help people **share**, **bookmark**, and **email
13
 
14
  3rd party buttons include the **Facebook Like Button**, **Twitter Tweet Button**, **Google+ Share Button**, **Google+ Share Button** and **Google +1 Button**.
15
 
16
- This sharing plugin lets you customize the AddToAny universal Smart Menu, which places the services visitors use at the top of the menu, based on each visitor's usage.
17
 
18
  <a href="http://www.addtoany.com/" title="Sharing buttons">Share Buttons</a> (demo)
19
 
20
  The Email tab makes it easy to share via Google Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web-based emailer or desktop program.
21
 
22
- Standalone **share icons** let you optimize your blog posts & pages for specific social sites. Choose from over 100 individual services.
23
 
24
  * **New**: Large vector sharing buttons!
25
- * SVG sharing icons for the most popular services (and more to come)
26
  * Smart Menu & Kit with individual share links
27
  * Choose exactly where you want AddToAny to appear
28
  * Google Analytics integration (<a href="http://www.addtoany.com/ext/google_analytics/">access guide</a>)
@@ -154,11 +154,15 @@ To align center:
154
 
155
  = How can I remove the button(s) from individual posts and pages? =
156
 
157
- Insert the following tag into the page or post (HTML tab) that you do not want the button(s) to appear in: `<!--nosharesave-->`
 
 
158
 
159
  = How can I force the button(s) to appear in individual posts and pages? =
160
 
161
- If your button isn't already set up to appear (it is by default), insert the following tag into the page or post (HTML tab) that you want the button to appear in: `<!--sharesave-->`
 
 
162
 
163
  = Why doesn't Facebook use the page title and how can I set the image Facebook uses? =
164
 
@@ -221,6 +225,9 @@ Upload the plugin directory (including all files and directories within) to the
221
 
222
  == Changelog ==
223
 
 
 
 
224
  = 1.2 =
225
  * Large sharing buttons (major new feature!)
226
  * Scalable vector icons (SVG icons)
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, sidebar, widget, email, e-mail, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, messenger, stumbleupon, technorati, lockerz, addthis, sexybookmarks, sociable, sharedaddy, shareaholic, icon, icons, vector, SVG, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.7
6
+ Stable tag: 1.2.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
13
 
14
  3rd party buttons include the **Facebook Like Button**, **Twitter Tweet Button**, **Google+ Share Button**, **Google+ Share Button** and **Google +1 Button**.
15
 
16
+ This sharing plugin lets you customize the AddToAny universal Smart Menu, which places the services visitors use at the top of the menu based on each visitor's usage.
17
 
18
  <a href="http://www.addtoany.com/" title="Sharing buttons">Share Buttons</a> (demo)
19
 
20
  The Email tab makes it easy to share via Google Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web-based emailer or desktop program.
21
 
22
+ Social **share icons** let you optimize your blog posts & pages for specific social sites. Choose from over 100 individual services.
23
 
24
  * **New**: Large vector sharing buttons!
25
+ * SVG sharing icons for the most popular services (and more to come)
26
  * Smart Menu & Kit with individual share links
27
  * Choose exactly where you want AddToAny to appear
28
  * Google Analytics integration (<a href="http://www.addtoany.com/ext/google_analytics/">access guide</a>)
154
 
155
  = How can I remove the button(s) from individual posts and pages? =
156
 
157
+ When editing a post or page, uncheck "Show sharing buttons", which is located at the bottom of the editor page. Be sure to update or publish to save your changes.
158
+
159
+ An older method was to insert the following tag into the page or post (HTML tab) that you do not want the button(s) to appear in: `<!--nosharesave-->`
160
 
161
  = How can I force the button(s) to appear in individual posts and pages? =
162
 
163
+ When editing a post or page, check the "Show sharing buttons" checkbox, which is located at the bottom of the editor page. Be sure to update or publish to save your changes. Note that, by default, AddToAny is setup to display on all posts and pages.
164
+
165
+ An older method was to insert the following tag into the page or post (HTML tab) that you want the button(s) to appear in: `<!--sharesave-->`
166
 
167
  = Why doesn't Facebook use the page title and how can I set the image Facebook uses? =
168
 
225
 
226
  == Changelog ==
227
 
228
+ = 1.2.1 =
229
+ * Checkbox option to disable sharing buttons on each post and page
230
+
231
  = 1.2 =
232
  * Large sharing buttons (major new feature!)
233
  * Scalable vector icons (SVG icons)
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.2
7
  Author: micropat
8
  Author URI: http://www.addtoany.com/
9
  */
@@ -588,16 +588,21 @@ function A2A_SHARE_SAVE_add_to_content($content) {
588
 
589
  $is_feed = is_feed();
590
  $options = get_option('addtoany_options');
 
591
 
592
  if( ! $A2A_SHARE_SAVE_auto_placement_ready)
593
  return $content;
594
 
595
  if (get_post_status(get_the_ID()) == 'private')
596
  return $content;
 
 
 
 
597
 
598
  if (
599
  (
600
- // Tags
601
  // <!--sharesave--> tag
602
  strpos($content, '<!--sharesave-->')===false ||
603
  // <!--nosharesave--> tag
@@ -619,7 +624,7 @@ function A2A_SHARE_SAVE_add_to_content($content) {
619
  // Pages
620
  // Individual pages
621
  ( is_page() && $options['display_in_pages']=='-1' ) ||
622
- // <!--nosharesave-->
623
  ( (strpos($content, '<!--nosharesave-->')!==false) )
624
  )
625
  )
@@ -739,6 +744,56 @@ function A2A_SHARE_SAVE_unschedule_cache() {
739
  OPTIONS
740
  ******************************/
741
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
 
743
  function A2A_SHARE_SAVE_migrate_options() {
744
 
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.2.1
7
  Author: micropat
8
  Author URI: http://www.addtoany.com/
9
  */
588
 
589
  $is_feed = is_feed();
590
  $options = get_option('addtoany_options');
591
+ $sharing_disabled = get_post_meta( get_the_ID(), 'sharing_disabled', false );
592
 
593
  if( ! $A2A_SHARE_SAVE_auto_placement_ready)
594
  return $content;
595
 
596
  if (get_post_status(get_the_ID()) == 'private')
597
  return $content;
598
+
599
+ // Disabled for this post?
600
+ if ( !empty( $sharing_disabled ) )
601
+ return $content;
602
 
603
  if (
604
  (
605
+ // Legacy tags
606
  // <!--sharesave--> tag
607
  strpos($content, '<!--sharesave-->')===false ||
608
  // <!--nosharesave--> tag
624
  // Pages
625
  // Individual pages
626
  ( is_page() && $options['display_in_pages']=='-1' ) ||
627
+ // <!--nosharesave--> legacy tag
628
  ( (strpos($content, '<!--nosharesave-->')!==false) )
629
  )
630
  )
744
  OPTIONS
745
  ******************************/
746
 
747
+ // Post Options
748
+ function A2A_SHARE_SAVE_add_meta_box() {
749
+ $post_types = get_post_types( array( 'public' => true ) );
750
+ $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) );
751
+ foreach( $post_types as $post_type ) {
752
+ add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'advanced', 'high' );
753
+ }
754
+ }
755
+
756
+ function A2A_SHARE_SAVE_meta_box_content( $post ) {
757
+ do_action( 'start_A2A_SHARE_SAVE_meta_box_content', $post );
758
+
759
+ $disabled = get_post_meta( $post->ID, 'sharing_disabled', true ); ?>
760
+
761
+ <p>
762
+ <label for="enable_post_addtoany_sharing">
763
+ <input type="checkbox" name="enable_post_addtoany_sharing" id="enable_post_addtoany_sharing" value="1" <?php checked( !$disabled ); ?>>
764
+ <?php _e( 'Show sharing buttons.' , 'add-to-any'); ?>
765
+ </label>
766
+ <input type="hidden" name="addtoany_sharing_status_hidden" value="1" />
767
+ </p>
768
+
769
+ <?php
770
+ do_action( 'end_A2A_SHARE_SAVE_meta_box_content', $post );
771
+ }
772
+
773
+ function A2A_SHARE_SAVE_meta_box_save( $post_id ) {
774
+ // If this is an autosave, this form has not been submitted, so we don't want to do anything.
775
+ if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
776
+ return $post_id;
777
+
778
+ // Save sharing_disabled if "Show sharing buttons" checkbox is unchecked
779
+ if ( isset( $_POST['post_type'] ) && ( 'post' == $_POST['post_type'] || 'page' == $_POST['post_type'] ) ) {
780
+ if ( current_user_can( 'edit_post', $post_id ) ) {
781
+ if ( isset( $_POST['addtoany_sharing_status_hidden'] ) ) {
782
+ if ( !isset( $_POST['enable_post_addtoany_sharing'] ) ) {
783
+ update_post_meta( $post_id, 'sharing_disabled', 1 );
784
+ } else {
785
+ delete_post_meta( $post_id, 'sharing_disabled' );
786
+ }
787
+ }
788
+ }
789
+ }
790
+
791
+ return $post_id;
792
+ }
793
+
794
+ add_action( 'admin_init', 'A2A_SHARE_SAVE_add_meta_box' );
795
+ add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' );
796
+
797
 
798
  function A2A_SHARE_SAVE_migrate_options() {
799