Denis & Liu Yang Version: 2.0 Author: Denis & LiuYang Author URI: http://17fav.com/ */ //=== Please DO NOT edit following lines unless you know actually what you do :P === define('BS_ALREADY_JQUERY',0); //if your template or plugin has been loaded jQuery without using wp_enquenue_script, change the value to 1 define('BS_ALREADY_JQUERY_DIMENSIONS',0); //if your template or plugin has been loaded jQuery-Dimensions plugin without using wp_enquenue_script, or with a name differ from jquery-dimensions change the value to 1 //===END JQUERY=== class WPBS { var $uid; var $popwin; var $insert2; var $insert2feed; var $insert2home; var $bs_server_url = 'http://17fav.com/'; var $imgbtn; var $iconbtn; var $postids; function WPBS() { $this->uid = get_option('bs_uid'); if ($this->uid === false) { // uid did not exists, we create it. $this->uid = $this->_generate_uid(); update_option('bs_uid',$this->uid); } if (false === get_option('bs_popwin')) { $this->popwin = false; } else { $this->popwin = get_option('bs_popwin'); } //initialize the button image $this->imgbtn = get_bloginfo('siteurl'). "/" .PLUGINDIR . "/" . dirname(plugin_basename (__FILE__))."/bookmark.gif"; $this->iconbtn = get_bloginfo('siteurl'). "/" .PLUGINDIR . "/" . dirname(plugin_basename (__FILE__))."/icons.gif"; //load jquery & dimensions plugin $this->_load_jquery_lib(); //initialize post ids $this->postids = array(); //actions add_action('wp_head',array(&$this,'bs_header')); add_action('wp_footer',array(&$this,'bs_footer')); add_action('admin_menu',array(&$this,'admin_page')); //auto add to single? if (false === get_option('bs_insert2')) { $this->insert2 = true; update_option('bs_insert2',$this->insert2); } else { $this->insert2 = get_option('bs_insert2'); } if (false === get_option('bs_insert2home')) { $this->insert2home = false; update_option('bs_insert2home',$this->insert2home); } else { $this->insert2home = get_option('bs_insert2home'); } if (false === get_option('bs_insert2feed')) { $this->insert2feed = true; update_option('bs_insert2feed',$this->insert2feed); } else { $this->insert2feed = get_option('bs_insert2feed'); } add_filter('the_content',array(&$this,'bs_add_content')); } function bs_string($feed_mode = false) { global $post; $fitems = array(); $fitems['blog_hash'] = $this->uid; $fitems['url'] = get_permalink($post->ID); $fitems['title'] = get_the_title($post->ID); if (has_excerpt($post->ID)) { $fitems['description'] = get_the_excerpt(); } else { $fitems['description'] = $this->_utrim(strip_tags($post->post_content),100); } $fitems['tags'] = ''; $tags = get_the_tags($post->ID); if (!is_wp_error($tags) && is_array($tags) && count($tags)) { $tagline = ''; foreach($tags as $tag) { if (strlen($tagline)) $tagline .= ","; $tagline .= $tag->name; } $fitems['tags'] = $tagline; } if (!$feed_mode) { $fitems['server'] = ''; $js = '
"; $this->postids[] = $post->ID; $feed_str = ''; } else { $feed_str = ''; foreach ($fitems as $k=>$v) { $feed_str .= "$k=".urlencode($v)."&"; } $feed_str = "?$feed_str"; $feed_str = substr($feed_str,0,-1); } $btn = '