function emvideo_flickr_sets_extract in Media: Flickr 6
hook emvideo_PROVIDER_extract this is called to extract the video code from a pasted URL or embed code.
Parameters
$embed: an optional string with the pasted URL or embed code
Return value
either an array of regex expressions to be tested, or a string with the video code to be used if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array. otherwise, the calling function will handle testing the embed code against each regex string in the returned array.
File
- providers/
emvideo/ flickr_sets.inc, line 152 - This include processes flickr.com photosets for use by emfield/emvideo.module.
Code
function emvideo_flickr_sets_extract($embed = '') {
// http://www.flickr_sets.com/watch/1404/saturday-night-live-snl-digital-short-natalie-raps
// http://www.flickr.com/search/?q=Paris+City&l=comm&ss=0&ct=0&mt=photos&w=all&adv=1
// http://www.flickr.com/search/show/?q=Paris+City&l=comm&ss=0&ct=0&mt=photos&adv=1
// http://www.flickr.com/photos/petemorris/show/
// http://www.flickr.com/groups/streamsimages/pool/show/
if (preg_match('@\\.flickr\\.com/search.+?\\?q=([^\\&]+)@i', $embed, $matches)) {
return 'FLICKR_SETS_ERROR_SEARCH';
}
else {
if (!($set = preg_match('@\\.flickr\\.com/.+?/.+?/sets/([^/\\?]+)@i', $embed, $matches)) && preg_match('@\\.flickr\\.com/photos/([^/\\?\\#]+)@i', $embed, $matches)) {
return 'FLICKR_SETS_ERROR_USER';
}
else {
if (!$set && preg_match('@\\.flickr\\.com/groups/([^/\\?\\#]+)@i', $embed, $matches)) {
return 'FLICKR_SETS_ERROR_GROUPS';
}
}
}
return array(
'@\\.flickr\\.com/.+?/.+?/sets/([^/\\?]+)@i',
'@sets%2F(.+?)%2Fshow.+?flickr\\.com/apps/slideshow/show\\.swf@i',
);
}