Backtype Tweetcount plugin. Version: 0.9.2 Author: FBShare.Me Author URI: http://www.fbshare.me/ */ /* Copyright 2009 Snowball Factory, Inc (email : info@snowballfactory.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ if (is_admin()) { add_action('admin_menu', 'fbsc_options'); add_action('admin_init', 'fbsc_init'); register_activation_hook(__FILE__, 'fbsc_activate'); } add_filter('the_content', 'fbsc_update'); add_filter('get_the_excerpt', 'fbsc_remove_filter', 9); function fbsc_options() { add_options_page('FB Sharecount Settings', 'Sharecount for Facebook', 8, 'facebook-sharecount', 'fbsc_options_page'); } // Register these variables (WP 2.7 & newer) function fbsc_init() { if (function_exists('register_setting')) { register_setting('fbsc-options', 'fbsc_size'); register_setting('fbsc-options', 'fbsc_location'); register_setting('fbsc-options', 'fbsc_style'); register_setting('fbsc-options', 'fbsc_api_key'); register_setting('fbsc-options', 'fbsc_google_analytics'); register_setting('fbsc-options', 'fbsc_badge_text'); register_setting('fbsc-options', 'fbsc_badge_color'); register_setting('fbsc-options', 'fbsc_pages'); } } // default options function fbsc_activate() { add_option('fbsc_size', 'large'); add_option('fbsc_location', 'top'); add_option('fbsc_style', 'float:left;margin-right:10px;'); add_option('fbsc_api_key', ''); add_option('fbsc_google_analytics', ''); add_option('fbsc_badge_text', ''); add_option('fbsc_badge_color', ''); add_option('fbsc_pages', 'true'); } function fbsc_update($content) { global $post; if (get_option('fbsc_location') == 'manual') { return $content; } if (is_feed()) { return $content; } if (is_page() and (get_option('fbsc_pages') != 'true')) { return $content; } if (get_post_meta($post->ID, 'fbsc', true) == '') { $button = facebook_sharecount(); switch (get_option('fbsc_location')) { case 'topbottom': return $button . $content . $button; break; case 'top': return $button . $content; break; case 'bottom': return $content . $button; break; default: return $button . $content; break; } } else { return $content; } } function fbsc_remove_filter($content) { remove_action('the_content', 'fbsc_update'); return $content; } function fbsc_options_page() { echo '