= $crt){
$connection = getConnectionWithAccessToken($consumer_key, $consumer_secret, $access_token, $access_token_secret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitter_id."&count=" . $num_fetch) or die('Couldn\'t retrieve tweets! Wrong username?');
if(!empty($tweets->errors)){
if($tweets->errors[0]->message == 'Invalid or expired token'){
echo ''.$tweets->errors[0]->message.'!
You\'ll need to regenerate it here!' . $after_widget;
}else{
echo ''.$tweets->errors[0]->message.'' . $after_widget;
}
return;
}
$tweets_data = array();
for($i = 0;$i <= count($tweets); $i++){
if(!empty($tweets[$i])){
$tweets_data[$i]['created_at'] = $tweets[$i]->created_at;
$tweets_data[$i]['text'] = $tweets[$i]->text;
$tweets_data[$i]['status_id'] = $tweets[$i]->id_str;
}
}
update_option(THEME_SHORT_NAME . '_twitter_bar_tweets',serialize($tweets_data));
update_option(THEME_SHORT_NAME . '_twitter_bar_last_cache_time',time());
}else{
$tweets_data = maybe_unserialize(get_option(THEME_SHORT_NAME . '_twitter_bar_tweets'));
}
?>