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="clear"></div> <br /><br /><br /> <div class="title"><i class="fa fa-share-alt"></i> <?php _e('Social', 'all_in_one'); ?> </div> <div class="del"></div> <div class="left"><?php _e('Tweets', 'all_in_one'); ?> :</div> <div class="right"><?php echo $obj->get_tweets(); ?> </div> <div class="clear"></div> <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
<?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 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; }
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; }
/** * 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;