=')) { return; } } deactivate_plugins(basename(__FILE__)); // Deactivate ourself wp_die("The base SFC plugin must be activated before this plugin will run."); } register_activation_hook(__FILE__, 'sfc_like_activation_check'); global $sfc_like_defaults; $sfc_like_defaults = array( 'id'=>0, 'layout'=>'standard', // standard or button_count 'showfaces'=>'true', // true or false 'width'=>'260', 'height'=>'26', 'action'=>'like', // like or recommend 'colorscheme'=>'light', // light or dark 'font' => 'lucida+grande', // arial, lucida+grande, seqoe+ui, tahoma, trebuchet+ms, or verdana ); function get_sfc_like_button($args='') { global $sfc_like_defaults; $args = wp_parse_args($args, $sfc_like_defaults); extract($args); $url = get_permalink($id); // This wont work until I switch to the new libraries //return ""; return "

"; } function sfc_like_button($args='') { echo get_sfc_like_button($args); } function sfc_like_shortcode($atts) { global $sfc_like_defaults; $args = shortcode_atts($sfc_like_defaults, $atts); return get_sfc_like_button($args); } add_shortcode('fb-like', 'sfc_like_shortcode'); function sfc_like_button_automatic($content) { $options = get_option('sfc_options'); $button = get_sfc_like_button(); switch ($options['like_position']) { case "before": $content = $button . $content; break; case "after": $content = $content . $button; break; case "both": $content = $button . $content . $button; break; case "manual": default: break; } return $content; } add_filter('the_content', 'sfc_like_button_automatic', 30); // add the admin sections to the sfc page add_action('admin_init', 'sfc_like_admin_init'); function sfc_like_admin_init() { add_settings_section('sfc_like', 'Like Button Settings', 'sfc_like_section_callback', 'sfc'); add_settings_field('sfc_like_position', 'Like Button Position', 'sfc_like_position', 'sfc', 'sfc_like'); } function sfc_like_section_callback() { echo '

Choose where you want the like button added to your content.

'; } function sfc_like_position() { $options = get_option('sfc_options'); if (!$options['like_position']) $options['like_position'] = 'manual'; ?>

/', $content, $matches) ) { foreach ( wp_kses_hair($matches[1], array('http')) as $attr) $img[$attr['name']] = $attr['value']; if ( isset($img['src']) ) { if (!isset($img['class']) || (isset($img['class']) && false === strpos($img['class'], 'wp-smiley')) ) { // ignore smilies ?>