__CLASS__, 'description' => __('Display a user defined social button, with translated URL.','comicpress') ); $this->WP_Widget(__CLASS__, __('ComicPress Social','comicpress'), $widget_ops); } } function widget($args, $instance) { global $post; extract($args, EXTR_SKIP); /* Get the info necessary */ $permalink = get_permalink($post->ID); $posttitle = $post->post_title; $posttitle = str_replace(' ', '%20', $posttitle); $title = $instance['title']; if (empty($title)) $title = $posttitle; $rss = get_bloginfo('rss2_url'); $blogname = urlencode(get_bloginfo('name')." ".get_bloginfo('description')); // 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); echo $before_widget; $url = $instance['urlstr']; $url = str_replace('[URL]', $permalink, $url); $url = str_replace('[TITLE]', $posttitle, $url); $url = str_replace('[RSS]', $rss, $url); $url = str_replace('[BLOGNAME]', $blogname, $url); $url = str_replace('[EXCERPT]', $excerpt, $url); ?>
<?php echo $title; ?>
'Share This!', 'urlstr' => '', 'image' => '') ); $title = strip_tags($instance['title']); if (empty($title)) $title = 'Share This!'; $urlstr = strip_tags($instance['urlstr']); $image = strip_tags($instance['image']); ?> Translated Strings: [URL] [TITLE] [RSS] [BLOGNAME] [EXCERPT]
Examples:
http://twitter.com/home?status=[TITLE]%20-%20[URL]
http://www.stumbleupon.com/submit?url=[URL]&title=[TITLE]