You are here

public function SocialContentPicasa::getRows in Social Content 7.2

Get the rows to import.

Parameters

mixed $last_id: The id of the last import.

Return value

array Array with the rows.

Overrides SocialContent::getRows

File

modules/picasa/social_content_picasa.class.inc, line 150
Social Content Picasa class.

Class

SocialContentPicasa
@file Social Content Picasa class.

Code

public function getRows($last_id = NULL) {
  $settings = $this->settings['instance'];
  $global_settings = $this->settings['global'];
  if (!empty($settings['user_id'])) {
    $params = array(
      'alt' => 'json',
      'kind' => 'photo',
    );
    $url = $global_settings['api_url'] . '/user/' . $settings['user_id'];
    if ($settings['type'] == 'album' && !empty($settings['album_id'])) {
      $url .= '/albumid/' . $settings['album_id'];
    }
    $result = $this
      ->httpRequest(url($url, array(
      'query' => $params,
      'external' => TRUE,
    )));
    if ($result->code == 200) {
      $data = json_decode($result->data);
      if (isset($data->feed->entry)) {
        return $data->feed->entry;
      }
    }
    else {
      watchdog('social_content_picasa', 'Error fetching feed, data: %data', array(
        '%data' => $result->data,
      ), WATCHDOG_WARNING);
    }
  }
  return array();
}