Thomas McMahon for footwork on the URLs. Modified for jQuery by Bennett McElwee. Questions on configuration, etc.? Make sure to read the README. Version: 1.4+ Author: Alex King Author URI: http://alexking.org/ */ @define('AKST_ADDTOCONTENT', true); // set this to false if you do not want to automatically add the Share This link to your content @define('AKST_ADDTOFOOTER', true); // set this to false if you do not want to automatically add the Share This form to the page in your footer @define('AKST_ADDTOFEED', true); // set this to false if you do not want to automatically add the Share This link to items in your feed @define('AKST_SHOWICON', true); // set this to false if you do not want to show the Share This icon next to the Share This link // Find more URLs here: // http://3spots.blogspot.com/2006/02/30-social-bookmarks-add-to-footer.html $social_sites = array( 'delicious' => array( 'name' => 'del.icio.us' , 'url' => 'http://del.icio.us/post?url={url}&title={title}' ) , 'digg' => array( 'name' => 'Digg' , 'url' => 'http://digg.com/submit?phase=2&url={url}&title={title}' ) , 'furl' => array( 'name' => 'Furl' , 'url' => 'http://furl.net/storeIt.jsp?u={url}&t={title}' ) , 'netscape' => array( 'name' => 'Netscape' , 'url' => ' http://www.netscape.com/submit/?U={url}&T={title}' ) , 'yahoo_myweb' => array( 'name' => 'Yahoo! My Web' , 'url' => 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u={url}&t={title}' ) , 'stumbleupon' => array( 'name' => 'StumbleUpon' , 'url' => 'http://www.stumbleupon.com/submit?url={url}&title={title}' ) , 'google_bmarks' => array( 'name' => 'Google Bookmarks' , 'url' => ' http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}' ) , 'technorati' => array( 'name' => 'Technorati' , 'url' => 'http://www.technorati.com/faves?add={url}' ) , 'blinklist' => array( 'name' => 'BlinkList' , 'url' => 'http://blinklist.com/index.php?Action=Blink/addblink.php&Url={url}&Title={title}' ) , 'newsvine' => array( 'name' => 'Newsvine' , 'url' => 'http://www.newsvine.com/_wine/save?u={url}&h={title}' ) , 'magnolia' => array( 'name' => 'ma.gnolia' , 'url' => 'http://ma.gnolia.com/bookmarklet/add?url={url}&title={title}' ) , 'reddit' => array( 'name' => 'reddit' , 'url' => 'http://reddit.com/submit?url={url}&title={title}' ) , 'windows_live' => array( 'name' => 'Windows Live' , 'url' => 'https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={url}&title={title}&top=1' ) , 'tailrank' => array( 'name' => 'Tailrank' , 'url' => 'http://tailrank.com/share/?link_href={url}&title={title}' ) ); /* // Additional sites , 'blogmarks' => array( 'name' => 'Blogmarks' , 'url' => 'http://blogmarks.net/my/new.php?mini=1&url={url}&title={title}' ) , 'favoriting' => array( 'name' => 'Favoriting' , 'url' => 'http://www.favoriting.com/nuevoFavorito.asp?qs_origen=3&qs_url={url}&qs_title={title}' ) */ // NO NEED TO EDIT BELOW THIS LINE // ============================================================ @define('AK_WPROOT', '../../../'); @define('AKST_FILEPATH', '/wp-content/plugins/share-this/share-this.php'); if (function_exists('load_plugin_textdomain')) { load_plugin_textdomain('alexking.org'); } $akst_action = ''; if (!function_exists('ak_check_email_address')) { function ak_check_email_address($email) { // From: http://www.ilovejackdaniels.com/php/email-address-validation/ // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } } if (!function_exists('ak_decode_entities')) { function ak_decode_entities($text, $quote_style = ENT_COMPAT) { // From: http://us2.php.net/manual/en/function.html-entity-decode.php#68536 if (function_exists('html_entity_decode')) { $text = html_entity_decode($text, $quote_style, 'ISO-8859-1'); // NOTE: UTF-8 does not work! } else { $trans_tbl = get_html_translation_table(HTML_ENTITIES, $quote_style); $trans_tbl = array_flip($trans_tbl); $text = strtr($text, $trans_tbl); } $text = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $text); $text = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $text); return $text; } } if (!function_exists('ak_jquery')) { function ak_jquery() { if (!function_exists('wp_enqueue_script')) { global $ak_jquery; if (!isset($ak_jquery) || !$ak_jquery) { print(' '); } $ak_jquery = true; } } } if (!empty($_REQUEST['akst_action'])) { switch ($_REQUEST['akst_action']) { case 'js': header("Content-type: text/javascript"); ?> function akst_share(id, url, title) { var form = jQuery('#akst_form'); var post_id = document.getElementById('akst_post_id'); if (form.css('display') == 'block' && post_id.value == id) { form.css('display', 'none'); return; } var link = jQuery('#akst_link_' + id); // Set up the form post_id.value = id; $data) { print(' document.getElementById("akst_'.$key.'").href = akst_share_url("'.$data['url'].'", url, title);'."\n"); } ?> link.after(form); //form.css('display', 'block'); form.slideDown('fast'); } function akst_share_url(base, url, title) { base = base.replace('{url}', url); return base.replace('{title}', title); } function akst_share_tab(tab) { var tab1 = document.getElementById('akst_tab1'); var tab2 = document.getElementById('akst_tab2'); var body1 = document.getElementById('akst_social'); var body2 = document.getElementById('akst_email'); switch (tab) { case '1': tab2.className = ''; tab1.className = 'selected'; body2.style.display = 'none'; body1.style.display = 'block'; break; case '2': tab1.className = ''; tab2.className = 'selected'; body1.style.display = 'none'; body2.style.display = 'block'; break; } } #akst_form { background: #999; border: 1px solid #ddd; display: none; position: absolute; width: 350px; z-index: 999; } #akst_form a.akst_close { color: #fff; float: right; margin: 5px; } #akst_form ul.tabs { border: 1px solid #999; list-style: none; margin: 10px 10px 0 10px; padding: 0; } #akst_form ul.tabs li { background: #ccc; border-bottom: 1px solid #999; cursor: pointer; float: left; margin: 0 3px 0 0; padding: 3px 5px 2px 5px; } #akst_form ul.tabs li.selected { background: #fff; border-bottom: 1px solid #fff; cursor: default; padding: 4px 5px 1px 5px; } #akst_form div.clear { clear: both; float: none; } #akst_social, #akst_email { background: #fff; border: 1px solid #fff; padding: 10px; } #akst_social ul { list-style: none; margin: 0; padding: 0; } #akst_social ul li { float: left; margin: 0; padding: 0; width: 45%; } #akst_social ul li a { background-position: 0px 2px; background-repeat: no-repeat; display: block; float: left; height: 24px; padding: 4px 0 0 22px; vertical-align: middle; } $data) { print( '#akst_'.$key.' { background-image: url('.$key.'.gif); } '); } ?> #akst_email { display: none; text-align: left; } #akst_email form, #akst_email fieldset { border: 0; margin: 0; padding: 0; } #akst_email fieldset legend { display: none; } #akst_email ul { list-style: none; margin: 0; padding: 0; } #akst_email ul li { margin: 0 0 7px 0; padding: 0; } #akst_email ul li label { color: #555; display: block; margin-bottom: 3px; } #akst_email ul li input { padding: 3px 10px; } #akst_email ul li input.akst_text { padding: 3px; width: 280px; } .akst_share_link { background: 1px 0 url(share-icon-16x16.gif) no-repeat; padding: 1px 0 3px 22px; } '); } add_action('wp_head', 'akst_head'); function akst_share_link($action = 'print') { global $akst_action, $post; if (in_array($akst_action, array('page'))) { return ''; } if (is_feed() || (function_exists('akm_check_mobile') && akm_check_mobile())) { $onclick = ''; } else { $onclick = 'onclick="akst_share(\''.$post->ID.'\', \''.urlencode(get_permalink($post->ID)).'\', \''.urlencode(get_the_title()).'\'); return false;"'; } global $post; ob_start(); ?> title="" id="akst_link_ID); ?>" class="akst_share_link" rel="nofollow"> '.akst_share_link('return').'

'; } return $content; } add_action('the_content', 'akst_add_share_link_to_content'); add_action('the_content_rss', 'akst_add_share_link_to_content'); function akst_share_form() { global $post, $social_sites, $current_user; if (isset($current_user)) { $user = get_currentuserinfo(); $name = $current_user->user_nicename; $email = $current_user->user_email; } else { $user = wp_get_current_commenter(); $name = $user['comment_author']; $email = $user['comment_author_email']; } ?>
back button and make sure those e-mail addresses are valid then try again.', 'alexking.org')); } // $post = &get_post($post_id); $headers = "MIME-Version: 1.0\n" . 'From: "'.$name.'" <'.$email.'>'."\n" .'Reply-To: "'.$name.'" <'.$email.'>'."\n" .'Return-Path: "'.$name.'" <'.$email.'>'."\n" ."Content-Type: text/plain; charset=\"" . get_option('blog_charset') ."\"\n"; $subject = __('Check out this post on ', 'alexking.org').get_bloginfo('name'); $message = __('Greetings--', 'alexking.org')."\n\n" .$name.__(' thinks this will be of interest to you:', 'alexking.org')."\n\n" .ak_decode_entities(get_the_title($post_id))."\n\n" .get_permalink($post_id)."\n\n" .__('Enjoy.', 'alexking.org')."\n\n" .'--'."\n" .get_bloginfo('home')."\n"; @wp_mail($to, $subject, $message, $headers); if (!empty($_SERVER['HTTP_REFERER'])) { $url = $_SERVER['HTTP_REFERER']; } header("Location: $url"); status_header('302'); die(); } function akst_hide_pop() { return false; } function akst_page() { global $social_sites, $akst_action, $current_user, $post; $akst_action = 'page'; add_action('akpc_display_popularity', 'akst_hide_pop'); $id = 0; if (!empty($_GET['p'])) { $id = intval($_GET['p']); } if ($id <= 0) { header("Location: ".get_bloginfo('siteurl')); die(); } if (isset($current_user)) { $user = get_currentuserinfo(); $name = $current_user->user_nicename; $email = $current_user->user_email; } else { $user = wp_get_current_commenter(); $name = $user['comment_author']; $email = $user['comment_author_email']; } query_posts('p='.$id); if (have_posts()) : while (have_posts()) : the_post(); header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset')); ?> <?php _e('Share This : ', 'alexking.org'); the_title(); ?>

What is this? From this page you can use the Social Web links to save %s to a social bookmarking site, or the E-mail form to send a link via e-mail.', 'alexking.org'), ''.get_the_title().''); ?>

    $data) { $link = str_replace( array( '{url}' , '{title}' ) , array( urlencode(get_permalink($id)) , urlencode(get_the_title()) ) , $data['url'] ); print('
  • '.$data['name'].'
  • '."\n"); } ?>