'."\n"; if($ssb_googleplus) { $ssb_buttonscode .= '
'."\n"; } if($ssb_fblike) { $ssb_buttonscode .= ''."\n"; } if($ssb_twitter) { $ssb_buttonscode .= ''."\n"; } $ssb_buttonscode .= ''."\n"; if(is_single()) { if($ssb_beforepost) { $content = $ssb_buttonscode.$content; } if($ssb_afterpost) { $content = $content.$ssb_buttonscode; } }else if(is_page()) { if($ssb_beforepage) { $content = $ssb_buttonscode.$content; } if($ssb_afterpage) { $content = $content.$ssb_buttonscode; } }else{ if($ssb_beforearchive) { $content = $ssb_buttonscode.$content; } if($ssb_afterarchive) { $content = $content.$ssb_buttonscode; } } return $content; } function ssb_where_to_insert() { // display on single post? $ssb_beforepost = get_option('ssb_beforepost'); $ssb_afterpost = get_option('ssb_afterpost'); if(is_single() && ($ssb_beforepost || $ssb_afterpost)) { return true; } // display on single page? $ssb_beforepage = get_option('ssb_beforepage'); $ssb_afterpage = get_option('ssb_afterpage'); if(is_page() && ($ssb_beforepage || $ssb_afterpage)) { return true; } // display on frontpage, categories, archives, tags? $ssb_showfront = get_option('ssb_showfront'); $ssb_showcategory = get_option('ssb_showcategory'); $ssb_showarchive = get_option('ssb_showarchive'); $ssb_showtag = get_option('ssb_showtag'); if(is_front_page() && $ssb_showfront) { return true; } if(is_category() && $ssb_showcategory) { return true; } if(is_date() && $ssb_showarchive) { return true; } if(is_tag() && $ssb_showtag) { return true; } return false; } add_filter ('the_content', 'ssb_insert_buttons'); add_filter ('the_excerpt', 'ssb_insert_buttons'); function ssb_menu() { global $wpdb; include 'ssb-admin.php'; } function ssb_admin_actions() { add_options_page("Simple Social Buttons ", "Simple Social Buttons ", 1, "simple-social-buttons", "ssb_menu"); } add_action('admin_menu', 'ssb_admin_actions'); add_filter('plugin_action_links', 'ssb_plugin_action_links', 10, 2); function ssb_plugin_action_links($links, $file) { static $this_plugin; if (!$this_plugin) { $this_plugin = plugin_basename(__FILE__); } if ($file == $this_plugin) { // The "page" query string value must be equal to the slug // of the Settings admin page we defined earlier, which in // this case equals "myplugin-settings". $settings_link = ''.__("Settings", "simplesocialbuttons").''; array_unshift($links, $settings_link); } return $links; } // install and default settings function ssb_set_defaults() { add_option( "ssb_googleplus", "1", "", "yes" ); add_option( "ssb_fblike", "1", "", "yes" ); add_option( "ssb_twitter", "1", "", "yes" ); add_option( "ssb_beforepost", "1", "", "yes" ); } register_activation_hook( __FILE__, 'ssb_set_defaults' ); function ssb_init() { load_plugin_textdomain( 'simplesocialbuttons', '', dirname(plugin_basename( __FILE__ ))."/lang" ); } add_action( 'init', 'ssb_init' ); ?>