function social_count($ads)
{
    require_once "shareCount.php";
    $obj = new shareCount(get_site_url());
    //website url
    echo '<h2>SOCIAL STATS</h2>';
    echo '<b><img src="' . plugins_url('/images/twitter.png', __FILE__) . '">Twitter:</b> ' . floatNumber($obj->get_tweets());
    //to get tweets
    echo '<br/><img src="' . plugins_url('/images/facebook.png', __FILE__) . '"><b>Facebook:</b> ' . floatNumber($obj->get_fb());
    //to get facebook total count (likes+shares+comments)
    echo '<br/><img src="' . plugins_url('/images/linkedin.png', __FILE__) . '"><b>Linkedin:</b> ' . floatNumber($obj->get_linkedin());
    //to get linkedin shares
    echo '<br/><img src="' . plugins_url('/images/google.png', __FILE__) . '"><b>Google Plus:</b> ' . floatNumber($obj->get_plusones());
    //to get google plusones
    echo '<br/><img src="' . plugins_url('/images/delicious.png', __FILE__) . '"><b>Delicious:</b> ' . floatNumber($obj->get_delicious());
    //to get delicious bookmarks  count
    echo '<br/><img src="' . plugins_url('/images/stumbleupon.png', __FILE__) . '"><b>Stumbleupon:</b> ' . floatNumber($obj->get_stumble());
    //to get Stumbleupon views
    echo '<br/><img src="' . plugins_url('/images/pinterest.png', __FILE__) . '"><b>Pinterest:</b> ' . floatNumber($obj->get_pinterest());
    //to get pinterest pins
}
示例#2
0
function get_share_count($post_id = "")
{
    if (empty($post_id)) {
        $post_id = get_queried_object_id();
    }
    if (!is_singular('post')) {
        $shareCount = get_post_meta($post_id, 'total_shares', true);
        return $shareCount;
    }
    $new_shares = 0;
    $real_shares_count = 0;
    if (function_exists('curl_version')) {
        $version = curl_version();
        $bitfields = array('CURL_VERSION_IPV6', 'CURLOPT_IPRESOLVE');
        foreach ($bitfields as $feature) {
            if ($version['features'] & constant($feature)) {
                $real_shares = new shareCount(get_permalink($post_id));
                $real_shares_count += $real_shares->get_tweets();
                $real_shares_count += $real_shares->get_fb();
                $real_shares_count += $real_shares->get_linkedin();
                $real_shares_count += $real_shares->get_plusones();
                $real_shares_count += $real_shares->get_pinterest();
                break;
            }
        }
    }
    $total_shares = $new_shares + $real_shares_count;
    update_post_meta($post_id, 'total_shares', $total_shares);
    return $total_shares;
}
示例#3
0
<?php

extract(shortcode_atts(array('class' => '', 'id' => '', 'css_animation' => '', 'css_animation_delay' => '', 'facebook' => '', 'twitter' => '', 'googleplus' => '', 'pinterest' => ''), $atts));
$animated = $css_animation ? 'animate' : '';
$css_animation_delay = $css_animation ? ' data-delay="' . $css_animation_delay . '"' : '';
$class = setClass(array('md-social-share', $animated, $css_animation, $class));
$id = setId($id);
$share_count = new shareCount("http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
$output .= '<div' . $class . $id . $css_animation_delay . '>';
if ($facebook == 'yes') {
    $output .= '<div class="item share-facebook"><a href="#" class="md-social-share-facebook"><i class="icon-facebook"></i><span class="social">Facebook</span></a><span class="count">' . $share_count->get_fb() . '</span></div>';
}
if ($twitter == 'yes') {
    $output .= '<div class="item share-twitter"><a href="#" class="md-social-share-twitter"><i class="icon-twitter"></i><span class="social">Twitter</span></a><span class="count">' . $share_count->get_tweets() . '</span></div>';
}
if ($googleplus == 'yes') {
    $output .= '<div class="item share-google"><a href="#" class="md-social-share-google"><i class="icon-google-plus"></i><span class="social">Google+</span></a><span class="count">' . $share_count->get_plusones() . '</span></div>';
}
if ($pinterest == 'yes') {
    $output .= '<div class="item share-pinterest"><a href="#" class="md-social-share-pinterest"><i class="icon-pinterest"></i><span class="social">Pinterest</span></a><span class="count">' . $share_count->get_pinterest() . '</span></div>';
}
$output .= '</div>';
$output .= '<div class="clearfix"></div>';
echo $output;
function sss_kk_calculate()
{
    $new_shares = 0;
    $real_shares_count = 0;
    if (function_exists('curl_version')) {
        $version = curl_version();
        $bitfields = array('CURL_VERSION_IPV6', 'CURLOPT_IPRESOLVE');
        foreach ($bitfields as $feature) {
            if ($version['features'] & constant($feature)) {
                $real_shares = new shareCount(get_permalink());
                $real_shares_count += $real_shares->get_tweets();
                $real_shares_count += $real_shares->get_fb();
                $real_shares_count += $real_shares->get_linkedin();
                $real_shares_count += $real_shares->get_plusones();
                $real_shares_count += $real_shares->get_pinterest();
                break;
            }
        }
    }
    $total_shares = $new_shares + $real_shares_count;
    return $total_shares;
}