'Automatic','af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese'); $addthis_menu_types = array('static', 'dropdown', 'toolbox'); $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) ); $addthis_new_styles = array( 'small_toolbox' => array( 'src' => '
', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => '' ), // 32x32 'plus_one_share_counter' => array( 'src' => '
', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden'), // +1 'small_toolbox_with_share' => array( 'src' => '
Share|
', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden' ), // Plus sign share | four buttons 'large_toolbox' => array( 'src' => '
', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => '' ), // 32x32 'fb_tw_sc' => array( 'src' => '
' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => 'hidden', 'below' => 'hidden' ), // facebook tweet share counter 'fb_tw_p1_sc' => array( 'src' => '
' , 'img' => 'fb-tw-p1-sc.jpg' , 'name' => 'Like, Tweet, +1, Share', 'above' => '', 'below' => 'hidden' ), // facebook tweet share counter 'simple_button' => array('src' => '
Share
', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden' ), // Plus sign share 'button' => array( 'src' => '
Bookmark and Share
', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden' ), // classic 'share_counter' => array( 'src' => '
', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden' ), ); add_filter('the_title', 'at_title_check'); function at_title_check($title) { global $addthis_did_filters_added; if (!isset ($addthis_did_filters_added) || $addthis_did_filters_added != true) { addthis_add_content_filters(); add_filter('the_content', 'addthis_script_to_content'); } else { } return $title; } add_filter('language_attributes', 'addthis_language_attributes'); function addthis_language_attributes($input) { return $input . ' xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:addthis="http://www.addthis.com/help/api-spec" '; } function addthis_script_to_content($content) { global $addthis_did_script_output; if (!isset($addthis_did_script_output) ) { $addthis_did_script_output = true; $content .= addthis_output_script(true); } return $content ; } /** * Converts our old many options in to one beautiful array * */ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') ) { function addthis_options_200() { global $current_user; $user_id = $current_user->ID; $addthis_new_options = array(); if ($username = get_option('addthis_username')) $addthis_new_options['username'] = $username; if ($password = get_option('addthis_password')) $addthis_new_options['password'] = $password; if ($show_stats = get_option('addthis_show_stats')) $addthis_new_options['addthis_show_stats'] = $show_stats; if ($append_data = get_option('addthis_append_data')) $addthis_new_options['addthis_append_data'] = $append_data; if ($showonhome = get_option('addthis_showonhome')) $addthis_new_options['addthis_showonhome'] = $showonhome; if ($showonpages = get_option('addthis_showonpages')) $addthis_new_options['addthis_showonpages'] = $showonpages; if ($showoncats = get_option('addthis_showoncats')) $addthis_new_options['addthis_showoncats'] = $showoncats; if ($showonarchives = get_option('addthis_showonarchives')) $addthis_new_options['addthis_showonarchives'] = $showonarchives; if (get_option('addthis_showonposts') != true) $addthis_new_options['below'] = 'none'; elseif (get_option('addthis_sidebar_only') == true) $addthis_new_options['below'] = 'none'; else { if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' ) $addthis_new_options['below'] = 'small_toolbox_with_share'; else $addthis_new_options['below'] = 'button'; } if ($header_background = get_option('addthis_header_background')) $addthis_new_options['addthis_header_background'] = $header_background; if ($header_color = get_option('addthis_header_color')) $addthis_new_options['addthis_header_color'] = $header_color; if ($brand = get_option('addthis_brand')) $addthis_new_options['addthis_brand'] = $brand; if ($language = get_option('addthis_language')) $addthis_new_options['addthis_language'] = $language; // Above is new, set it to none $addthis_new_options['above'] = 'none'; // Save option add_option('addthis_settings', $addthis_new_options); // if the option saved, delete the old options delete_option('addthis_show_stats'); delete_option('addthis_password'); delete_option('addthis_fallback_username'); delete_option('addthis_options'); delete_option('addthis_product'); delete_option('addthis_isdropdown'); delete_option('addthis_menu_type'); delete_option('addthis_append_data'); delete_option('addthis_showonhome'); delete_option('addthis_showonposts'); delete_option('addthis_showonpages'); delete_option('addthis_showoncats'); delete_option('addthis_showonarchives'); delete_option('addthis_style'); delete_option('addthis_header_background'); delete_option('addthis_header_color'); delete_option('addthis_sidebar_only'); delete_option('addthis_brand'); delete_option('addthis_language');; global $current_user; $user_id = $current_user->ID; add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true); } function addthis_options_210() { $options = get_option('addthis_settings'); if ( isset( $options['username'] ) ) $options['profile'] = $options['username']; update_option( 'addthis_settings', $options); } } /** * Generates unique IDs */ function cuid() { $mt = dechex(mt_rand(0,min(0xffffffff,mt_getrandmax()))); $now = dechex(time()); $cuid = $now . str_pad($mt, 8, '0', STR_PAD_LEFT); return $cuid; } define('ADDTHIS_FALLBACK_USERNAME', 'wp-'.cuid() ); /** * Returns major.minor WordPress version. */ function addthis_get_wp_version() { return (float)substr(get_bloginfo('version'),0,3); } /** * For templates, we need a wrapper for printing out the code on demand. */ function addthis_print_widget($url=null, $title=null, $style = addthis_style_default ) { global $addthis_styles, $addthis_new_styles; $styles = array_merge($addthis_styles, $addthis_new_styles); if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') ) $preview = true; else $options = get_option('addthis_settings'); $identifier = addthis_get_identifier($url, $title); echo "\n\n"; if ( ! is_array($style) && isset($addthis_new_styles[$style]) ){ echo sprintf($addthis_new_styles[$style]['src'], $identifier); } elseif ($style == 'above') { if ( isset ($styles[$options['above']]['src'] )) echo sprintf($styles[$options['above']]['src'], $identifier); } elseif ($style == 'below') { if ( isset ($styles[$options['below']]['src'] )) echo sprintf($styles[$options['below']]['src'], $identifier); } elseif (is_array($style)) echo addthis_custom_toolbox($style, $url, $title); echo "\n\n"; } /* * Generates the addthis:url and addthis:title attributes */ function addthis_get_identifier($url = null, $title = null) { if (! is_null($url) ) $identifier = "addthis:url='$url' "; if (! is_null($title) ) $identifier .= "addthis:title='$title'"; if (! isset($identifier) ) $identifier = ''; return $identifier; } /** * Options is an array that contains * size - either 16 or 32. Defaults to 16 * services - comma sepperated list of services * preferred - number of Prefered services to be displayed after listed services * more - bool to show or not show the more icon at the end * * @param $options array */ function addthis_custom_toolbox($options, $url, $title) { $identifier = addthis_get_identifier($url, $title); $outerClasses = 'addthis_toolbox addthis_default_style'; if (isset($options['size']) && $options['size'] == '32') $outerClasses .= ' addthis_32x32_style'; $button = '
'; if (isset($options['services']) ) { $services = explode(',', $options['services']); foreach ($services as $service) { $service = trim($service); if ($service == 'more') $button .= ''; else $button .= ''; } } if (isset($options['preferred']) && is_numeric($options['preferred'])) { for ($a = 1; $a <= $options['preferred']; $a++) { $button .= ''; } } if (isset($options['more']) && $options['more'] == true) { $button .= ''; } $button .= '
'; return $button; } /** * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher. */ function addthis_print_style() { wp_enqueue_style( 'addthis' ); } /** * Adds AddThis script to page. Only used for admin dashboard in WP 2.7 and higher. */ function addthis_print_script() { wp_enqueue_script( 'addthis' ); } add_action('admin_notices', 'addthis_admin_notices'); function addthis_admin_notices(){ if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) ) return; global $current_user ; $user_id = $current_user->ID; $options = get_option('addthis_settings'); if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices')) { echo '

'; printf(__('Configure the AddThis plugin to enable users to share your content around the web.
Configuration options | Ignore this notice'), admin_url('options-general.php?page=' . basename(__FILE__) ), '?addthis_nag_ignore=0'); echo "

"; } elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore')) { echo '

'; printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.
Enter username and password  |  Sign Up  |  Ignore this notice'), admin_url('options-general.php?page=' . basename(__FILE__) ), 'https://www.addthis.com/register?profile=wpp', '?addthis_nag_username_ignore=0'); echo "

"; } elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) ) { echo '

'; printf( __('We have updated the options for the AddThis plugin. Check out the AddThis settings page to see the new styles and options.
See New Options  |  Ignore this notice'), admin_url('options-general.php?page=' . basename(__FILE__) ), '?addthis_nag_updated_ignore=0'); echo "

"; } } add_action('admin_init', 'addthis_nag_ignore'); function addthis_nag_ignore() { global $current_user; $user_id = $current_user->ID; $options = get_option('addthis_settings'); if (isset($_GET['addthis_nag_ignore']) && '0' == $_GET['addthis_nag_ignore']) add_user_meta($user_id, 'addthis_ignore_notices', 'true', true); if (isset($_GET['addthis_nag_username_ignore']) && '0' == $_GET['addthis_nag_username_ignore']) add_user_meta($user_id, 'addthis_nag_username_ignore', 'true', true); if (isset($_GET['addthis_nag_updated_ignore']) && '0' == $_GET['addthis_nag_updated_ignore']) delete_user_meta($user_id, 'addthis_nag_updated_options', 'true'); } function addthis_plugin_useragent($userAgent) { return $userAgent . 'ATV/' . ADDTHIS_PLUGIN_VERSION; } add_action('wp_ajax_at_show_dashboard_widget', 'addthis_render_dashboard_widget'); /** * Our admin dashboard widget shows yesterday's top shared content and top shared-to services. * Data is fetched via AJAX. We assume jQuery is available on any WP install supporting * dashboard widgets. * * @see js/addthis.js * @see js/addthis.css */ function addthis_render_dashboard_widget() { if (! current_user_can('manage_options')) { _e( 'Cheatin’ uh?' ); exit; } $_services = array( 'netvibes' => 'Netvibes', 'google' => 'Google Reader', 'yahoo' => 'Yahoo', 'rojo' => 'Rojo', 'aol' => 'AOL', 'newsgator-on' => 'Newsgator Online', 'pluck-on' => 'Pluck Online', 'bloglines' => 'Bloglines', 'feedlounge' => 'Feedlounge', 'newsburst' => 'Newsburst', 'msn' => 'MSN', 'winlive' => 'Windows Live', 'technorati' => 'Technorati', 'pageflakes' => 'Pageflakes', 'newsalloy' => 'News Alloy', 'feedreader' => 'FeedReader', 'mymsn' => 'My MSN', 'newsisfree' => 'Newsisfree', 'feeddemon' => 'FeedDemon', 'netnewswire' => 'NetNewWire', 'pluck' => 'Pluck', 'newsgator' => 'NewsGator', 'sharpreader' => 'SharpReader', 'awasu' => 'Awasu', 'myearthlink' => 'myEarthLink', 'rss' => 'Direct Feed Link', 'googlebuzz' => 'Google Buzz', 'youtube' => 'YouTube', 'facebook' => 'Facebook', 'flickr' => 'Flickr', 'twitter' => 'Twitter', 'linkedin' => 'LinkedIn' ); global $addthis_settings; $options = get_option('addthis_settings'); if (isset($options['username'])) $username = urlencode($options['username']); else { echo 'No Username entered'; return false; } if (isset($options['password'])) $password = urlencode($options['password']); else { echo 'No Passwrod entered'; return false; } $domain = get_home_url(); $domain = str_replace(array('http://', 'https://'), '', $domain); if (isset($options['profile'])) $profile = '&pubid='.urlencode($options['profile']); else $profile = ''; $requests = array( array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'), array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'), array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'month'), array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'day'), array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'week'), array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'), array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'), array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'), array('metric' => 'shares', 'dimension' => 'url' , 'domain' => $domain, 'period' => 'month'), array('metric' => 'clickbacks', 'dimension' => 'url', 'domain' => $domain, 'period' => 'month'), ); if (! $stats = get_transient('addthis_dashboard_stats') ) { add_filter('http_headers_useragent', 'addthis_plugin_useragent'); foreach ($requests as $request) { $dimension = $metric = $domain = $period = ''; extract($request); $dimension = ($dimension != '') ? '/'.$dimension : ''; $url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'. 'domain='.$domain.'&period='.$period. '&username='.$username. '&password='.$password. $profile; $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) ); if ( is_wp_error( $stats[$metric.$dimension.$period] ) ) { echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n"; if (defined(WP_DEBUG) && WP_DEBUG == TRUE) echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code(); exit; } else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 ) { echo "The Username / Password / Profile combination you presented is not valid.
"; echo "Please confirm that you have correctly entered your AddThis username, password and profile id."; exit; } else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500) { echo "Something has gone terribly wrong! This should never happen, but somehow did. We are working to correct it right now. We will get everything up again soon"; exit; } else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 ) { echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set "; exit; } else if ($stats[$metric.$dimension.$period]['response']['code'] != 201 ) { } } if ( $stats['sharesday']['response']['code'] == 200) set_transient('addthis_dashboard_stats', $stats, '600'); } if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' ) { $shareurls = json_decode($stats['shares/urlmonth']['body']); $clickbackurls = json_decode($stats['clickbacks/urlmonth']['body']); $yesterday['shares'] = json_decode($stats['sharesday']['body']); $yesterday['shares'] = $yesterday['shares'][0]->shares; $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']); $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks; $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a'; if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0; if (! $yesterday['shares'] ) $yesterday['shares'] = 0; $decodedLastWeek = json_decode($stats['sharesweek']['body']); $lastweek['shares'] = 0; foreach ($decodedLastWeek as $share) { $lastweek['shares'] += $share->shares; } $decodedLastWeek = json_decode($stats['clickbacksweek']['body']); $lastweek['clickbacks'] = 0; foreach ($decodedLastWeek as $clickback) { $lastweek['clickbacks'] += $clickback->clickbacks; } $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a'; $decodedLastMonth = json_decode($stats['sharesmonth']['body']); $lastmonth['shares'] = 0; foreach ($decodedLastMonth as $share) { $lastmonth['shares'] += $share->shares; } $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']); $lastmonth['clickbacks'] = 0; foreach ($decodedLastMonth as $clickback) { $lastmonth['clickbacks'] += $clickback->clickbacks; } $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a'; $services['shares'] = json_decode($stats['shares/servicemonth']['body']); $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']); foreach (array('shares', 'clickbacks') as $type) { $topServiceShare = array_shift($services[$type]); $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service; $firstAmount = $topServiceShare->{$type}; $topServiceShare = array_shift($services[$type]); $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service; $secondAmount = $topServiceShare->{$type}; $thirdLabel = 'Others'; $thirdAmount = 0; foreach($services[$type] as $service ) { $thirdAmount += $service->{$type}; } $servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&'. 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'. 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount; } echo "
"; echo "
 
"; $tab = 0; foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod ) { $stats = $$timePeriod; $tab++; $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral']; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '

'. $stats['shares'].'

Shares

'. $stats['clickbacks'].'

Clicks

'. $viral .'

Viral Lift
'; echo '
'; } echo "
"; echo "
"; echo "
"; echo "
"; echo "
Most Shared URLs (last month)
"; echo ""; echo "
Top Services for shares(last month)
"; echo "share stats for the last month"; echo "
"; echo '
'; echo '
Most Clicked URLs (last month)
'; echo ""; echo "
Top Services for clicks(last month)
"; echo "share stats for the last month"; echo "
"; echo '
 
'; echo '

View More Analytics

'; } elseif($stats['sharesday']['response']['code'] == 200){ echo <<We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,

If you want some ideas for increasing your sharing, check out: