• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP file_get_visible_attachments函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_get_visible_attachments函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_visible_attachments函数的具体用法?PHP file_get_visible_attachments怎么用?PHP file_get_visible_attachments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_get_visible_attachments函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: print_bug_attachments_list

/**
 * Prints the list of visible attachments belonging to a given bug.
 * @param int $p_bug_id ID of the bug to print attachments list for
 */
function print_bug_attachments_list($p_bug_id)
{
    $t_attachments = file_get_visible_attachments($p_bug_id);
    $t_attachments_count = count($t_attachments);
    echo "\n<ul>";
    foreach ($t_attachments as $t_attachment) {
        echo "\n<li>";
        print_bug_attachment($t_attachment);
        echo "\n</li>";
    }
    echo "\n</ul>";
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:16,代码来源:print_api.php


示例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']}&amp;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 '&#160;<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 . '&#160;' . $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 '&#160;[';
            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'] . '&amp;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++;
        }
    }
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:96,代码来源:print_api.php


示例3: sprintf

            ?>
	</td>
</tr>
<?php 
        }
        # profile description
        ?>
<tr class="print">
	<td class="print-category">
		<?php 
        echo sprintf(lang_get('label'), $t_lang_attached_files);
        ?>
	</td>
	<td class="print" colspan="5">
		<?php 
        $t_attachments = file_get_visible_attachments($t_id);
        $t_first_attachment = true;
        $t_path = config_get_global('path');
        foreach ($t_attachments as $t_attachment) {
            if ($t_first_attachment) {
                $t_first_attachment = false;
            } else {
                echo '<br />';
            }
            $c_filename = string_display_line($t_attachment['display_name']);
            $c_download_url = htmlspecialchars($t_attachment['download_url']);
            $c_filesize = number_format($t_attachment['size']);
            $c_date_added = date($t_date_format, $t_attachment['date_added']);
            echo $c_filename . ' (' . $c_filesize . ' ' . lang_get('bytes') . ') <span class="italic-small">' . $c_date_added . '</span><br />' . string_display_links($t_path . $c_download_url);
            if ($t_attachment['preview'] && $t_attachment['type'] == 'image' && $f_type_page == 'html') {
                echo '<br /><img src="', $c_download_url, '" alt="', $t_attachment['alt'], '" /><br />';
开发者ID:spring,项目名称:spring-website,代码行数:31,代码来源:print_all_bug_page_word.php


示例4: process_content

/**
 * @param PDF $pdf
 * @param $bug_ids
 * @param $version_date
 * @param $chapter_prefix
 * @param $option_show_duration
 * @param $detail_flag
 */
function process_content(PDF $pdf, $bug_ids, $version_date, $chapter_prefix, $option_show_duration, $detail_flag)
{
    $specmanagement_editor_api = new specmanagement_editor_api();
    $bug_counter = 10;
    foreach ($bug_ids as $bug_id) {
        if (bug_exists($bug_id)) {
            $bug_data = $specmanagement_editor_api->calculate_bug_data($bug_id, $version_date);
            if ($detail_flag) {
                $pdf->SetFont('Arial', 'B', 12);
                $pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')');
                $pdf->SetFont('Arial', '', 12);
                if ($option_show_duration == '1' && !($bug_data[7] == 0 || is_null($bug_data[7]))) {
                    $pdf->SetFont('Arial', 'B', 12);
                    $pdf->Cell(95, 10, plugin_lang_get('editor_bug_duration') . ': ' . $bug_data[7] . ' ' . plugin_lang_get('editor_duration_unit'), '', 0, 0);
                    $pdf->SetFont('Arial', '', 12);
                }
                $pdf->Ln();
                $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[2])), 0, 1);
                $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[3])), 0, 1);
                $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[4])), 0, 1);
                if (!empty($bug_data[5])) {
                    $bug_attachements = file_get_visible_attachments($bug_id);
                    $bug_attachements_count = count($bug_attachements);
                    $pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_attachments')) . ' (' . $bug_attachements_count . ')', 0, 1);
                    foreach ($bug_attachements as $bug_attachement) {
                        //                  var_dump( $bug_attachement );
                        /** TODO: Bilder anzeigen */
                        if ($bug_attachement['type'] == 'image') {
                            $file_download_url = config_get_global('path') . $bug_attachement['download_url'];
                            //                  $file_download_url = 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Bayerischer_Wald_-_Aufichtenwald_001.jpg';
                            fopen($file_download_url, 'r');
                            $contents = file_get_contents($file_download_url);
                            $savename = '_' . $bug_attachement['id'] . $bug_attachement['display_name'];
                            $savefile = fopen($savename, 'w');
                            fwrite($savefile, $contents);
                            fclose($savefile);
                            //                     $pdf->Image( $savename );
                        }
                    }
                }
                if (!is_null($bug_data[6]) && $bug_data[6] != 0) {
                    $pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_notes_note')) . ' (' . $bug_data[6] . ')', 0, 1);
                }
            } else {
                $pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')', 0, 0);
                $pdf->Cell(95, 10, $pdf->PageNo(), 0, 1, 'R');
            }
            $bug_counter += 10;
        }
    }
}
开发者ID:Cre-ator,项目名称:Whiteboard.SpecificationManagement-Plugin,代码行数:59,代码来源:editorpdf.php


示例5: lang_get

# Tagging
if ($t_show_tags) {
    echo '<tr class="print">';
    echo '<th class="print-category">', lang_get('tags'), '</th>';
    echo '<td class="print" colspan="5">';
    tag_display_attached($f_bug_id);
    echo '</td></tr>';
}
echo '<tr class="print">';
echo '<td class="print-category">' . lang_get('bug_relationships') . '</td>';
echo '<td class="print" colspan="5">' . relationship_get_summary_html_preview($f_bug_id) . '</td></tr>';
if ($t_show_attachments) {
    echo '<tr class="print">';
    echo '<th class="print-category">', lang_get('attached_files'), '</th>';
    echo '<td class="print" colspan="5">';
    $t_attachments = file_get_visible_attachments($f_bug_id);
    $t_first_attachment = true;
    $t_path = config_get_global('path');
    foreach ($t_attachments as $t_attachment) {
        if ($t_first_attachment) {
            $t_first_attachment = false;
        } else {
            echo '<br />';
        }
        $c_filename = string_display_line($t_attachment['display_name']);
        $c_download_url = $t_path . htmlspecialchars($t_attachment['download_url']);
        $c_filesize = number_format($t_attachment['size']);
        $c_date_added = date(config_get('normal_date_format'), $t_attachment['date_added']);
        if (isset($t_attachment['icon'])) {
            echo '<img src="', $t_attachment['icon']['url'], '" alt="', $t_attachment['icon']['alt'], '" />&#160;';
        }
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:31,代码来源:print_bug_page.php



注:本文中的file_get_visible_attachments函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_icon函数代码示例发布时间:2022-05-15
下一篇:
PHP file_get_upload_error函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap