'Chinese', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fi'=>'Finnish', 'fr'=>'French', 'de'=>'German', 'he'=>'Hebrew', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ru'=>'Russian', 'es'=>'Spanish', 'sv'=>'Swedish'); public static $btnStyles = array( 'share' => array('img'=>'lg-share-%lang%.gif', 'w'=>125, 'h'=>16), 'bookmark' => array('img'=>'lg-bookmark-en.gif', 'w'=>125, 'h'=>16), 'addthis' => array('img'=>'lg-addthis-en.gif', 'w'=>125, 'h'=>16), 'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16), 'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16), 'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16) /* Add your own style here, like this: , 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */ ); /** * Adds WP filter so we can append the AddThis button to post content. */ function addthis_social_widget($username=null, $style=null) { add_filter('the_content', array(&$this, 'social_widget')); add_filter('admin_menu', array(&$this, 'admin_menu')); add_option('addthis_username'); add_option('addthis_options', 'email, favorites, digg, delicious, myspace, google, facebook, reddit, live, more'); add_option('addthis_isdropdown', true); add_option('addthis_showonpages', false); add_option('addthis_showonarchives', false); add_option('addthis_showoncats', false); add_option('addthis_style'); add_option('addthis_header_background'); add_option('addthis_header_color'); add_option('addthis_brand'); add_option('addthis_language', 'en'); $this->addthis_isdropdown = get_option('addthis_isdropdown') === 'true'; if (!isset($style)) $style = get_option('addthis_style'); if (strlen($style) == 0) $style = 'share'; $this->addthis_style = $style; if (!isset($username)) $username = get_option('addthis_username'); $this->addthis_username = $username; $this->addthis_showonpages = get_option('addthis_showonpages') === 'true'; $this->addthis_showonarchives = get_option('addthis_showonarchives') === 'true'; $this->addthis_showoncats = get_option('addthis_showoncats') === 'true'; $language = get_option('addthis_language'); $this->addthis_language = $language; $advopts = array('brand', 'language', 'header_background', 'header_color', 'options'); $this->customization = ''; for ($i = 0; $i < count($advopts); $i++) { $opt = $advopts[$i]; $val = get_option("addthis_$opt"); if (isset($val) && strlen($val)) $this->customization .= "var addthis_$opt = '$val';"; } } /** * Appends AddThis button to post content. */ public function social_widget($content) { // add nothing to RSS feeds; control adding to static/archive/category pages if (is_feed()) return $content; else if (is_page() && !$this->addthis_showonpages) return $content; else if (is_archive() && !$this->addthis_showonarchives) return $content; else if (is_category() && !$this->addthis_showoncats) return $content; $pub = $this->addthis_username; $link = urlencode(get_permalink()); $title = urlencode(get_the_title($id)); $content .= "\n\n"; if ($this->addthis_isdropdown) { if (isset($pub) || strlen($this->customization)) { $content .= '\n"; } $content .= <<{$this->get_button_img()} EOF; } else { $content .= <<{$this->get_button_img()} EOF; } $content .= "\n"; return $content; } /** * Generates img tag for share/bookmark button. */ private function get_button_img() { $btnStyle = $this->addthis_style; if ($this->addthis_language != 'en') { // We use a translation of the word 'share' for all verbal buttons switch ($btnStyle) { case 'bookmark': case 'addthis': case 'bookmark-sm': $btnStyle = 'share'; } } if (!isset(self::$btnStyles[$btnStyle])) $btnStyle = 'share'; $btnRecord = self::$btnStyles[$btnStyle]; $btnUrl = (strpos(trim($btnRecord['img']), 'http://') !== 0 ? "http://s7.addthis.com/static/btn/" : "") . $btnRecord['img']; if (strpos($btnUrl, '%lang%') !== false) { $btnUrl = str_replace('%lang%',$this->addthis_language, $btnUrl); } $btnWidth = $btnRecord['w']; $btnHeight = $btnRecord['h']; return << EOF; } public function admin_menu() { add_options_page('AddThis Plugin Options', 'AddThis', 8, __FILE__, 'addthis_plugin_options'); } } function addthis_plugin_options() { ?>

AddThis

Required

/>



Advanced

See our customization docs.
pages:", 'addthis_trans_domain' ); ?> />
/>
/>