Social Links Author: Alessio Caiazza Version: 1.0.12 Author URI: http://alessiocaiazza.info /* Social Links Copyright 2008 Kareem Sultan (email : kareemsultan@gmail.com) */ /* (c) 2009 Alessio Caiazza 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 http://www.gnu.org/licenses/gpl.txt */ //call install function upon activation register_activation_hook(__FILE__,'social_links_install'); //TO DO use these definitions instead define('SOCIAL_LINKS_VERSION', '1.0.7'); define('SOCIAL_LINKS_DB_VERSION', '1.1'); define('KEY_SITE_ID',0); define('KEY_IMAGE',1); define('KEY_URL_TEMPLATE',2); define('KEY_INSTRUCTION',3); define('KEY_DISPLAY_NAME',4); //$sl_db_version = "1.0"; $plugindir = get_bloginfo('wpurl').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__)); $definitions = array( array(0,'facebook.png','%userid%','Enter your complete Facebook profile URL','Facebook'), array(1,'myspace.png','%userid%','Enter your complete MySpace URL.','MySpace'), array(2,'linkedin.png','%userid%','Enter your complete LinkedIn URL.','LinkedIn'), array(3,'picasa.png','http://picasaweb.google.com/%userid%','Enter your Picasa(Google) username.','Picasa Web Album'), array(4,'flickr.png','http://flickr.com/photos/%userid%','Enter your flickr username','Flickr'), array(5,'youtube.png','http://www.youtube.com/%userid%','Enter your YouTube username','YouTube'), array(6,'twitter.png','http://twitter.com/%userid%','Enter your Twitter username','Twitter'), array(7,'pownce.png','http://pownce.com/%userid%','Enter your Pownce username','Pownce'), array(8,'plurk.png','http://www.plurk.com/user/%userid%','Enter your Plurk username','Plurk'), array(9,'digg.png','http://www.digg.com/users/%userid%','Enter your Digg username.','Digg'), array(10,'delicious.png','http://delicious.com/%userid%','Enter your Delicious username','Delicious'), array(11,'blogmarks.png','http://blogmarks.net/user/%userid%','Enter your BlogMarks username.','BlogMarks'), array(12,'stumbleupon.png','http://%userid%.stumbleupon.com','Enter your Stumble Upon username','Stumble Upon'), array(13,'lastfm.png','http://www.last.fm/user/%userid%','Enter your Last.fm username','Last.fm'), array(14,'amazon.png','%userid%','Enter your complete Amazon Wishlist URL','Amazon Wishlist'), array(15,'blog.png','%userid%','Enter the complete blog URL.','Blog'), array(16,'jeqq.png','http://www.jeqq.com/user/view/profile/%userid%','Enter your Jeqq username','Jeqq'), array(17,'dapx.png','%userid%','Enter your complete Dapx URL.','Dapx'), array(18,'xing.jpg','%userid%','Enter your complete Xing URL.','Xing'), array(19,'sixent.png','http://%userid%.sixent.com/','Enter your Sixent username','Sixent'), array(20,'technorati.jpg','http://technorati.com/people/technorati/%userid%/','Enter your Technorati username.','Technorati'), array(21,'friendfeed.png','http://friendfeed.com/%userid%','Enter your FriendFeed username.','FriendFeed'), array(22,'identica.png','http://identi.ca/%userid%','Enter your Identi.ca username.','Identi.ca'), array(23,'bitbucket.png','http://bitbucket.org/%userid%','Enter your Bitbucket username.','Bitbucket'), array(24,'github.png','http://github.com/%userid%','Enter your Github username.','Github'), array(25,'hellotxt.gif','http://hellotxt.com/user/%userid%','Enter your Hellotxt username.','Hellotxt'), array(26,'hyves.png','http://%userid%.hyves.nl','Enter your Hyves.nl username.','Hyves.nl'), array(27,'disqus.png','http://disqus.com/people/%userid%','Enter your Disqus username.','Disqus'), array(28,'redgage.png','http://www.redgage.com/%userid%','Enter your RedGage username.','RedGage'), array(29,'goodreads.png','http://goodreads.com/%userid%','Enter your GoodReads username','GoodReads'), array(30,'qype.png','http://www.qype.com/people/%userid%','Enter your Qype username.','Qype'), array(31,'orkut.png','http://www.orkut.com/Main#Profile.aspx?uid=%userid%','Enter your Orkut numeric uid.','Orkut'), array(32,'google.png','http://www.google.com/profiles/%userid%','Enter your Google username (without @google.com).','Google Profile'), array(33,'googlereader.png','http://www.google.com/reader/shared/%userid%','Enter your Google Reader shared number.','Google Reader'), array(34,'ebay.png','http://myworld.ebay.com/%userid%','Enter your Ebay username.','Ebay'), array(35,'qik.png','http://qik.com/%userid%','Enter your Qik username.','Qik'), array(36,'anobii.png','http://www.anobii.com/%userid%','Enter your Anobii username.','Anobii'), array(37,'deviantart.png','http://%userid%.deviantart.com','Enter your deviantART username.','DeviantART'), array(38,'songza.png','http://songza.fm/%userid%','Enter your songza username.','Songza'), array(39,'librarything.png','http://www.librarything.com/profile/%userid%','Enter your LibraryThing username.','LibraryThing'), array(40,'google-plus.png','%userid%','Enter your complete Google+ profile URL','Google+'), array(41,'pinterest.png','http://pinterest.com/%userid%','Enter your Pinterest username','Pinterest'), ); //comparison based on socialnetwok name function compare_social($s1, $s2) { return strcmp($s1[KEY_DISPLAY_NAME], $s2[KEY_DISPLAY_NAME]); } //Sorts socialnetworks in alphabetical order uasort($definitions, "compare_social"); function social_links_wrapper(){ // This only works if the widget api is installed if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) return; // ...and if not, exit gracefully from the script. //WPD_print('Filename: '.__FILE__); //WPD_print('DB version: '.get_option( "SOCIAL_LINKS_DB_VERSION" )); // Displays the icons in the sidebar function widget_social_links($args) { global $definitions; extract($args); $options = get_option('widget_social_links'); if (!isset($title) || empty($title)) $title = empty($options['title']) ? 'About Me' : $options['title']; if (!isset($width) || empty($width)) $width = empty($options['width']) ? 20 : $options['width']; echo $before_widget; echo $before_title . $title . $after_title ; echo ''; echo "
'; echo $after_widget; } //Config Panel function widget_social_links_control() { global $definitions; $options = get_option('widget_social_links'); if ( $_POST['social-links-submit'] ) { // Clean up control form submission options $newoptions['title'] = strip_tags(stripslashes($_POST['social-links-title'])); $newoptions['width'] = strip_tags(stripslashes($_POST['social-links-width'])); if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_social_links', $options); } } $title = empty($options['title']) ? 'About Me' : $options['title']; $width = empty($options['width']) ? 100 : $options['width']; ?>
To add a new link select the network from the drop down, fill in the appropriate information and press enter.
To change the order they appear, rearrange the icons in the preview and click 'Save Order'.
To delete a link, simply drag it to the trash can.