configuration panel for more settings. This plugin is inspired from the SexyBookmarks plugin for Wordpress. This plugin is also compatible with Support Forum plugin. Version: 1.1 Author: Gautam Author URI: http://www.gaut.am/ Original Social It bbPress Plugin Copyright 2009 Gautam (email : admin@gaut.am) (website: http://gaut.am) Original SexyBookmarks Plugin Copyright 2009 Eight7Teen (email : josh@eight7teen.com), Norman Yung (www.robotwithaheart.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Main PHP File for Social It plugin (for bbPress) by www.gaut.am */ define('SOCIALIT_OPTIONS','Social-It'); define('SOCIALIT_vNum','1.1'); define('SOCIALIT_PLUGPATH', bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\\"),"\\"),array("","/"),dirname(__FILE__)),' /\\').'/'); //thanks ck for this require_once('bookmarks-data.php'); //reload $socialit_plugopts = bb_get_option(SOCIALIT_OPTIONS); if(!$socialit_plugopts){ //add defaults to an array $socialit_plugopts = array( 'reloption' => 'nofollow', // 'nofollow', or '' 'targetopt' => '_blank', // '_blank' or '_self' 'bgimg-yes' => 'yes', // 'yes' or blank 'bgimg' => 'caring', // 'sexy', 'caring', 'wealth' 'shorty' => 'trim', 'topic' => '1', 'bookmark' => array_keys($socialit_bookmarks_data), 'xtrastyle' => '', 'feed' => '0', // 1 or 0 'expand' => '1', 'autocenter' => '0', 'ybuzzcat' => 'science', 'ybuzzmed' => 'text', 'twittcat' => 'Internet', 'default_tags' => '', 'warn-choice' => '', 'sfpnonres' => 'yes', 'sfpres' => 'yes', 'sfpnonsup' => 'yes', 'shorturls' => array(), ); bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts); } //curl, file get contents or nothing, used for short url and for updater function socialit_nav_browse($url){ if (function_exists('curl_init')) { // Use cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($ch, CURLOPT_TIMEOUT, 3); $source = curl_exec($ch); curl_close($ch); } elseif (function_exists('file_get_contents')) { // use file_get_contents() $source = file_get_contents($url); } else { $source = null; } return $source; } //check for updates, as bbpress doesnt check itself :( function socialit_update_check(){ $latest_ver = trim(socialit_nav_browse("http://gaut.am/uploads/plugins/updater.php?pid=1&chk=ver&soft=bb¤t=".SOCIALIT_vNum)); if($latest_ver){ if(SOCIALIT_vNum < $latest_ver){ return $latest_ver; }else{ return false; } }else{ return false; } } //add sidebar link to settings page function socialit_menu_link() { if (function_exists('bb_admin_add_submenu')) { bb_admin_add_submenu( __( 'Social It' ), 'administrate', 'socialit_settings_page', 'options-general.php' ); } } function socialit_network_input_select($name, $hint) { global $socialit_plugopts; return sprintf('', $name, $hint, @in_array($name, $socialit_plugopts['bookmark'])?'checked="checked" ':"", $name, $name ); } //get current page rss link, code taken from functions.bb-template.php in bb-includes, posts' rss prefered instead of topics' function socialit_get_current_rss_link(){ switch (bb_get_location()) { case 'profile-page': if ( $tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2) ) if ($tab != 'favorites') break; $feed = get_favorites_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); break; case 'topic-page': $feed = get_topic_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); break; case 'tag-page': if (bb_is_tag()) { $feed = bb_get_tag_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); } break; case 'forum-page': $feed = bb_get_forum_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); break; case 'front-page': $feed = bb_get_posts_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); break; case 'view-page': global $bb_views, $view; if ($bb_views[$view]['feed']) { $feed = bb_get_view_rss_link(null, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); } break; default: $feed = bb_get_posts_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED); break; } return $feed; } //gets current URL, returns string, taken from Support Forum Plugin function socialit_get_current_url() { $schema = 'http://'; if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { $schema = 'https://'; } if ($querystring = $_SERVER['QUERYSTRING']) { $querystring = ltrim($querystring, '?&'); $querystring = rtrim($querystring, '&'); if ($querystring) { $querystring = '?' . $querystring; } } $uri = $schema . $_SERVER['HTTP_HOST'] . rtrim($_SERVER['REQUEST_URI'], '?&') . $querystring; return $uri; } //write settings page function socialit_settings_page() { echo ''; global $socialit_plugopts, $socialit_bookmarks_data, $bbdb; $donate_link = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6590760"; $twitter_link = "http://twitter.com/gautam_2011"; // processing form submission $status_message = ""; $error_message = ""; //check for updates if(socialit_update_check()){ //update available echo '
New version of Social It is available! Please download the latest version here.
'; //box cant be closed } if(isset($_POST['save_changes'])) { $status_message = 'Your changes have been saved successfully! | Maybe you would consider donating or following me on Twitter?'; //was there an error? if($_POST['bookmark'] == '') { $error_message = 'You can\'t display the menu if you don\'t choose a few sites to add to it!'; } elseif($_POST['twittcat'] == '' && in_array('socialit-twittley', $socialit_plugopts['bookmark'])) { $error_message = 'You need to select the primary category for any articles submitted to Twittley.'; } elseif($_POST['defaulttags'] == '' && in_array('socialit-twittley', $socialit_plugopts['bookmark'])) { $error_message = 'You need to set at least 1 default tag for any articles submitted to Twittley.'; } else { $socialit_plugopts['topic'] = $_POST['topic']; $socialit_plugopts['xtrastyle'] = $_POST['xtrastyle']; $socialit_plugopts['reloption'] = $_POST['reloption']; $socialit_plugopts['targetopt'] = $_POST['targetopt']; $socialit_plugopts['bookmark'] = $_POST['bookmark']; $socialit_plugopts['shorty'] = $_POST['shorty']; $socialit_plugopts['twittid'] = $_POST['twittid']; $socialit_plugopts['twittcat'] = $_POST['twittcat']; $socialit_plugopts['defaulttags'] = $_POST['defaulttags']; $socialit_plugopts['ybuzzcat'] = $_POST['ybuzzcat']; $socialit_plugopts['ybuzzmed'] = $_POST['ybuzzmed']; $socialit_plugopts['bgimg-yes'] = $_POST['bgimg-yes']; $socialit_plugopts['bgimg'] = $_POST['bgimg']; $socialit_plugopts['feed'] = $_POST['feed']; $socialit_plugopts['expand'] = $_POST['expand']; $socialit_plugopts['autocenter'] = $_POST['autocenter']; $socialit_plugopts['sfpnonres'] = $_POST['sfpnonres']; $socialit_plugopts['sfpres'] = $_POST['sfpres']; $socialit_plugopts['sfpnonsup'] = $_POST['sfpnonsup']; bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts); } if(in_array('socialit-yahoobuzz', $socialit_plugopts['bookmark'])) { $ybuzz_default_class = ""; } else { $ybuzz_default_class = "hidden"; } if ($_POST['clearShortUrls']) { $count = count($socialit_plugopts['shorturls']); $socialit_plugopts['shorturls'] = array(); bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts); echo '
'.$count.' Short URL(s) have been reset.
'; } } //if there was an error, if ($error_message != '') { echo '
'.$error_message.'
X
'; } elseif ($status_message != '') { echo '
'.$status_message.'
X
'; } ?>

Support by Donating

We've got big plans for Social It, but we can't implement any of them without the proper funding!

I'm sure you're aware that the development and continued support for this plugin is a non-paying job, and as such, all donations or contributions are greatly appreciated! Top 5 donors will be listed on the plugin settings page (this page).

Even if you do not want to donate, you can follow me on Twitter or check my website for latest updates.

Top Donors

None till now! Donate now to get to this list and your name with your website link will be here in the next release!

Plugin Inspiration

This plugin is inspired from SexyBookmarks plugin for Wordpress made by Josh & Norman. They have really worked hard on this.

Help

You can see the Plugin Information here, FAQ here, Usage & Installation How-To Guide here, and Ask for Help here.

$value) { $url=str_replace(strtoupper($key), $value, $url); } return sprintf( '
  • %s
  • ', $name, $url, $socialit_plugopts['reloption'], $socialit_plugopts['targetopt']=="_blank"?' class="external"':'', $socialit_bookmarks_data[$name]['share'], $socialit_bookmarks_data[$name]['share'] ); } function get_socialit() { global $socialit_plugopts, $bbdb, $public_tags; $dont_get_si = false; if((class_exists('Support_Forum')) && (bb_is_topic())){ //compatibility with Support Forum plugin for bbPress $support_forum = new Support_Forum(); if($support_forum->isActive()){ if(($socialit_plugopts['sfpnonres'] == "no" && $support_forum->getTopicStatus() == "no") || ($socialit_plugopts['sfpres'] == "no" && $support_forum->getTopicStatus() == "yes") || ($socialit_plugopts['sfpnonsup'] == "no" && $support_forum->getTopicStatus() == "mu")){ $dont_get_si = true; } } } if(!$dont_get_si){ $site_name = bb_get_option('name'); if(bb_is_topic()){ $perms = urlencode(get_topic_link()); $title = urlencode(get_topic_title()); $feedperms = strtolower($perms); $mail_subject = $title; // Grab post tags for Twittley tags. If there aren't any, use default tags set in plugin options page $get_tags = bb_get_topic_tags(get_topic_id()); if ($get_tags){ foreach($get_tags as $tag) { $keywords = $keywords.$tag->name.','; } } $topic_id_ft = get_topic_id(); //topic id for getting text $first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1"); $socialit_content = get_post_text($first_post); }else{ $perms = socialit_get_current_url(); $title = urlencode(bb_get_title()); $feedperms = strtolower($perms); $mail_subject = $title; $socialit_content = bb_get_option('description'); } $title = str_replace('+','%20',$title); $title = str_replace("’","'",$title); $short_title = substr($title, 0, 60)."..."; $socialit_content = urlencode(substr(strip_tags(strip_shortcodes($socialit_content)),0,300)); $socialit_content = str_replace('+','%20',$socialit_content); $socialit_content = str_replace("’","'",$socialit_content); $post_summary = stripslashes($socialit_content); if (!empty($keywords)) { $d_tags = $keywords; }else { $d_tags = $socialit_plugopts['defaulttags']; } $y_cat = $socialit_plugopts['ybuzzcat']; $y_med = $socialit_plugopts['ybuzzmed']; $t_cat = $socialit_plugopts['twittcat']; $current_rss_link = socialit_get_current_rss_link(); //$mail_subject = $title; //$feedstructure = 'feed'; // Temporary fix for bug that breaks layout when using NextGen Gallery plugin if( (strpos($post_summary, '[') || strpos($post_summary, ']')) ) { $post_summary = ""; } if( (strpos($socialit_content, '[') || strpos($socialit_content,']')) ) { $socialit_content = ""; } // select the background if(!isset($socialit_plugopts['bgimg-yes'])) { $bgchosen = ''; } elseif($socialit_plugopts['bgimg'] == 'sexy') { $bgchosen = ' social-it-bg-sexy'; } elseif($socialit_plugopts['bgimg'] == 'caring') { $bgchosen = ' social-it-bg-caring'; } elseif($socialit_plugopts['bgimg'] == 'care-old') { $bgchosen = ' social-it-bg-caring-old'; } elseif($socialit_plugopts['bgimg'] == 'love') { $bgchosen = ' social-it-bg-love'; } elseif($socialit_plugopts['bgimg'] == 'wealth') { $bgchosen = ' social-it-bg-wealth'; } $style=($socialit_plugopts['autocenter'])?'':' style="'.__($socialit_plugopts['xtrastyle']).'"'; if (bb_is_feed()) $style=''; // do not add inline styles to the feed. $expand = $socialit_plugopts['expand']?' social-it-expand':''; $autocenter = $socialit_plugopts['autocenter']?' social-it-center':''; //write the menu $socials = '
    '; //echo $socials; return $socials; } } // This function is what allows people to insert the menu wherever they please rather than above/below a post... function selfserv_socialit() { echo get_socialit(); } //write the code function socialit_public() { global $socialit_plugopts; echo "\n\n".''."\n"; wp_register_style('social-it', SOCIALIT_PLUGPATH.'css/style.css', false, SOCIALIT_vNum, 'all'); wp_print_styles('social-it'); if ($socialit_plugopts['expand'] || $socialit_plugopts['autocenter'] || $socialit_plugopts['targetopt']=='_blank') { wp_register_script('social-it-public-js', SOCIALIT_PLUGPATH."js/social-it-public.js", array('jquery'), SOCIALIT_vNum); wp_print_scripts('social-it-public-js'); } echo ''."\n\n"; } //styles for admin area function socialit_admin() { if($_GET['plugin'] == 'socialit_settings_page'){ wp_register_style('social-it', SOCIALIT_PLUGPATH.'css/admin-style.css', false, SOCIALIT_vNum, 'all'); wp_print_styles('social-it'); if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false)){ //ie, as usual, doesnt render the css properly :| and creates problems for the developers wp_register_style('ie-social-it', SOCIALIT_PLUGPATH.'css/ie7-admin-style.css', false, SOCIALIT_vNum, 'all'); wp_print_styles('ie-social-it'); } echo ''; //loads newer version of jquery. bbpress uses old version echo ''; //ui core & sortable script not included in bbpress :-( echo ''; echo ''; //social-it admin js script } } function socialit_insert_in_post($post_content) { global $socialit_plugopts, $bbdb; // decide whether or not to generate the bookmarks. if ((bb_is_topic() && $socialit_plugopts['topic'] == 1) || (bb_is_feed() && $socialit_plugopts['feed'] == 1)){ //socials should be generated and added $post_id_fc = get_post_id(); //post id for check if(bb_is_first($post_id_fc)){ echo $post_content.get_socialit(); }else{ echo $post_content; } }else{ echo $post_content; } } //add actions/filters add_action('bb_admin_menu_generator', 'socialit_menu_link'); //link in settings add_action('bb_admin_head', 'socialit_admin'); //admin css add_action('bb_head', 'socialit_public'); //public css add_filter('post_text', 'socialit_insert_in_post'); //to insert social it automatically below the first post of every topic ?>