function flickr_get_id_type in Flickr 7
Returns the type of ID. User, group or photoset. If is has no @ it is a set, if flickr_groups_getinfo returns 'ok', it is a group. This is not a validation function.
Parameters
string $id: A valid Flickr ID. Should be validated before arriving here.
Return value
string 'user', 'group' or 'photoset'
4 calls to flickr_get_id_type()
- flickr_filter_callback_album in filter/
flickr_filter.module - Filter callback for a user or set.
- flickr_filter_callback_favorites in filter/
flickr_filter.module - Filter callback for a user's favorites.
- theme_flickr_flickrcomslideshow in ./
flickr.module - Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = x).
- theme_flickr_flickrcomslideshow_simple in ./
flickr.module - Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = y).
File
- ./
flickr.inc, line 556 - The Flickr API functions.
Code
function flickr_get_id_type($id) {
// If it contains a '@' it is likely a group or user ID.
if (strpos($id, '@') !== FALSE) {
$info = flickr_groups_getinfo($id);
if ($info['stat'] == 'ok') {
// If the function works, it is a group ID.
return 'group';
}
elseif (flickr_user_find_by_identifier($id)) {
// If it doesn't, it is likely a user ID.
return 'user';
}
}
elseif (is_numeric($id)) {
return 'photoset';
}
if (flickr_user_find_by_identifier($id)) {
return 'user';
}
$message = t('A valid Flickr ID could not be found');
drupal_set_message($message, 'error');
watchdog('flickr', $message, array(), WATCHDOG_WARNING);
return FALSE;
}