Skip to content
Snippets Groups Projects
Commit c98ec70e authored by Erick Hitter's avatar Erick Hitter
Browse files

Merge branch 'develop'

parents d929be1b 2d5f6387
Branches master
No related tags found
No related merge requests found
......@@ -3,60 +3,36 @@ Contributors: ethitter
Donate link: http://www.ethitter.com/plugins/simple-facebook-share-button/
Tags: share, facebook, social media, button
Requires at least: 2.7
Tested up to: 3.4
Stable tag: 2.0.4
Tested up to: 3.4.1
Stable tag: 2.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Painlessly add a Facebook Share button to your posts and/or pages. Supports all button styles, manual or automatic inclusion, and shortcode.
On July 17, 2012, Facebook dropped support for the Share button, rendering this plugin useless. It is no longer supported and should be deleted.
== Description ==
Painlessly add a Facebook Share button to your posts and pages.
Features include:
* Supports all five button types, including custom button text;
* Supports placing button above or below content;
* Button can be shown on either posts (including excerpts), pages, or both;
* Includes compatibility modes for seamless theme integration;
* Allows user to override default padding options (defaults provided in admin interface);
* Button can be added via shortcode;
* Function can be added manually.
On July 17, 2012, Facebook completely dropped support for the Share button, rendering this plugin useless. It is no longer supported and should be deleted.
== Installation ==
1. Unzip simple-fb-share-button.zip and upload entire simple-fb-share-button folder to wp-content/plugins/.
2. Activate plugin through the Wordpress Plugins menu.
3. Set display, button, and placement options from Settings > Simple FB Share Button.
4. To manually include the Share button, see the Help page in the plugin's Settings page.
Please don't. It doesn't do anything.
== Frequently Asked Questions ==
= After upgrading to version 2.0, the button no longer appears on my site. How can I fix this? =
The most common reason for this problem lies with your theme's footer.php file. If `wp_footer()` does not appear somewhere in footer.php, my plugin cannot add the scripts needed to render the Share button. If your theme is missing `wp_footer()`, add the following code just before the `</body>` tag: `<?php wp_footer(); ?>`.
= How Do I Manually Add Share Buttons? =
After activating the plugin, go to Settings > Simple FB Share Button and select "Plugin Help" at the top of the screen.
= Why Does My Blog's Tagline Appear Instead of a Summary of My Content? =
= What happened to this plugin? =
The Facebook Sharer uses the `<meta name="description" content="description">` tag to gather information about the content you are sharing. Some templates set the description tag to be your tagline. If you are using a plugin that creates a meta description tag from your content, such as HeadSpace or All In One SEO, you should edit your template's header.php file to remove the `<meta name="description" content="<?php bloginfo('description'); ?>">` tag.
Soon after Facebook launched its Like button in April 2010, it announced that the Share button was no longer the preferred way of sharing content to Facebook (they deprecated the service). The button was, until July 17, 2012, still supported though.
= What are the Theme Compatibility Modes? =
As of July 17, 2012, the button no longer functions, so I removed all of its functionality and will no longer support it.
In certain themes, the button may overlap other theme elements, such as comment buttons or other plugins. The plugin includes three compatibility modes to help resolve these problems with minimal effort user effort. Know that in some cases, these modes will not resolve button placement problems. In that case, a custom CSS style may be needed.
Mode 1 disables the CSS float property (a setting that allows the button to, as the name implies, float adjacent to your blog's content) and relies on the alignment of the button wrapper to place the button.
Mode 2 prevents other elements from floating adjacent to the button (using the CSS clear property).
Mode 3 combines the functions of Modes 1 and 2.
If you're looking for a Like button alternative, <a href="http://wordpress.org/extend/plugins/search.php?q=facebook+like">search for &quot;Facebook Like&quot;</a> in the plugins repository.
== Changelog ==
= 2.1 =
* Replacing plugin functionality with stubs after Facebook stopped supporting the Share API.
= 2.0.4 =
* Add defaults function to resolve undefined indexes notices.
......@@ -94,6 +70,9 @@ Mode 3 combines the functions of Modes 1 and 2.
== Upgrade Notice ==
= 2.1 =
Please don't upgrade. Instead, you should deactivate and delete this plugin as Facebook no longer supports the Share button, so this plugin doesn't work.
= 2.0.4 =
Resolves PHP notices, but adds no new features. Recommended for all users.
......
......@@ -2,9 +2,9 @@
/*
Plugin Name: Simple Facebook Share Button
Plugin URI: http://www.ethitter.com/plugins/simple-facebook-share-button/
Description: Painlessly add a Facebook® Share button to your posts and/or pages. Supports all five button types, including custom button text, and placement above or below content. Includes compatibility modes to ensure seamless theme integration. Button can also be added using a shortcode or by inserting a function in your template.
Description: <strong>On July 17, 2012, Facebook completely dropped support for the Share button, rendering this plugin useless. You should deactivate and delete it at your earliest convenience.</strong>
Author: Erick Hitter
Version: 2.0.4
Version: 2.1
Author URI: http://www.ethitter.com/
This program is free software; you can redistribute it and/or modify
......@@ -24,237 +24,81 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/**
* Default options
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @since 2.0.4
* @return array
* @return false
*/
function SFBSB_default_options() {
return array(
'display' => 0,
'content' => 'post',
'content-excerpt' => 0,
'button' => 'button',
'custom_text' => '',
'placement' => 'tr',
'compatibility' => 0,
'tpad' => 0,
'bpad' => 0,
'lpad' => 0,
'rpad' => 0,
'style' => '',
'uninstall' => 0
);
return false;
}
require( 'simple_fb_share_button_options.php' );
/*
* Set up options, convert old options, add filters if automatic display is enabled, and enqueue scripts
* @uses get_option, wp_parse_args, update_option, add_filter, wp_enqueue_script
* @return null
/**
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @return false
*/
function SFBSB_setup() {
//Convert options or set up defaults
if( !$options = get_option( 'SFBSB' ) ) {
if( get_option( 'SFBSB_button' ) ) {
$options = array();
$keys = array(
'SFBSB_button' => 'button',
'SFBSB_display' => 'display',
'SFBSB_content' => 'content',
'SFBSB_placement' => 'placement',
'SFBSB_style' => 'style',
'SFBSB_align' => 'align',
'SFBSB_custom_text' => 'custom_text',
'SFBSB_tpad' => 'tpad',
'SFBSB_bpad' => 'bpad',
'SFBSB_lpad' => 'lpad',
'SFBSB_rpad' => 'rpad',
'SFBSB_compatibility' => 'compatibility',
'SFBSB_uninstall' => 'uninstall'
);
foreach( $keys as $old_key => $new_key ) {
if( $old_option = get_option( $old_key ) ) $options[ $new_key ] = $old_option;
delete_option( $old_key );
}
}
else {
$options = array(
'display' => 0,
'button' => 'button',
'placement' => 'tl',
'content' => 'post'
);
}
$options = wp_parse_args( $options, SFBSB_default_options() );
update_option( 'SFBSB', $options );
}
$options = wp_parse_args( $options, SFBSB_default_options() );
//Add filters if set to automatic display
if( $options[ 'display' ] == 1 )
add_filter( 'the_content', 'SFBSB_auto' );
if( $options[ 'display' ] == 1 && $options[ 'content-excerpt' ] == 1 )
add_filter( 'the_excerpt', 'SFBSB_auto' );
return false;
}
add_action( 'plugins_loaded', 'SFBSB_setup' );
/**
* Enqueue scripts
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @uses wp_enqueue_script
* @wp_enqueue_scripts
* @return null
* @return false
*/
function SFBSB_scripts() {
wp_enqueue_script( 'FB-Loader', 'http://static.ak.fbcdn.net/connect.php/js/FB.Loader', array(), 322597, true );
wp_enqueue_script( 'FB-Share', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', array( 'FB-Loader' ), 322597, true );
return false;
}
add_action( 'wp_enqueue_scripts', 'SFBSB_scripts' );
/*
* Remove plugin options on deactivation if requested to do so.
* @uses wp_parse_args, get_option, delete_option
/**
* Remove plugin options on deactivation.
*
* @uses delete_option
* @action register_deactivation_hook
* @return false
*/
function SFBSB_deactivate() {
$options = wp_parse_args( get_option( 'SFBSB' ), SFBSB_default_options() );
if ( $options[ 'uninstall' ] == 1 )
delete_option('SFBSB');
delete_option('SFBSB');
}
register_deactivation_hook( __FILE__, 'SFBSB_deactivate' );
/*
* On-demand Share button implementation.
* Must be used within the loop.
* @params string button type, string custom button text
* @uses get_permalink
* @return html
/**
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @return false
*/
function SFBSB_direct( $button = 'button_count', $custom_text = false ) {
//Possible button types
$buttons = array(
'box_count',
'button_count',
'button',
'icon'
);
//Check button type
if( $button == 'icon_link' && $custom_text ) $button_type = $button;
elseif( in_array( $button, $buttons ) ) $button_type = $button;
else $button_type = 'button_count';
return '<a name="fb_share" type="' . $button_type . '" share_url="' . get_permalink() . '">' . $custom_text . '</a>';
function SFBSB_direct() {
return false;
}
/*
* Shortcode Share button implementation.
* Must be used within the loop.
* @params array shortcode attributes
* @uses shortcode_atts, get_permalink, add_shortcode
/**
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @return false
*/
function SFBSB_shortcode( $atts ) {
extract( shortcode_atts( array(
'button' => 'button',
'align' => false,
'style' => 'float:left;',
'custom_text' => ''
), $atts ) );
//Button type
if( $button == 'custom' ) $button = 'icon_link';
$style_do = ' style="' . $style . '"';
if( $align !== false ) $align_do = ' align="' . $align . '"';
return '<div' . $align_do . $style_do . '><a name="fb_share" type="' . $button . '" share_url="' . get_permalink() . '">' . $custom_text . '</a></div>';
function SFBSB_shortcode() {
return;
}
add_shortcode( 'SFBSB', 'SFBSB_shortcode' );
/*
* Add button to content via the_content and the_excerpt filters
* @param string $content post content
* @uses $post, wp_parse_args, get_option
* @return string post content
/**
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @return string
*/
function SFBSB_auto( $content ) {
global $post;
$options = wp_parse_args( get_option( 'SFBSB' ), SFBSB_default_options() );
//Button
if( $options[ 'button' ] == 'custom' ) {
$button_type = 'icon_link';
}
else $button_type = $options[ 'button'];
//Padding
$default_padding = '5px';
$_padding = array();
if( ( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'tr' ) && !isset( $options[ 'tpad' ] ) ) $options[ 'tpad' ] = '0';
if( ( $options[ 'placement' ] == 'bl' || $options[ 'placement' ] == 'br' ) && !isset( $options[ 'bpad' ] ) ) $options[ 'bpad' ] = '0';
if( ( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'bl' ) && !isset( $options[ 'lpad' ] ) ) $options[ 'lpad' ] = '0';
if( ( $options[ 'placement' ] == 'tr' || $options[ 'placement' ] == 'br' ) && !isset( $options[ 'rpad' ] ) ) $options[ 'rpad' ] = '0';
$_padding[ 0 ] = strlen( $options[ 'tpad' ] ) > 0 ? $options[ 'tpad' ] . 'px' : $default_padding;
$_padding[ 1 ] = strlen( $options[ 'rpad' ] ) > 0 ? $options[ 'rpad' ] . 'px' : $default_padding;
$_padding[ 2 ] = strlen( $options[ 'bpad' ] ) > 0 ? $options[ 'bpad' ] . 'px' : $default_padding;
$_padding[ 3 ] = strlen( $options[ 'lpad' ] ) > 0 ? $options[ 'lpad' ] . 'px' : $default_padding;
$padding = trim( implode( ' ', $_padding ) );
//Placement
if( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'bl' ) $align=' align="left"';
elseif( $options[ 'placement' ] == 'tr' || $options[ 'placement' ] == 'br' ) $align=' align="right"';
//Compatibility mode
if( $options[ 'compatibility' ] == 1 ) $float = 'none';
elseif( $options[ 'compatibility' ] == 2 ) {
if( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'bl' ) $float = 'left; clear:right';
elseif( $options[ 'placement' ] == 'tr' || $options[ 'placement' ] == 'br' ) $float = 'right; clear:left';
}
elseif( $options[ 'compatibility' ] == 3 ) {
if( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'bl' ) $float = 'none; clear:right';
elseif( $options[ 'placement' ] == 'tr' || $options[ 'placement' ] == 'br' ) $float = 'none; clear:left';
}
else {
if( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] ==' bl' ) $float = 'left';
elseif( $options[ 'placement' ] == 'tr' || $options[ 'placement' ] == 'br' ) $float = 'right';
}
//Style
if( !empty( $options[ 'style' ] ) ) $style_do = ' style="' . $options[ 'style' ] . '"';
else $style_do = ' style="float: ' . $float . '; padding: ' . $padding . ';"';
//Build button
$fb = '<div' . $align . $style_do . '><a name="fb_share" type="' . $button_type . '" share_url="' . get_permalink() . '">' . $options[ 'custom_text' ] . '</a></div>';
//Add button to $content
if ( ( $post->post_type == $options[ 'content' ] || $options[ 'content' ] == 'both' ) && ( $options[ 'placement' ] == 'tl' || $options[ 'placement' ] == 'tr' ) ) $content = $fb . $content;
elseif( ( $post->post_type == $options[ 'content' ] || $options[ 'content' ] == 'both' ) && ( $options[ 'placement' ] == 'bl' || $options[ 'placement' ] == 'br' ) ) $content = $content . $fb;
return $content;
}
/*
* LEGACY FUNCTION
* @uses _deprecated_function
* @return text
/**
* Stub function to prevent fatal errors if a developer hooked into this somewhere.
*
* @return false
*/
function SFBSB_do() {
_deprecated_function( __FUNCTION__, '2.0', 'SFBSB_direct()' );
return '<!-- Simple Facebook Share Button: this function is no longer supported. See the plugin documentation and replace this function with SFBSB_direct(). -->';
return false;
}
?>
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment