function lightbox2_supported_file_extension in Lightbox2 6
Same name and namespace in other branches
- 8 lightbox2.module \lightbox2_supported_file_extension()
- 5.2 lightbox2.module \lightbox2_supported_file_extension()
- 7.2 lightbox2.module \lightbox2_supported_file_extension()
- 7 lightbox2.module \lightbox2_supported_file_extension()
Check whether a given file extension is supported by the lightbox iframe.
Parameters
$ext: File extension
$type: Type of file extensions to check.
Return value
TRUE if extension is supported.
2 calls to lightbox2_supported_file_extension()
- lightbox2_check_filefield_extension in ./
lightbox2.module - Suitability callback function for the filefield formatter.
- lightbox2_check_filefield_image_extension in ./
lightbox2.module - Suitability callback function for the image filefield formatter.
File
- ./
lightbox2.module, line 1243 - Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.
Code
function lightbox2_supported_file_extension($ext, $type = 'all') {
$image_extensions = array(
'png',
'jpg',
'jpeg',
'gif',
'bmp',
);
$movie_extensions = array(
'dv',
'mov',
'moov',
'movie',
'mp4',
'asf',
'wm',
'wmv',
'avi',
'mpg',
'mpeg',
);
$web_extensions = array(
'asp',
'aspx',
'cgi',
'cfm',
'htm',
'html',
'pl',
'php',
'php3',
'php4',
'php5',
'phtml',
'rb',
'rhtml',
'shtml',
'txt',
'vbs',
);
$misc_extensions = array(
'pdf',
);
$extensions = array();
switch ($type) {
case 'image':
$extensions = $image_extensions;
break;
case 'movie':
$extensions = $movie_extensions;
break;
case 'web':
$extensions = $web_extensions;
break;
case 'misc':
$extensions = $misc_extensions;
break;
case 'all':
default:
$extensions = array_merge($image_extensions, $movie_extensions, $web_extensions, $misc_extensions);
break;
}
if (in_array(drupal_strtolower($ext), $extensions)) {
return TRUE;
}
return FALSE;
}