$https_url = preg_replace("/^http:/i", "https:", SHARED_URL); } if (FLAG_HTTP && FLAG_HTTPS || !FLAG_HTTP && !FLAG_HTTPS) { $fb_shares = get_fb_shares_count($http_url) + get_fb_shares_count($https_url); $tweets = get_tweet_count($http_url) + get_tweet_count($https_url); $plusones = get_plusone_count($http_url) + get_plusone_count($https_url); $linkedins = get_linkedin_count($http_url) + get_linkedin_count($https_url); $pins = get_pinterest_count($http_url) + get_pinterest_count($https_url); $xings = get_xing_count($http_url) + get_xing_count($https_url); } elseif (FLAG_HTTP) { $fb_shares = get_fb_shares_count($http_url); $tweets = get_tweet_count($http_url); $plusones = get_plusone_count($http_url); $linkedins = get_linkedin_count($http_url); $pins = get_pinterest_count($http_url); $xings = get_xing_count($http_url); } else { $fb_shares = get_fb_shares_count($https_url); $tweets = get_tweet_count($https_url); $plusones = get_plusone_count($https_url); $linkedins = get_linkedin_count($https_url); $pins = get_pinterest_count($https_url); $xings = get_xing_count($https_url); } $total = $fb_shares + $tweets + $plusones + $linkedins + $pins + $xings; $response = array('URL' => SHARED_URL, 'Facebook' => $fb_shares, 'Twitter' => $tweets, 'Google' => $plusones, 'Linkedin' => $linkedins, 'Pinterest' => $pins, 'Xing' => $xings, 'Total' => $total); echo json_encode($response); } else { // Request is not from a valid source... echo 'There is nothing for you here...'; }
$https_url = preg_replace('/^http:/i', 'https:', SHARED_URL); } if (FLAG_HTTP && FLAG_HTTPS || !FLAG_HTTP && !FLAG_HTTPS) { $fb_shares = $counts['facebook'] ? get_fb_shares_count(SHARED_URL) : 0; $tweets = $counts['twitter'] ? get_tweet_count(SHARED_URL) : 0; $plusones = $counts['google'] ? get_plusone_count(SHARED_URL) : 0; $linkedins = $counts['linkedin'] ? get_linkedin_count(SHARED_URL) : 0; $pins = $counts['pinterest'] ? get_pinterest_count(SHARED_URL) : 0; $xings = $counts['xing'] ? get_xing_count(SHARED_URL) : 0; } elseif (FLAG_HTTP) { $fb_shares = $counts['facebook'] ? get_fb_shares_count($http_url) : 0; $tweets = $counts['twitter'] ? get_tweet_count($http_url) : 0; $plusones = $counts['google'] ? get_plusone_count($http_url) : 0; $linkedins = $counts['linkedin'] ? get_linkedin_count($http_url) : 0; $pins = $counts['pinterest'] ? get_pinterest_count($http_url) : 0; $xings = $counts['xing'] ? get_xing_count($http_url) : 0; } else { $fb_shares = $counts['facebook'] ? get_fb_shares_count($https_url) : 0; $tweets = $counts['twitter'] ? get_tweet_count($https_url) : 0; $plusones = $counts['google'] ? get_plusone_count($https_url) : 0; $linkedins = $counts['linkedin'] ? get_linkedin_count($https_url) : 0; $pins = $counts['pinterest'] ? get_pinterest_count($https_url) : 0; $xings = $counts['xing'] ? get_xing_count($https_url) : 0; } $total = $fb_shares + $tweets + $plusones + $linkedins + $pins + $xings; $response = array('URL' => SHARED_URL, 'Facebook' => $fb_shares, 'Twitter' => $tweets, 'Google' => $plusones, 'Linkedin' => $linkedins, 'Pinterest' => $pins, 'Xing' => $xings, 'Total' => $total); echo json_encode($response); } else { // Request is not from a valid source... echo 'There is nothing for you here...'; }