function sociable_html($display = array(), $location = "") { global $sociable_options, $wp_query, $post; if (!empty($sociable_options["pixel"])) { send_config_sociable(); } $sociable_known_sites = get_option('sociable_known_sites'); if (!$post) { $post = get_post($post_id = 1); } if (get_post_meta($post->ID, '_sociableoff', true)) { return ""; } $active_sites = $sociable_options['active_sites']; // Get The Image Path //$imagepath = _get_sociable_image_path(); // if no sites are specified, display all active // have to check $active_sites has content because WP // won't save an empty array as an option if (empty($display) && isset($active_sites)) { $display = $active_sites; } // if no sites are active, display nothing if (empty($display)) { return ""; } // Load the post's and blog's data $blogname = urlencode(get_bloginfo('name') . " " . get_bloginfo('description')); $blogrss = get_bloginfo('rss2_url'); // Grab the excerpt, if there is no excerpt, create one $excerpt = urlencode(strip_tags(strip_shortcodes($post->post_excerpt))); if ($excerpt == "") { $excerpt = urlencode(substr(strip_tags(strip_shortcodes($post->post_content)), 0, 250)); } // Clean the excerpt for use with links $excerpt = str_replace('+', '%20', $excerpt); $permalink = urlencode(get_permalink($post->ID)); $permalinkCOUNT = get_permalink($post->ID); $title = str_replace('+', '%20', urlencode($post->post_title)); $titleCOUNT = $post->post_title; $rss = urlencode(get_bloginfo('ref_url')); // Start preparing the output $args = array('post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post->ID); $image = ""; if ($attachments) { foreach ($attachments as $attachment) { //echo apply_filters('the_title', $attachment->post_title); $image = wp_get_attachment_url($attachment->ID, true); } } $html = '<!-- Start Sociable --><div class="sociable">'; // If a tagline is set, display it above the links list $tagline = isset($sociable_options['tagline']) ? $sociable_options['tagline'] : ''; if ($tagline != '') { $html .= '<div class="sociable_tagline">'; if (isset($sociable_options['help_grow'])) { if (!empty($sociable_options['help_grow'])) { $addSize = ""; if ($sociable_options['icon_size'] == 16) { $addSize = "font-size:11px;"; } $html .= "<a class='sociable_tagline' target='_blank' href='http://blogplay.com' style='" . $addSize . "color:#333333;text-decoration:none'>" . $tagline . "</a>"; } else { $html .= $tagline; } } else { $html .= $tagline; } $html .= "</div>"; } /** * Start the list of links */ $html .= "<ul class='clearfix'>"; $i = 0; $totalsites = count($display); $margin = "0px"; switch ($sociable_options['icon_size']) { case "16": $margin = "padding-top: 0;margin-top:-2px"; break; case "32": $margin = "margin-top:9px"; break; case "48": $margin = "margin-top:24px"; break; case "64": $margin = "margin-top:38px"; break; } // print_r($display); if (isset($display["More"])) { unset($display["More"]); array_push($display, "More"); $display["More"] = "On"; } //print_r($display); foreach ($display as $sitename => $val) { if (!array_key_exists($sitename, $active_sites) || isset($sociable_known_sites[$sitename]["counter"])) { continue; } $site = $sociable_known_sites[$sitename]; $url = isset($site['script']) ? $site['script'] : $site['url']; if ($sitename == 'Twitter Counter' || $sitename == 'Twitter') { if (isset($sociable_options["linksoptions"])) { if (!empty($sociable_options["linksoptions"])) { $url = str_replace('SHARETAG', '*blogplay.com*', $url); } else { $url = str_replace('SHARETAG', '', $url); } } else { $url = str_replace('SHARETAG', '', $url); } } $url = str_replace('TITLECOUNT', $titleCOUNT, $url); $url = str_replace('TITLE', $title, $url); $url = str_replace('SOURCE', $image, $url); $url = str_replace('RSS', $rss, $url); $url = str_replace('BLOGNAME', $blogname, $url); $url = str_replace('EXCERPT', $excerpt, $url); $url = str_replace('FEEDLINK', $blogrss, $url); $url = str_replace('PERMALINKCOUNT', $permalinkCOUNT, $url); $url = str_replace('PERMALINK', $permalink, $url); if (isset($site['description']) && $site['description'] != "") { $description = $site['description']; } else { $description = $sitename; } $link = '<li>'; if (!empty($sociable_options["custom_icons"])) { $linkitem = !isset($sociable_options['use_images']) ? $description : _get_sociable_image($site, $description); } else { if ($description != "More") { $linkitem = !isset($sociable_options['use_images']) ? $description : _get_sociable_image($site, $description); } else { $linkitem = !isset($sociable_options['use_images']) ? $description : "<img style='" . $margin . "' src='" . SOCIABLE_HTTP_PATH . "images/more.png'>"; } if ($description == "vuible") { $linkitem = !isset($sociable_options['use_images']) ? $description : "<img style='' src='" . SOCIABLE_HTTP_PATH . "images/" . $sociable_options['icon_option'] . "/" . $sociable_options['icon_size'] . "/vuible.png'>"; } } $posX = $site["spriteCoordinates"][$sociable_options['icon_size']]["0"]; $posY = $site["spriteCoordinates"][$sociable_options['icon_size']]["1"]; $backgroundFile = $sociable_options['icon_option'] . "_" . $sociable_options['icon_size'] . ".png"; $style = "background-position:" . $posX . " " . $posY; $href = $url; $target = isset($sociable_options['new_window']) ? 'target="_blank"' : ''; if ($sitename == "Add to favorites" || $sitename == "More" || $sitename == "vuible") { if ($sitename == "More" || $sitename == "vuible") { if ($sitename == "More") { $link .= '<a style="cursor:pointer" rel="nofollow" onMouseOut="fixOnMouseOut(document.getElementById(\'sociable-post' . $location . '-' . $post->ID . '\'), event, \'post' . $location . '-' . $post->ID . '\')" onMouseOver="more(this,\'post' . $location . '-' . $post->ID . '\')">' . $linkitem . '</a></li>'; } else { $link .= "<a onClick=\"javascript:var ipinsite='Good%20Vibes.%20Vuible.com',ipinsiteurl='http://vuible.com/';(function(){if(window.ipinit!==undefined){ipinit();}else{document.body.appendChild(document.createElement('script')).src='http://vuible.com/wp-content/themes/ipinpro/js/ipinit.js';}})();\" style=\"cursor:pointer\" rel=\"nofollow\" title=\"Vuible.com | Share positive messages (images and videos only)\">" . $linkitem . "</a></li>"; } } else { $link .= '<a class="' . $sociable_options['icon_option'] . '_' . $sociable_options['icon_size'] . '" style="cursor:pointer;' . $style . '" rel="nofollow" title="' . $sitename . ' - doesn\'t work in Chrome" onClick="' . $href . '">' . "" . '</a></li>'; } } else { if ($sociable_options["icon_option"] == "option6" || !empty($sociable_options["custom_icons"])) { $link .= '<a title="' . $sitename . '" style="' . $description . $sociable_options['icon_size'] . '_' . str_replace("option", "", $sociable_options['icon_option']) . '" rel="nofollow" ' . $target . ' href="' . $href . '">' . $linkitem . '</a></li>'; } else { if (count(explode("Counter", $sitename)) > 1) { $link .= $href; } else { $link .= '<a title="' . $sitename . '" class="' . $sociable_options['icon_option'] . '_' . $sociable_options['icon_size'] . '" style="' . $style . '" rel="nofollow" ' . $target . ' href="' . $href . '">' . "" . '</a></li>'; } } } $html .= apply_filters('sociable_link', $link); $i++; } //return $html; //if ($sociable_options['icon_option'] !="option6"){ $inner = "<ul>"; foreach ($sociable_known_sites as $sitename => $val) { if (array_key_exists($sitename, $display) || isset($sociable_known_sites[$sitename]["counter"])) { continue; } $site = $sociable_known_sites[$sitename]; $url = isset($site['script']) ? $site['script'] : $site['url']; $url = str_replace('TITLECOUNT', $titleCOUNT, $url); $url = str_replace('SOURCE', $image, $url); $url = str_replace('TITLE', $title, $url); $url = str_replace('RSS', $rss, $url); $url = str_replace('BLOGNAME', $blogname, $url); $url = str_replace('EXCERPT', $excerpt, $url); $url = str_replace('FEEDLINK', $blogrss, $url); $url = str_replace('PERMALINKCOUNT', $permalinkCOUNT, $url); $url = str_replace('PERMALINK', $permalink, $url); $link = '<li style="heigth:' . $sociable_options['icon_size'] . 'px;width:' . $sociable_options['icon_size'] . 'px">'; if (!empty($sociable_options["custom_icons"])) { $linkitem = !isset($sociable_options['use_images']) ? $description : _get_sociable_image($site, $description); } else { if (isset($description) && $description != "More") { $linkitem = !isset($sociable_options['use_images']) ? $description : _get_sociable_image($site, $description); } else { $linkitem = !isset($sociable_options['use_images']) ? $description : "<img style='" . $margin . "' src='" . SOCIABLE_HTTP_PATH . "images/more.png'>"; } if ($sitename == "vuible") { $linkitem = !isset($sociable_options['use_images']) ? $description : "<a title='Vuible.com | Share positive messages (images and videos only)'> <img style='' src='" . SOCIABLE_HTTP_PATH . "images/" . $sociable_options['icon_option'] . "/" . $sociable_options['icon_size'] . "/vuible.png'></a>"; } } $posX = $site["spriteCoordinates"][$sociable_options['icon_size']]["0"]; $posY = $site["spriteCoordinates"][$sociable_options['icon_size']]["1"]; $backgroundFile = $sociable_options['icon_option'] . "_" . $sociable_options['icon_size'] . ".png"; $style = "background-position:" . $posX . " " . $posY; $href = $url; $target = isset($sociable_options['new_window']) ? 'target="_blank"' : ''; if ($sitename == "Add to favorites" || $sitename == "More" || $sitename == "vuible") { if ($sitename == "More" || $sitename == "vuible") { if ($sitename == "More") { $link .= '<a style="cursor:poainter" rel="nofollow" onMouseOver="more(this,\'post' . $location . '-' . $post->ID . '\')">' . $linkitem . '</a></li>'; } else { $link .= "<a onClick=\"javascript:var%20ipinsite='Good%20Vibes.%20Vuible.com',ipinsiteurl='http://vuible.com/';(function(){if(window.ipinit!==undefined){ipinit();}else{document.body.appendChild(document.createElement('script')).src='http://vuible.com/wp-content/themes/ipinpro/js/ipinit.js';}})();\" style=\"cursor:pointer\" rel=\"nofollow\" title=\"Vuible.com | Share positive messages (images and videos only)\">" . $linkitem . "</a></li>"; } } else { $link .= '<a class="' . $sociable_options['icon_option'] . '_' . $sociable_options['icon_size'] . '" style="cursor:pointer;' . $style . '" rel="nofollow" title="' . $sitename . ' - doesn\'t work in Chrome" onClick="' . $href . '">' . "" . '</a></li>'; } } else { if ($sociable_options["icon_option"] == "option6" || !empty($sociable_options["custom_icons"])) { $link .= '<a title="' . $sitename . '" style="' . $description . $sociable_options['icon_size'] . '_' . str_replace("option", "", $sociable_options['icon_option']) . '" rel="nofollow" ' . $target . ' href="' . $href . '">' . $linkitem . '</a></li>'; } else { $link .= '<a title="' . $sitename . '" class="' . $sociable_options['icon_option'] . '_' . $sociable_options['icon_size'] . '" style="' . $style . '" rel="nofollow" ' . $target . ' href="' . $href . '">' . "" . '</a></li>'; } } $inner .= apply_filters('sociable_link', $link); $i++; } $inner .= "</ul>"; $html .= '</ul><div onMouseout="fixOnMouseOut(this,event,\'post' . $location . '-' . $post->ID . '\')" id="sociable-post' . $location . '-' . $post->ID . '" style="display:none;"> <div style="top: auto; left: auto; display: block;" id="sociable"> <div class="popup"> <div class="content"> ' . $inner . ' </div> <a style="cursor:pointer" onclick="hide_sociable(\'post' . $location . '-' . $post->ID . '\',true)" class="close"> <img onclick="hide_sociable(\'post' . $location . '-' . $post->ID . '\',true)" title="close" src="' . SOCIABLE_HTTP_PATH . 'images/closelabel.png"> </a> </div> </div> </div>HereGoCounters</div><!-- End Sociable -->'; //$margin = //$html .= "<li class='sociablelast' style='".$margin."'><img src='".SOCIABLE_HTTP_PATH."images/more.jpg'></li></ul><div class='soc_clear'></div></div>"; //} //return ""; $counters = ""; /*if ($location == "bottom" && (is_single() || is_admin())){ */ $counters = "</div><div class='sociable' style='float:none'><ul class='clearfix'>"; foreach ($display as $sitename => $val) { //echo $sitename."<br>"; if (!array_key_exists($sitename, $display) || !isset($sociable_known_sites[$sitename]["counter"])) { continue; } //echo $sitename."<br>"; $link = '<li id="' . str_replace("+", "p", str_replace(" ", "_", $sitename)) . '">'; $site = $sociable_known_sites[$sitename]; $url = isset($site['script']) ? $site['script'] : $site['url']; $url = str_replace('TITLECOUNT', $titleCOUNT, $url); $url = str_replace('TITLE', $title, $url); $url = str_replace('RSS', $rss, $url); $url = str_replace('BLOGNAME', $blogname, $url); $url = str_replace('EXCERPT', $excerpt, $url); $url = str_replace('FEEDLINK', $blogrss, $url); $url = str_replace('PERMALINKCOUNT', $permalinkCOUNT, $url); $url = str_replace('PERMALINK', $permalink, $url); if ($sitename == "vuible Counter") { $url = !isset($sociable_options['use_images']) ? $description : "<a title='Vuible.com | Share positive messages (images and videos only)'><img onClick='ipinit();' style='cursor:pointer' src='" . SOCIABLE_HTTP_PATH . "images/vuible.png'></a>"; } $link .= $url . "</li>"; $counters .= apply_filters('sociable_link', $link); } $counters .= "</ul>"; $html = str_replace("HereGoCounters", $counters, $html); /*}else{ $html = str_replace("HereGoCounters",$counters,$html); }*/ return $html; }
function do_site_selection_list($plugin = 'sociable') { if ($plugin == 'sociable') { global $sociable_options; $option_plugin = $sociable_options; $name_plugin = "sociable_options"; } else { global $skyscraper_options; $option_plugin = $skyscraper_options; $name_plugin = "skyscraper_options"; } $sociable_known_sites = get_option('sociable_known_sites'); /* * Sort The List Based On The Active Sites So That They Display Correctly. */ $active_sites = isset($option_plugin['active_sites']) && is_array($option_plugin['active_sites']) ? $option_plugin['active_sites'] : array(); //Start Blank $active = array(); //Disabled Untill Proven Active $disabled = $sociable_known_sites; //Loop Through The Active Sites, sorting into 2 arrays foreach ($active_sites as $sitename => $value) { $active[$sitename] = $disabled[$sitename]; unset($disabled[$sitename]); } uksort($disabled, "strnatcasecmp"); $sites = array_merge($active, $disabled); $imagepath = isset($option_plugin['sociable_imagedir']) ? $option_plugin['sociable_imagedir'] : ''; if ($imagepath == "") { $imagepath = trailingslashit(SOCIABLE_HTTP_PATH) . 'images/'; } else { $imagepath .= trailingslashit($imagepath); } $out = '<ul id="sociable_site_list" >'; $io = 0; foreach ($sites as $sitename => $site) { //Set Checked And Active If Relevant if (array_key_exists($sitename, $active_sites)) { $checked = 'checked="checked"'; $active = 'active'; } else { $checked = ''; $active = 'inactive'; } if ($sitename != "More") { if (isset($site["counter"])) { //$image = "<img src='".SOCIABLE_HTTP_PATH."images/".$site["favicon"]."'>"; $image = $site["url"]; } else { $image = _get_sociable_image($site, ''); } } else { $image = "<img src='" . SOCIABLE_HTTP_PATH . "images/more.png'>"; } // if ( ! isset( $site['spriteCoordinates']) || isset( $sociable_options['sociable_disablesprite'] ) ) { // if (strpos($site['favicon'], 'http') === 0) { // $imgsrc = $site['favicon']; // } else { // $imgsrc = $imagepath.$site['favicon']; // } // $img = '<img src="' . $imgsrc . '" width="16" height="16" />'; // } else { // $imgsrc = $imagepath."services-sprite.gif"; // $services_sprite_url = $imagepath . "services-sprite.png"; // $spriteCoords = $site['spriteCoordinates']; // $img = '<img src="' . $imgsrc . '" width="16" height="16" style="background: transparent url(' . $services_sprite_url . ') no-repeat; background-position:-' . $spriteCoords[0] . 'px -' . $spriteCoords[1] . 'px" />'; // } $out .= '<li id="' . $sitename . '" class="' . $active . '">'; $out .= '<input type="checkbox" id="cb_' . $sitename . '" name="' . $name_plugin . '[active_sites][' . $sitename . ']" ' . $checked . ' />'; $out .= $image; if (!isset($site["counter"])) { $out .= $sitename; } $out .= '</li>'; } echo $out . "</ul>"; }