function theme_comment_attachments in Comment Upload 5
Style the attachment display.
Images are displayed inline when Inline display has been set. Any remaining files are styled by theme('upload_attachments').
Parameters
$files An array containing files objects ($comment->files structure).:
Return value
HTML representation of attachments.
1 theme call to theme_comment_attachments()
- comment_upload_comment in ./
comment_upload.module - Implementation of hook_comment.
File
- ./
comment_upload.module, line 305
Code
function theme_comment_attachments($files) {
// Display images.
if (variable_get('comment_upload_inline_image', 0)) {
$regex = '/\\.(' . ereg_replace(' +', '|', preg_quote('jpg jpeg gif png')) . ')$/i';
foreach ($files as $key => $file) {
if ($file->list) {
if (preg_match($regex, $file->filename)) {
unset($files[$key]);
$href = check_url(strpos($file->fid, 'upload') === false ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())));
$html .= '<img src="' . $href . '" title="' . check_plain($file->description) . '" alt="' . check_plain($file->description) . '" />';
}
}
}
}
// Style the remaining files as an attachment table.
$html .= theme('upload_attachments', $files);
return $html;
}