You are here

function SocialTwitterFormatter::getComments in Open Social 7

Return twitter comments.

1 call to SocialTwitterFormatter::getComments()
SocialTwitterFormatter::getData in includes/social_comments.twitter.inc

File

includes/social_comments.twitter.inc, line 59
Twitter class

Class

SocialTwitterFormatter
@file Twitter class

Code

function getComments($id) {
  $comments = array();
  $cache_key = 'social_comments:twitter:' . $id;
  if ($cache = cache_get($cache_key)) {
    $comments = $cache->data;
  }
  else {
    if (libraries_load('acTwitterConversation')) {
      $connection = new acTwitterConversation();
      $comments = $connection
        ->fetchConversion($id);
      if (!$comments['error']) {
        $comments = $comments['tweets'];
        cache_set($cache_key, $comments, 'cache', $this->expire + REQUEST_TIME);
      }
    }
  }
  return $comments;
}