Skip to content

Instantly share code, notes, and snippets.

@Neolot
Created July 13, 2012 16:13
Show Gist options
  • Select an option

  • Save Neolot/3105743 to your computer and use it in GitHub Desktop.

Select an option

Save Neolot/3105743 to your computer and use it in GitHub Desktop.
WORDPRESS Счетчик Twitter с кэшированием
<?php
// Счетчик Twitter с кэшированием
function nlt_getTwitterCounter($userID='androidbar') {
$output = get_transient('twitter_counter');
if ( $output === false || $output == '' ) {
$data = json_decode(@file_get_contents('http://api.twitter.com/users/' . $userID .'.json'));
$output = $data->followers_count;
set_transient( 'twitter_counter', $output, 60*10 );
}
echo $output;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment