public function SocialContentFlickr::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/
flickr/ social_content_flickr.class.inc, line 168 - Social Content Flickr class.
Class
- SocialContentFlickr
- @file Social Content Flickr class.
Code
public function getRows($last_id = NULL) {
$settings = $this->settings['instance'];
$global_settings = $this->settings['global'];
if (!empty($settings['user_id']) || !empty($settings['group_id'])) {
$params = array(
'extras' => 'url_o,url_sq,url_t,url_s,url_q,url_m,url_n,url_z,url_c,url_l,date_upload,owner_name,description',
'format' => 'json',
'nojsoncallback' => '1',
'api_key' => $global_settings['api_key'],
);
if (!empty($settings['limit'])) {
$params['per_page'] = $settings['limit'];
}
if ($settings['type'] == 'user') {
$params['method'] = 'flickr.people.getPublicPhotos';
$params['user_id'] = $settings['user_id'];
}
else {
if ($settings['type'] == 'group') {
$params['method'] = 'flickr.groups.pools.getPhotos';
$params['group_id'] = $settings['group_id'];
}
}
$url = $global_settings['api_url'] . '/';
$result = $this
->httpRequest(url($url, array(
'query' => $params,
'external' => TRUE,
)));
if ($result->code == 200) {
$posts = json_decode($result->data);
if (isset($posts->photos) && isset($posts->photos->photo)) {
return $posts->photos->photo;
}
}
else {
watchdog('social_content_flickr', 'Error fetching feed, data: %data', array(
'%data' => $result->data,
), WATCHDOG_WARNING);
}
}
return array();
}