芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/backup/herve-tessa-maconnerie.fr/wp-content/themes/Crevision/inc/followers.php
page->fan_count; if ($fans > $max) { $final = $max.'+';} elseif(empty($fans)) { $final = 'Error'; } else {$final = $fans;} return $final; } // get Facebook username after count function getFacebookUsername($id) { $facebookUrl = "http://graph.facebook.com/".$id; if(isset($facebookUrl)){ /* new code */ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $facebookUrl); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec($ch); curl_close($ch); $result = json_decode($contents); return $result->username; /* old code $str = file_get_contents($facebookUrl); $result = json_decode($str); return $result->username; */ } } function getTwitCount($username,$max,$consumer_key,$consumer_secret,$user_token,$user_secret){ // WordPress Transient API Caching $url_for_cache = site_url(); $healthy = array("http://", ".", "/"); $yummy = array("", "", ""); $different = str_replace($healthy, $yummy, $url_for_cache); $cacheKey = $different . '-cache-'.$username; $cached = get_transient($cacheKey); if (false !== $cached) {return $cached;} // Call and instantiate tmhOAuth require get_template_directory() . '/inc/tmhoauth/tmhOAuth.php'; require get_template_directory() . '/inc/tmhoauth/tmhUtilities.php'; $tmhOAuth = new tmhOAuth(array( 'consumer_key' => $consumer_key, // 'consumer_secret' => $consumer_secret, 'user_token' => $user_token, 'user_secret' => $user_secret, )); // Send the API request $json = json_decode($tmhOAuth->request( 'GET', $tmhOAuth->url('1.1/users/show.json'), array('screen_name' => $username ) )); // Extract the follower and tweet counts $followerCount = json_decode($tmhOAuth->response['response'])->followers_count; $tweetCount = json_decode($tmhOAuth->response['response'])->statuses_count; $output = $followerCount; if ($output > $max) { $final = $max.'+';} else {$final = $output;} set_transient($cacheKey,$final,1); // default (3600) update_option($cacheKey, $final); return $final; } ?>