You are here

protected function SocialContentTwitter::getRowsHashtag in Social Content 7.2

Get rows from a list of hashtags.

Parameters

array $settings: The settings to use to get the tweets

array $global_settings: The global settings for Twitter.

mixed $last_id: The id of the last imported tweet.

Return value

mixed Array of tweets or FALSE on error.

1 call to SocialContentTwitter::getRowsHashtag()
SocialContentTwitter::getRows in modules/twitter/social_content_twitter.class.inc
Get the rows to import.

File

modules/twitter/social_content_twitter.class.inc, line 329
Social Content Twitter class.

Class

SocialContentTwitter
@file Social Content Twitter class.

Code

protected function getRowsHashtag($settings, $global_settings, $last_id = NULL) {
  $hashtags = explode(' ', $settings['hashtag']);
  $rows = array();
  foreach ($hashtags as $hashtag) {
    $params = array(
      'q' => $hashtag,
      'count' => $settings['limit'],
    );
    if ($last_id) {
      $params['since_id'] = $last_id;
    }
    $data = $this
      ->request($settings, $global_settings, 'search/tweets.json', $params);
    if ($data && isset($data->statuses) && is_array($data->statuses)) {
      foreach ($data->statuses as &$row) {
        $row->hashtag = $hashtag;
      }
      $rows = array_merge($rows, $data->statuses);
    }
    else {
      return FALSE;
    }
  }
  return $rows;
}