'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'); $addthis_styles = 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_init($username=null, $style=null) { global $addthis_settings; add_filter('the_content', 'addthis_social_widget'); add_filter('admin_menu', 'addthis_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_showonhome', 'true'); add_option('addthis_showonpages', 'false'); add_option('addthis_showoncats', 'false'); add_option('addthis_showonarchives', 'false'); add_option('addthis_style'); add_option('addthis_header_background'); add_option('addthis_header_color'); add_option('addthis_sidebar_only', 'false'); add_option('addthis_brand'); add_option('addthis_language', 'en'); $addthis_settings['sidebar_only'] = get_option('addthis_sidebar_only') === 'true'; $addthis_settings['isdropdown'] = get_option('addthis_isdropdown') === 'true'; $addthis_settings['showonhome'] = !(get_option('addthis_showonhome') !== 'true'); $addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true'; $addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true'; $addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true'; if (!isset($style)) $style = get_option('addthis_style'); if (strlen($style) == 0) $style = 'share'; $addthis_settings['style'] = $style; if (!isset($username)) $username = get_option('addthis_username'); $addthis_settings['username'] = $username; $language = get_option('addthis_language'); $addthis_settings['language'] = $language; $advopts = array('brand', 'language', 'header_background', 'header_color', 'options'); $addthis_settings['customization'] = ''; for ($i = 0; $i < count($advopts); $i++) { $opt = $advopts[$i]; $val = get_option("addthis_$opt"); if (isset($val) && strlen($val)) $addthis_settings['customization'] .= "var addthis_$opt = '$val';"; } add_action('widgets_init', 'addthis_widget_init'); } function addthis_widget_init() { if ( function_exists('register_sidebar_widget') ) register_sidebar_widget('AddThis Widget', 'addthis_sidebar_widget'); } function addthis_sidebar_widget($args) { extract($args); echo $before_widget; echo $before_title . $after_title . addthis_social_widget('', true); echo $after_widget; } /** * Appends AddThis button to post content. */ function addthis_social_widget($content, $sidebar = false) { global $addthis_settings; // add nothing to RSS feed or search results; control adding to static/archive/category pages if (!$sidebar) { if ($addthis_settings['sidebar_only'] == 'true') return $content; else if (is_feed()) return $content; else if (is_search()) return $content; else if (is_home() && !$addthis_settings['showonhome']) return $content; else if (is_page() && !$addthis_settings['showonpages']) return $content; else if (is_archive() && !$addthis_settings['showonarchives']) return $content; else if (is_category() && !$addthis_settings['showoncats']) return $content; } $pub = $addthis_settings['username']; $link = $sidebar ? '[URL]' : urlencode(get_permalink()); $title = $sidebar ? '[TITLE]' : urlencode(get_the_title($id)); $content .= "\n\n"; if ($addthis_settings['isdropdown']) { if (isset($pub) || strlen($addthis_settings['customization'])) { $content .= '\n"; } $content .= << EOF; $content .= addthis_get_button_img() . ''; } else { $content .= << EOF; $content .= addthis_get_button_img() . ''; } $content .= "\n"; return $content; } /** * Generates img tag for share/bookmark button. */ function addthis_get_button_img() { global $addthis_settings; global $addthis_styles; $btnStyle = $addthis_settings['style']; if ($addthis_settings['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($addthis_styles[$btnStyle])) $btnStyle = 'share'; $btnRecord = $addthis_styles[$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%',$addthis_settings['language'], $btnUrl); } $btnWidth = $btnRecord['w']; $btnHeight = $btnRecord['h']; return << EOF; } function addthis_admin_menu() { add_options_page('AddThis Plugin Options', 'AddThis', 8, __FILE__, 'addthis_plugin_options_php4'); } function addthis_plugin_options_php4() { global $addthis_styles; global $addthis_languages; global $addthis_settings; ?>

AddThis

Required

/>
/>



Advanced

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