function filebrowser_get_icon in Filebrowser 5
Returns the appropriate HTML code for an icon representing a file, based on the extension of the file. A specific icon can also be requested with the second parameter.
1 call to filebrowser_get_icon()
- filebrowser_get_list in ./
filebrowser.module - Returns a list of files in a subfolder under the admin specified filebrowser root. File system details (size, last modification) is added, plus a metafile is parsed to gather more information, if available.
File
- ./
filebrowser.module, line 325
Code
function filebrowser_get_icon($fullpath = NULL, $iconname = NULL) {
if (isset($fullpath)) {
$iconname = is_dir($fullpath) ? 'folder' : preg_replace("!^.+\\.([^\\.]+)\$!", "\\1", $fullpath);
}
elseif (!isset($iconname)) {
$iconname = 'default';
}
$iconfiles = array(
variable_get('filebrowser_icons', '') . "/file-{$iconname}.png",
variable_get('filebrowser_icons', '') . "/file-default.png",
);
foreach ($iconfiles as $icon) {
if (file_exists($icon)) {
return theme("image", $icon);
}
}
return '';
}