本文整理汇总了PHP中print_file_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP print_file_icon函数的具体用法?PHP print_file_icon怎么用?PHP print_file_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_file_icon函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_bug_attachment_header
/**
* Prints a single textual line of information about an attachment including download link, file
* size and upload timestamp.
* @param array $p_attachment An attachment arrray from within the array returned by the file_get_visible_attachments() function
*/
function print_bug_attachment_header($p_attachment)
{
echo "\n";
if ($p_attachment['exists']) {
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
print_file_icon($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator');
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
echo string_display_line($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator') . '(' . number_format($p_attachment['size']) . lang_get('word_separator') . lang_get('bytes') . ')';
echo lang_get('word_separator') . '<span class="italic">' . date(config_get('normal_date_format'), $p_attachment['date_added']) . '</span>';
} else {
print_file_icon($p_attachment['display_name']);
echo lang_get('word_separator') . '<span class="strike">' . string_display_line($p_attachment['display_name']) . '</span>' . lang_get('word_separator') . '(' . lang_get('attachment_missing') . ')';
}
if ($p_attachment['can_delete']) {
echo lang_get('word_separator') . '[';
print_link('bug_file_delete.php?file_id=' . $p_attachment['id'] . form_security_param('bug_file_delete'), lang_get('delete_link'), false, 'small');
echo ']';
}
if ($p_attachment['exists']) {
if (config_get('file_upload_method') == FTP) {
echo lang_get('word_separator') . '(' . lang_get('cached') . ')';
}
}
}
示例2: print_bug_attachments_list
function print_bug_attachments_list($p_bug_id)
{
$t_attachments = file_get_visible_attachments($p_bug_id);
$t_attachments_count = count($t_attachments);
$i = 0;
$image_previewed = false;
foreach ($t_attachments as $t_attachment) {
$t_file_display_name = string_display_line($t_attachment['display_name']);
$t_filesize = number_format($t_attachment['size']);
$t_date_added = date(config_get('normal_date_format'), $t_attachment['date_added']);
if ($image_previewed) {
$image_previewed = false;
echo '<br />';
}
if ($t_attachment['can_download']) {
$t_href_start = '<a href="' . string_attribute($t_attachment['download_url']) . '">';
$t_href_end = '</a>';
$t_href_clicket = " [<a href=\"file_download.php?file_id={$t_attachment['id']}&type=bug\" target=\"_blank\">^</a>]";
} else {
$t_href_start = '';
$t_href_end = '';
$t_href_clicket = '';
}
if (!$t_attachment['exists']) {
print_file_icon($t_file_display_name);
echo ' <span class="strike">' . $t_file_display_name . '</span>' . lang_get('word_separator') . '(' . lang_get('attachment_missing') . ')';
} else {
echo $t_href_start;
print_file_icon($t_file_display_name);
echo $t_href_end . ' ' . $t_href_start . $t_file_display_name . $t_href_end . $t_href_clicket . ' (' . $t_filesize . ' ' . lang_get('bytes') . ') ' . '<span class="italic">' . $t_date_added . '</span>';
}
if ($t_attachment['can_delete']) {
echo ' [';
print_link('bug_file_delete.php?file_id=' . $t_attachment['id'] . form_security_param('bug_file_delete'), lang_get('delete_link'), false, 'small');
echo ']';
}
if ($t_attachment['exists']) {
if (FTP == config_get('file_upload_method') && $t_attachment['exists']) {
echo ' (' . lang_get('cached') . ')';
}
if ($t_attachment['preview'] && $t_attachment['type'] == 'text') {
$c_id = db_prepare_int($t_attachment['id']);
$t_bug_file_table = db_get_table('mantis_bug_file_table');
echo "<script type=\"text/javascript\" language=\"JavaScript\">\n<!--\nfunction swap_content( span ) {\ndisplayType = ( document.getElementById( span ).style.display == 'none' ) ? '' : 'none';\ndocument.getElementById( span ).style.display = displayType;\n}\n\n -->\n </script>";
echo " <span id=\"hideSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('show_content') . "</a>]</span>";
echo " <span style='display:none' id=\"showSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('hide_content') . "</a>]";
echo "<pre>";
/** @todo Refactor into a method that gets contents for download / preview. */
switch (config_get('file_upload_method')) {
case DISK:
if ($t_attachment['exists']) {
$v_content = file_get_contents($t_attachment['diskfile']);
}
break;
case FTP:
if (file_exists($t_attachment['exists'])) {
file_get_contents($t_attachment['diskfile']);
} else {
$ftp = file_ftp_connect();
file_ftp_get($ftp, $t_attachment['diskfile'], $t_attachment['diskfile']);
file_ftp_disconnect($ftp);
$v_content = file_get_contents($t_attachment['diskfile']);
}
break;
default:
$query = "SELECT *\n\t \t\t\t\t\tFROM {$t_bug_file_table}\n\t\t\t\t \t\t\tWHERE id=" . db_param();
$result = db_query_bound($query, array($c_id));
$row = db_fetch_array($result);
$v_content = $row['content'];
}
echo htmlspecialchars($v_content);
echo "</pre></span>\n";
}
if ($t_attachment['can_download'] && $t_attachment['preview'] && $t_attachment['type'] == 'image') {
$t_preview_style = 'border: 0;';
$t_max_width = config_get('preview_max_width');
if ($t_max_width > 0) {
$t_preview_style .= ' max-width:' . $t_max_width . 'px;';
}
$t_max_height = config_get('preview_max_height');
if ($t_max_height > 0) {
$t_preview_style .= ' max-height:' . $t_max_height . 'px;';
}
$t_preview_style = 'style="' . $t_preview_style . '"';
$t_title = file_get_field($t_attachment['id'], 'title');
$t_image_url = $t_attachment['download_url'] . '&show_inline=1' . form_security_param('file_show_inline');
echo "\n<br />{$t_href_start}<img alt=\"{$t_title}\" {$t_preview_style} src=\"{$t_image_url}\" />{$t_href_end}";
$image_previewed = true;
}
}
if ($i != $t_attachments_count - 1) {
echo "<br />\n";
$i++;
}
}
}
示例3: lang_get
echo $v_description;
?>
</textarea>
</td>
</tr>
<tr class="row-1">
<th class="category">
<?php
echo lang_get('filename');
?>
</th>
<td>
<?php
$t_href = '<a href="file_download.php?file_id=' . $v_id . '&type=doc">';
echo $t_href;
print_file_icon($v_filename);
echo '</a> ' . $t_href . file_get_display_name($v_filename) . '</a>';
?>
</td>
</tr>
<tr class="row-2">
<td class="category">
<?php
echo lang_get('select_file');
?>
<br />
<?php
// FIXME: hard coded "k" in here.
?>
<span class="small"><?php
echo lang_get('max_file_size_label') . lang_get('word_separator') . number_format($t_max_file_size / 1000);
示例4: file_list_attachments
function file_list_attachments($p_bug_id)
{
$t_attachment_rows = bug_get_attachments($p_bug_id);
$num_files = sizeof($t_attachment_rows);
if ($num_files === 0) {
return;
}
$t_can_download = file_can_download_bug_attachments($p_bug_id);
$t_can_delete = file_can_delete_bug_attachments($p_bug_id);
$image_previewed = false;
for ($i = 0; $i < $num_files; $i++) {
$row = $t_attachment_rows[$i];
extract($row, EXTR_PREFIX_ALL, 'v');
$t_file_display_name = file_get_display_name($v_filename);
$t_filesize = number_format($v_filesize);
$t_date_added = date(config_get('normal_date_format'), db_unixtimestamp($v_date_added));
if ($image_previewed) {
$image_previewed = false;
print '<br />';
}
if ($t_can_download) {
$t_href_start = "<a href=\"file_download.php?file_id={$v_id}&type=bug\">";
$t_href_end = '</a>';
$t_href_clicket = " [<a href=\"file_download.php?file_id={$v_id}&type=bug\" target=\"_blank\">^</a>]";
} else {
$t_href_start = '';
$t_href_end = '';
$t_href_clicket = '';
}
print $t_href_start;
print_file_icon($t_file_display_name);
print $t_href_end . '</a> ' . $t_href_start . $t_file_display_name . $t_href_end . "{$t_href_clicket} ({$t_filesize} bytes) <span class=\"italic\">{$t_date_added}</span>";
if ($t_can_delete) {
print " [<a class=\"small\" href=\"bug_file_delete.php?file_id={$v_id}\">" . lang_get('delete_link') . '</a>]';
}
if (FTP == config_get('file_upload_method') && file_exists($v_diskfile)) {
print ' (' . lang_get('cached') . ')';
}
if ($t_can_download && $v_filesize <= config_get('preview_attachments_inline_max_size') && $v_filesize != 0 && in_array(strtolower(file_get_extension($t_file_display_name)), array('png', 'jpg', 'jpeg', 'gif', 'bmp'), true)) {
print "<br /><img src=\"file_download.php?file_id={$v_id}&type=bug\" />";
$image_previewed = true;
}
if ($i != $num_files - 1) {
print '<br />';
}
}
}
示例5: print_bug_attachment_header
/**
* Prints a single textual line of information about an attachment including download link, file
* size and upload timestamp.
* If $p_security_token is null, a token will be generated with form_security_token().
* If otherwise specified (i.e. not null), the parameter must contain
* a valid security token, previously generated by form_security_token().
* Use this to avoid performance issues when loading pages having many calls to
* this function, such as print_bug_attachments_list().
* @param array $p_attachment An attachment array from within the array returned by the file_get_visible_attachments() function.
* @param mixed $p_security_token Optional; null (default) or security token string.
* @see form_security_token()
* @return void
*/
function print_bug_attachment_header(array $p_attachment, $p_security_token = null)
{
echo "\n";
if ($p_attachment['exists']) {
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
print_file_icon($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator');
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
echo string_display_line($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator') . '(' . number_format($p_attachment['size']) . lang_get('word_separator') . lang_get('bytes') . ')';
echo lang_get('word_separator') . '<span class="italic">' . date(config_get('normal_date_format'), $p_attachment['date_added']) . '</span>';
event_signal('EVENT_VIEW_BUG_ATTACHMENT', array($p_attachment));
} else {
print_file_icon($p_attachment['display_name']);
echo lang_get('word_separator') . '<span class="strike">' . string_display_line($p_attachment['display_name']) . '</span>' . lang_get('word_separator') . '(' . lang_get('attachment_missing') . ')';
}
if ($p_attachment['can_delete']) {
echo lang_get('word_separator') . '[';
print_link('bug_file_delete.php?file_id=' . $p_attachment['id'] . form_security_param('bug_file_delete', $p_security_token), lang_get('delete_link'), false, 'small');
echo ']';
}
}
示例6: file_list_attachments
function file_list_attachments($p_bug_id)
{
$t_attachment_rows = bug_get_attachments($p_bug_id);
$num_files = sizeof($t_attachment_rows);
if ($num_files === 0) {
return;
}
$t_can_download = file_can_download_bug_attachments($p_bug_id);
$t_can_delete = file_can_delete_bug_attachments($p_bug_id);
$t_preview_text_ext = config_get('preview_text_extensions');
$t_preview_image_ext = config_get('preview_image_extensions');
$image_previewed = false;
for ($i = 0; $i < $num_files; $i++) {
$row = $t_attachment_rows[$i];
extract($row, EXTR_PREFIX_ALL, 'v');
$t_file_display_name = string_display_line(file_get_display_name($v_filename));
$t_filesize = number_format($v_filesize);
$t_date_added = date(config_get('normal_date_format'), db_unixtimestamp($v_date_added));
if ($image_previewed) {
$image_previewed = false;
print '<br />';
}
if ($t_can_download) {
$t_href_start = "<a href=\"file_download.php?file_id={$v_id}&type=bug\">";
$t_href_end = '</a>';
$t_href_clicket = " [<a href=\"file_download.php?file_id={$v_id}&type=bug\" target=\"_blank\">^</a>]";
} else {
$t_href_start = '';
$t_href_end = '';
$t_href_clicket = '';
}
$t_exists = config_get('file_upload_method') != DISK || file_exists($v_diskfile);
if (!$t_exists) {
print_file_icon($t_file_display_name);
print ' <span class="strike">' . $t_file_display_name . '</span> (attachment missing)';
} else {
print $t_href_start;
print_file_icon($t_file_display_name);
print $t_href_end . ' ' . $t_href_start . $t_file_display_name . $t_href_end . "{$t_href_clicket} ({$t_filesize} bytes) <span class=\"italic\">{$t_date_added}</span>";
if ($t_can_delete) {
print " [<a class=\"small\" href=\"bug_file_delete.php?file_id={$v_id}\">" . lang_get('delete_link') . '</a>]';
}
if (FTP == config_get('file_upload_method') && file_exists($v_diskfile)) {
print ' (' . lang_get('cached') . ')';
}
if ($t_can_download && $v_filesize <= config_get('preview_attachments_inline_max_size') && $v_filesize != 0 && in_array(strtolower(file_get_extension($t_file_display_name)), $t_preview_text_ext, true)) {
$c_id = db_prepare_int($v_id);
$t_bug_file_table = config_get('mantis_bug_file_table');
echo "<script type=\"text/javascript\" language=\"JavaScript\">\r\n<!--\r\nfunction swap_content( span ) {\r\ndisplayType = ( document.getElementById( span ).style.display == 'none' ) ? '' : 'none';\r\ndocument.getElementById( span ).style.display = displayType;\r\n}\r\n\r\n -->\r\n </script>";
print " <span id=\"hideSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('show_content') . "</a>]</span>";
print " <span style='display:none' id=\"showSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('hide_content') . "</a>]";
print "<pre>";
switch (config_get('file_upload_method')) {
case DISK:
if (file_exists($v_diskfile)) {
$v_content = file_get_contents($v_diskfile);
}
break;
case FTP:
if (file_exists($v_diskfile)) {
file_get_contents($v_diskfile);
} else {
$ftp = file_ftp_connect();
file_ftp_get($ftp, $v_diskfile, $v_diskfile);
file_ftp_disconnect($ftp);
$v_content = file_get_contents($v_diskfile);
}
break;
default:
$query = "SELECT *\r\n\t \t\t\t\t\t\tFROM {$t_bug_file_table}\r\n\t\t\t\t \t\t\tWHERE id='{$c_id}'";
$result = db_query($query);
$row = db_fetch_array($result);
$v_content = $row['content'];
}
echo htmlspecialchars($v_content);
print "</pre></span>\n";
}
if ($t_can_download && $v_filesize <= config_get('preview_attachments_inline_max_size') && $v_filesize != 0 && in_array(strtolower(file_get_extension($t_file_display_name)), $t_preview_image_ext, true)) {
$t_preview_style = 'border: 0;';
$t_max_width = config_get('preview_max_width');
if ($t_max_width > 0) {
$t_preview_style .= ' max-width:' . $t_max_width . 'px;';
}
$t_max_height = config_get('preview_max_height');
if ($t_max_height > 0) {
$t_preview_style .= ' max-height:' . $t_max_height . 'px;';
}
$t_preview_style = 'style="' . $t_preview_style . '"';
$t_title = file_get_field($v_id, 'title');
print "\n<br />{$t_href_start}<img alt=\"{$t_title}\" {$t_preview_style} src=\"file_download.php?file_id={$v_id}&type=bug\" />{$t_href_end}";
$image_previewed = true;
}
}
if ($i != $num_files - 1) {
print "<br />\n";
}
}
}