function clients_flickr_clients_call in Web Service Clients 7
Same name and namespace in other branches
- 6 backends/clients_flickr/clients_flickr.module \clients_flickr_clients_call()
Implementation of hook_clients_call
File
- backends/
clients_flickr/ clients_flickr.module, line 295 - Flickr plugin for Clients module
Code
function clients_flickr_clients_call($connection, $serviceOptions) {
if ($connection->type == variable_get('clients_flickr_type', 'Flickr')) {
$serviceConfig = clients_connection_load((int) $connection->cid);
$response = clients_connection_flickr::call($serviceConfig, $serviceOptions);
// process xml and turn into serializable array
if ($response->data->code == '200') {
$xml = new SimpleXMLElement($response->data->data);
$result = new stdClass();
$result->created = $response->created;
$result->data = array();
foreach ($xml->photos->photo as $photo) {
$row = array();
foreach ($photo
->attributes() as $name => $value) {
$row[$name] = (string) $value;
}
$row['url'] = "http://farm{$row['farm']}.static.flickr.com/{$row['server']}/{$row['id']}_{$row['secret']}.jpg";
$row['html'] = '<img src="' . $row['url'] . '" />';
$row['status'] = 1;
// published
$result->data[] = $row;
}
return $result;
}
}
}