function get_socialit() { global $socialit_plugopts, $bbdb, $public_tags, $socialit_is_mobile, $socialit_is_bot; $dont_get_si = false; $topic = get_topic(get_topic_id()); if (class_exists('Support_Forum') && $topic) { //compatibility with Support Forum plugin for bbPress $support_forum = new Support_Forum(); if ($support_forum->isActive() && in_array($topic->forum_id, $support_forum->enabled)) { 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 ($socialit_plugopts['mobile-hide'] == 'yes' && ($socialit_is_mobile || $socialit_is_bot)) { $dont_get_si = true; } if (bb_is_topic() && bb_get_topicmeta($topic->topic_id, 'hide_socialit') == true) { $dont_get_si = true; } if (!$dont_get_si) { if (bb_is_topic()) { $perms = urlencode(get_topic_link()); $title = get_topic_title(); $feedperms = strtolower($perms); // 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 = bb_get_title(); $feedperms = strtolower($perms); $socialit_content = bb_get_option('description'); } if (strlen($title) >= 80) { $short_title = urlencode(substr($title, 0, 80) . "[..]"); } else { $short_title = urlencode($title); } $title = urlencode($title); $site_name = bb_get_option('name'); $socialit_content = urlencode(substr(strip_tags(strip_shortcodes($socialit_content)), 0, 300)); $socialit_content = socialit_change_plus_apos($socialit_content); $mail_subject = socialit_change_plus_apos($title); $post_summary = stripslashes($socialit_content); if (!empty($keywords)) { $d_tags = $keywords; } else { $d_tags = $socialit_plugopts['defaulttags']; } $site_name = bb_get_option('name'); $y_cat = $socialit_plugopts['ybuzzcat']; $y_med = $socialit_plugopts['ybuzzmed']; $t_cat = $socialit_plugopts['twittcat']; $short_url = socialit_get_fetch_url(); $current_rss_link = socialit_get_current_rss_link(); // 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'; } elseif ($socialit_plugopts['bgimg'] == 'enjoy') { $bgchosen = ' social-it-bg-enjoy'; } $style = $socialit_plugopts['autocenter'] ? '' : ' style="' . __($socialit_plugopts['xtrastyle']) . '"'; $isfeed = bb_is_feed(); if ($isfeed) { $style = ''; } // do not add inline styles to the feed. $expand = $socialit_plugopts['expand'] ? ' social-it-expand' : ''; if ($socialit_plugopts['autocenter'] == 1) { $autocenter = ' social-it-center'; } elseif ($socialit_plugopts['autocenter'] == 2) { $autocenter = ' social-it-spaced'; } else { $autocenter = ''; } //write the menu $socials = "\n\n" . '<!-- Start Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n" . '<div class="social-it' . $expand . $autocenter . $bgchosen . '"' . $style . '><ul class="socials">'; foreach ($socialit_plugopts['bookmark'] as $name) { if ($name == 'socialit-twitter') { $socials .= bookmark_list_item($name, array('post_by' => !empty($socialit_plugopts['twittid']) ? "(via+@" . $socialit_plugopts['twittid'] . ")" : '', 'short_title' => $short_title, 'fetch_url' => $short_url)); } elseif ($name == 'socialit-mail') { $socials .= bookmark_list_item($name, array('title' => $mail_subject, 'post_summary' => $post_summary, 'permalink' => $perms)); } elseif ($name == 'socialit-diigo') { $socials .= bookmark_list_item($name, array('socialit_teaser' => $socialit_content, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'socialit-linkedin') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'site_name' => $site_name, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'socialit-comfeed') { $socials .= bookmark_list_item($name, array('permalink' => $current_rss_link)); } elseif ($name == 'socialit-yahoobuzz') { $socials .= bookmark_list_item($name, array('permalink' => $perms, 'title' => $title, 'yahooteaser' => $socialit_content, 'yahoocategory' => $y_cat, 'yahoomediatype' => $y_med)); } elseif ($name == 'socialit-twittley') { $socials .= bookmark_list_item($name, array('permalink' => urlencode($perms), 'title' => $title, 'post_summary' => $post_summary, 'twitt_cat' => $t_cat, 'default_tags' => $d_tags)); } else { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } } $socials .= '</ul><div style="clear:both;"></div></div><!-- End Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n\n"; return $socials; } }
function get_sexy() { global $sexy_plugopts, $wp_query, $post; $post = $wp_query->post; if ($sexy_plugopts['position'] == 'manual') { //Check if outside the loop if (empty($post->post_title)) { $perms = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING']; $title = get_bloginfo('name') . wp_title('-', false); $feedperms = strtolower('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING']); $mail_subject = urlencode(get_bloginfo('name') . wp_title('-', false)); } else { $perms = get_permalink($post->ID); $title = $post->post_title; $feedperms = strtolower($perms); $mail_subject = urlencode($post->post_title); } } elseif (is_home() && false !== strpos($sexy_plugopts['pageorpost'], "index")) { //Check if outside the loop if (empty($post->post_title)) { $perms = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING']; $title = get_bloginfo('name') . wp_title('-', false); $feedperms = strtolower('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING']); $mail_subject = urlencode(get_bloginfo('name') . wp_title('-', false)); } else { $perms = get_permalink($post->ID); $title = $post->post_title; $feedperms = strtolower($perms); $mail_subject = urlencode($post->post_title); } } else { $perms = get_permalink($post->ID); $title = $post->post_title; $feedperms = strtolower($perms); $mail_subject = urlencode($post->post_title); } //Determine how to handle post titles for Twitter if (strlen($title) >= 80) { $short_title = urlencode(substr($title, 0, 80) . "[..]"); } else { $short_title = urlencode($title); } $title = urlencode($title); $sexy_content = urlencode(substr(strip_tags(strip_shortcodes(get_the_content())), 0, 300)); $sexy_content = str_replace('+', '%20', $sexy_content); $sexy_content = str_replace("’", "'", $sexy_content); $post_summary = stripslashes($sexy_content); $site_name = get_bloginfo('name'); $mail_subject = str_replace('+', '%20', $mail_subject); $mail_subject = str_replace("’", "'", $mail_subject); $y_cat = $sexy_plugopts['ybuzzcat']; $y_med = $sexy_plugopts['ybuzzmed']; $t_cat = $sexy_plugopts['twittcat']; // Fix for faulty insertion of TFLP function above if ($sexy_plugopts['shorty'] == "tflp" && function_exists('permalink_to_twitter_link')) { $fetch_url = permalink_to_twitter_link($perms); } else { $fetch_url = sexy_get_fetch_url(); } // Grab post tags for Twittley tags. If there aren't any, use default tags set in plugin options page // This doesn't seem to be working anymore, but not confirmed yet... $getkeywords = get_the_tags(); if ($getkeywords) { foreach ($getkeywords as $tag) { $keywords = $keywords . $tag->name . ','; } } if (!empty($getkeywords)) { $d_tags = substr($d_tags, 0, count($d_tags) - 2); } else { $d_tags = $sexy_plugopts['defaulttags']; } // Check permalink setup for proper feed link if (false !== strpos($feedperms, '?') || false !== strpos($feedperms, '.php', strlen($feedperms) - 4)) { $feedstructure = '&feed=comments-rss2'; } else { if ('/' == $feedperms[strlen($feedperms) - 1]) { $feedstructure = 'feed'; } else { $feedstructure = '/feed'; } } // Compatibility fix for NextGen Gallery Plugin... if (strpos($post_summary, '[') || strpos($post_summary, ']')) { $post_summary = ""; } if (strpos($sexy_content, '[') || strpos($sexy_content, ']')) { $sexy_content = ""; } // Select the background image if (!isset($sexy_plugopts['bgimg-yes'])) { $bgchosen = ''; } elseif ($sexy_plugopts['bgimg'] == 'sexy') { $bgchosen = ' sexy-bookmarks-bg-sexy'; } elseif ($sexy_plugopts['bgimg'] == 'caring') { $bgchosen = ' sexy-bookmarks-bg-caring'; } elseif ($sexy_plugopts['bgimg'] == 'care-old') { $bgchosen = ' sexy-bookmarks-bg-caring-old'; } elseif ($sexy_plugopts['bgimg'] == 'love') { $bgchosen = ' sexy-bookmarks-bg-love'; } elseif ($sexy_plugopts['bgimg'] == 'wealth') { $bgchosen = ' sexy-bookmarks-bg-wealth'; } elseif ($sexy_plugopts['bgimg'] == 'enjoy') { $bgchosen = ' sexy-bookmarks-bg-enjoy'; } elseif ($sexy_plugopts['bgimg'] == 'german') { $bgchosen = ' sexy-bookmarks-bg-german'; } // Do not add inline styles to the feed. $style = $sexy_plugopts['autocenter'] ? '' : ' style="' . __($sexy_plugopts['xtrastyle']) . '"'; if (is_feed()) { $style = ''; } $expand = $sexy_plugopts['expand'] ? ' sexy-bookmarks-expand' : ''; if ($sexy_plugopts['autocenter'] == 1) { $autocenter = ' sexy-bookmarks-center'; } elseif ($sexy_plugopts['autocenter'] == 2) { $autocenter = ' sexy-bookmarks-spaced'; } else { $autocenter = ''; } //Write the sexybookmarks menu $socials = "\n\n" . '<!-- Begin SexyBookmarks Menu Code -->' . "\n"; $socials .= '<div class="sexy-bookmarks' . $expand . $autocenter . $bgchosen . '"' . $style . '>' . "\n" . '<ul class="socials">' . "\n"; foreach ($sexy_plugopts['bookmark'] as $name) { if ($name == 'sexy-twitter') { $socials .= bookmark_list_item($name, array('post_by' => !empty($sexy_plugopts['twittid']) ? "(via+@" . $sexy_plugopts['twittid'] . ")" : '', 'short_title' => $short_title, 'fetch_url' => $fetch_url)); } elseif ($name == 'sexy-blogengage') { $socials .= bookmark_list_item($name, array('permalink' => $perms)); } elseif ($name == 'sexy-identica') { $socials .= bookmark_list_item($name, array('short_title' => $short_title, 'fetch_url' => $fetch_url)); } elseif ($name == 'sexy-mail') { $socials .= bookmark_list_item($name, array('title' => $mail_subject, 'post_summary' => $post_summary, 'permalink' => $perms)); } elseif ($name == 'sexy-tomuse') { $socials .= bookmark_list_item($name, array('title' => $mail_subject, 'post_summary' => $post_summary, 'permalink' => $perms)); } elseif ($name == 'sexy-diigo') { $socials .= bookmark_list_item($name, array('sexy_teaser' => $sexy_content, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-linkedin') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'site_name' => $site_name, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-devmarks') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-comfeed') { $socials .= bookmark_list_item($name, array('permalink' => urldecode($feedperms) . $feedstructure)); } elseif ($name == 'sexy-yahoobuzz') { $socials .= bookmark_list_item($name, array('permalink' => $perms, 'title' => $title, 'yahooteaser' => $sexy_content, 'yahoocategory' => $y_cat, 'yahoomediatype' => $y_med)); } elseif ($name == 'sexy-twittley') { $socials .= bookmark_list_item($name, array('permalink' => urlencode($perms), 'title' => $title, 'post_summary' => $post_summary, 'twitt_cat' => $t_cat, 'default_tags' => $d_tags)); } elseif ($name == 'sexy-designmoo') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-designbump') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-posterous') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-pingfm') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-nujij') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-ekudos') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-webblend') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-hyves') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-orkut') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'sexy-tumblr') { $socials .= bookmark_list_item($name, array('permalink' => urlencode($perms), 'title' => $title)); } else { $socials .= bookmark_list_item($name, array('permalink' => $perms, 'title' => $title)); } } $socials .= '</ul>' . "\n" . '<div style="clear:both;"></div>' . "\n" . '</div>'; $socials .= "\n" . '<!-- End SexyBookmarks Menu Code -->' . "\n\n"; return $socials; }