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
}
    <div class="left"><?php 
_e('Facebook', 'all_in_one');
?>
:</div>
    <div class="right"><?php 
echo $obj->get_fb();
?>
</div>
    <div class="clear"></div>

    <div class="left"><?php 
_e('LinkedIN', 'all_in_one');
?>
:</div>
    <div class="right"><?php 
echo $obj->get_linkedin();
?>
</div>
    <div class="clear"></div>

    <div class="left"><?php 
_e('Google Plus', 'all_in_one');
?>
:</div>
    <div class="right"><?php 
echo $obj->get_plusones();
?>
</div>
    <div class="clear"></div>

    <div class="left"><?php 
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;
}
示例#4
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;
}
示例#5
0
文件: sdileni.php 项目: rotten77/xcv
/**
 * Kontrola záznamu
 */
if (isset($_SESSION['csfr_token']) && $url != "" && $csfr_token != "" && $csfr_token == $_SESSION['csfr_token']) {
    // Má se zjistit aktuální stav?
    $zjistit = false;
    $id = sha1($url);
    $dbSdileni = $db->modul_sdileni(array("id" => $id))->fetch();
    if (isset($dbSdileni['id'])) {
        $sdileni = array("facebook" => $dbSdileni['pocet_facebook'], "twitter" => $dbSdileni['pocet_twitter'], "google-plus" => $dbSdileni['pocet_google'], "linkedin" => $dbSdileni['pocet_linkedin']);
        if (strtotime($dbSdileni['kontrola']) < strtotime("now - 20 minutes")) {
            $zjistit = true;
        }
    } else {
        $dbSdileni = $db->modul_sdileni->insert(array("id" => $id, "url" => $url));
        $zjistit = true;
    }
    if ($zjistit) {
        require dirname(__FILE__) . "/../app/lib/share-count.php";
        $obj = new shareCount($url);
        $sdileni = array("facebook" => $obj->get_fb(), "twitter" => $obj->get_tweets(), "google-plus" => $obj->get_plusones(), "linkedin" => $obj->get_linkedin());
        $dbSdileni->update(array("pocet_twitter" => $sdileni['twitter'], "pocet_facebook" => $sdileni['facebook'], "pocet_google" => $sdileni['google-plus'], "pocet_linkedin" => $sdileni['linkedin'], "kontrola" => new NotORM_Literal("NOW()")));
        // echo "<br>Delicous:" . $obj->get_delicious(); //to get delicious bookmarks  count
        // echo "<br>Pinterst:" . $obj->get_pinterest(); //to get pinterest pins
    }
} else {
    // $sdileni['stav'] = 'ERR';
}
// $sdileni['csfr'] = $csfr_token." - ".$_SESSION['csfr_token'];
echo json_encode($sdileni);
exit;