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

PHP get_file_size函数代码示例

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

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



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

示例1: bp_group_documents_forum_attachments_document_link

function bp_group_documents_forum_attachments_document_link($document)
{
    $html = "<br /><a class='group-documents-title' id='group-document-link-{$document->id}' href='{$document->get_url()}' target='_blank'>{$document->name}";
    if (get_option('bp_group_documents_display_file_size')) {
        $html .= " <span class='group-documents-filesize'>(" . get_file_size($document) . ")</span>";
    }
    $html .= "</a>";
    if (BP_GROUP_DOCUMENTS_SHOW_DESCRIPTIONS && $document->description) {
        $html .= "<br /><span class='group-documents-description'>" . nl2br($document->description) . "</span>";
    }
    return apply_filters('bp_group_documents_forum_document_link', $html, $document);
}
开发者ID:lilarock3rs,项目名称:bp-group-documents,代码行数:12,代码来源:group-forum-attachments.php


示例2: render

 /**
  * Get the rendered contents of the Profiler.
  *
  * @param  Response  $response
  * @return string
  */
 public static function render($response)
 {
     // We only want to send the profiler toolbar if the request is not an AJAX
     // request, as sending it on AJAX requests could mess up JSON driven API
     // type applications, so we will not send anything in those scenarios.
     if (!Request::ajax()) {
         static::$data['memory'] = get_file_size(memory_get_usage(true));
         static::$data['memory_peak'] = get_file_size(memory_get_peak_usage(true));
         static::$data['time'] = number_format((microtime(true) - LARAVEL_START) * 1000, 2);
         return render('path: ' . __DIR__ . '/template' . BLADE_EXT, static::$data);
     }
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:18,代码来源:profiler.php


示例3: download_item

function download_item($dir, $item)
{
    // download file
    // Security Fix:
    $item = base_name($item);
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $abs_item = get_abs_item($dir, $item);
    $browser = id_browser();
    header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . get_file_size($dir, $item));
    header('Content-Description: File Download');
    if ($browser == 'IE') {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
    }
    //@readfile($abs_item);
    flush();
    $fp = popen("tail -c " . get_file_size($dir, $item) . " {$abs_item} 2>&1", "r");
    while (!feof($fp)) {
        // Send the current file part to the browser.
        print fread($fp, 1024);
        // Flush the content to the browser.
        flush();
    }
    fclose($fp);
    exit;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:42,代码来源:fun_down.php


示例4: file_get_contents

<?php

if ($argv[1] == "join parts") {
    if (file_exists($argv[2])) {
        echo "{$argv['2']} exists.\n";
        exit;
    }
    for ($i = 0; file_exists("part{$i}.mp4"); $i++) {
        $in = file_get_contents("part{$i}.mp4");
        file_put_contents($argv[2], $in, FILE_APPEND);
    }
    echo "{$argv['2']} FileSize = " . filesize($argv[2]) . "\n";
    array_map('unlink', glob("part*.mp4"));
    exit;
}
$remsize = get_file_size($argv[1]);
if ($remsize == 0) {
    echo "get_file_size error, returned 0\n";
    exit;
} else {
    echo "FileSize = " . $remsize . "\n";
}
$partsize = 4 * 1024 * 1024;
// 4MB
$numparts = (int) ($remsize / $partsize);
$partmod = $remsize % $partsize;
echo "PartSize = " . $partsize . "\n";
echo "NumParts = " . $numparts . "\n";
echo "PartMod = " . $partmod . "\n";
$i = 0;
for ($i = 0, $off_from = 0, $off_to = $partsize; $i < $numparts; $i++, $off_from = $off_to + 1, $off_to += $partsize) {
开发者ID:aberope,项目名称:powerange,代码行数:31,代码来源:powerange.php


示例5: bp_group_documents_display_content


//.........这里部分代码省略.........
        ?>

		<?php 
        //loop through each document and display content along with admin options
        $count = 0;
        foreach ($template->document_list as $document_params) {
            $document = new BP_Group_Documents($document_params['id'], $document_params);
            ?>

			<li <?php 
            if (++$count % 2) {
                echo 'class="alt"';
            }
            ?>
 >
			<?php 
            if (get_option('bp_group_documents_display_icons')) {
                $document->icon();
            }
            ?>

			<a class="group-documents-title" id="group-document-link-<?php 
            echo $document->id;
            ?>
" href="<?php 
            $document->url();
            ?>
" target="_blank"><?php 
            echo $document->name;
            ?>

			<?php 
            if (get_option('bp_group_documents_display_file_size')) {
                echo ' <span class="group-documents-filesize">(' . get_file_size($document) . ')</span>';
            }
            ?>
</a> &nbsp;
			
			<span class="group-documents-meta"><?php 
            printf(__('Uploaded by %s on %s', 'bp-group-documents'), bp_core_get_userlink($document->user_id), date(get_option('date_format'), $document->created_ts));
            ?>
</span>

			<?php 
            if (BP_GROUP_DOCUMENTS_SHOW_DESCRIPTIONS && $document->description) {
                echo '<br /><span class="group-documents-description">' . nl2br($document->description) . '</span>';
            }
            //show edit and delete options if user is privileged
            echo '<div class="admin-links">';
            if ($document->current_user_can('edit')) {
                $edit_link = wp_nonce_url($template->action_link . 'edit/' . $document->id, 'group-documents-edit-link');
                echo "<a href='{$edit_link}'>" . __('Edit', 'bp-group-documents') . "</a> | ";
            }
            if ($document->current_user_can('delete')) {
                $delete_link = wp_nonce_url($template->action_link . 'delete/' . $document->id, 'group-documents-delete-link');
                echo "<a href='{$delete_link}' id='bp-group-documents-delete'>" . __('Delete', 'bp-group-documents') . "</a>";
            }
            echo '</div>';
            echo '</li>';
        }
        ?>
		</ul>

	<?php 
    } else {
        ?>
开发者ID:adisonc,项目名称:MaineLearning,代码行数:67,代码来源:index.php


示例6: print_table

function print_table($dir, $list)
{
    if (!is_array($list)) {
        return;
    }
    while (list($item, ) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        //$extra="";
        //if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            //?? CK Hier wird kuenftig immer mit dem download-Link gearbeitet, damit
            //?? CK die Leute links klicken koennen
            //?? CK			$link = $GLOBALS["home_url"]."/".get_rel_item($dir, $item);
            $link = make_link("download", $dir, $item);
            $target = "_blank";
        }
        //else $link = "";
        echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
        echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
        // Icon + Link
        echo "<TD nowrap>";
        if (permissions_grant($dir, $item, "read")) {
            echo "<A HREF=\"" . $link . "\">";
        }
        //else echo "<A>";
        echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
        echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item);
        if (permissions_grant($dir, $item, "read")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // ...$extra...
        // Size
        echo "<TD>" . parse_file_size(get_file_size($dir, $item)) . "</TD>\n";
        // Type
        echo "<TD>" . get_mime_type($dir, $item, "type") . "</TD>\n";
        // Modified
        echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
        // Permissions
        echo "<TD>";
        if (permissions_grant($dir, NULL, "change")) {
            echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
        if (permissions_grant($dir, NULL, "change")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // Actions
        echo "<TD>\n<TABLE>\n";
        // EDIT
        if (get_is_editable($dir, $item)) {
            _print_link("edit", permissions_grant($dir, $item, "change"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        // DOWNLOAD
        if (get_is_file($dir, $item)) {
            _print_link("download", permissions_grant($dir, $item, "read"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        echo "</TABLE>\n</TD></TR>\n";
    }
}
开发者ID:RX78NY1,项目名称:hustoj,代码行数:78,代码来源:fun_list.php


示例7: date

        print "<div style='margin-bottom: 5px'><a href='?type=cabinet'><< к списку заказов</a></div>" . "<div style='font-size: 12pt; font-weight: bold; margin-bottom: 10px;'>" . $order["subject"] . "</div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Номер заказа:</div><div class='cab_ord_row_val'>" . $order["id"] . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Вид работы:</div><div class='cab_ord_row_val'>" . $type . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Направление:</div><div class='cab_ord_row_val'>" . $napr . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Дисциплина:</div><div class='cab_ord_row_val'>" . $disc . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Принят:</div><div class='cab_ord_row_val'>" . date("d.m.Y", $order["created"]) . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Дата сдачи:</div><div class='cab_ord_row_val'>" . date("d.m.Y", $order["time_kln"]) . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Статус:</div><div class='cab_ord_row_val'>" . $status . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Стоимость, руб.:</div><div class='cab_ord_row_val'>" . $cost . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Оплачено, руб.:</div><div class='cab_ord_row_val'>" . $order["oplata_kln"] . "</div><div class='clear'></div></div>" . "<div class='cab_ord_row'><div class='cab_ord_row_capt'>Требования:</div><div class='cab_ord_row_val'>" . $order["about_kln"] . "</div><div class='clear'></div></div>";
        $html = array();
        $files = get_order_files($order["id"], 0);
        if (count($files)) {
            $html[] = '<p style="margin-top: 20px;">Файлы</p>';
            $html[] = '<table cellpadding="4" cellspacing="1" width="100%">';
            $html[] = '<tr class="header">';
            $html[] = '<td>Название</td>';
            $html[] = '<td>Размер</td>';
            $html[] = '<td>Дата добавления</td>';
            $html[] = '<td>Скачать</td>';
            $html[] = '</tr>';
            foreach ($files as $file) {
                $html[] = '<tr>';
                $html[] = '<td>' . $file['name'] . '</td>';
                $html[] = '<td>' . get_file_size($file['size']) . '</td>';
                $html[] = '<td>' . _get_fmt_date_time($file['created']) . '</td>';
                $html[] = '<td>' . generate_file_link_for_frame($file) . '</td>';
                $html[] = '</tr>';
            }
            $html[] = '</table>';
        }
        print join("\n", $html);
        print '
    <form id="zakaz_form" method="post" enctype="multipart/form-data">
    <input type="hidden" name="add_file">
		<div style="height:50px; margin-bottom: 20px;margin-top: 20px; width: 580px;">
			<div>Если имеются методические указания и материалы прикрепите файл (макс. размер 1го файла = ' . ini_get("upload_max_filesize") . ')</div>
			<div id="add_file_field" style="margin-top: 5px">
           		<input type=file name="zf_work_file" value="Выбрать" onchange="mkorder_add_file_change(this)">
			</div>
开发者ID:yonkon,项目名称:diplom,代码行数:31,代码来源:cabinet_orders.php


示例8: print_table

function print_table($dir, $list, $allow)
{
    // print table of files
    global $dir_up;
    if (!is_array($list)) {
        return;
    }
    if ($dir != "" || strstr($dir, _EXT_PATH)) {
        echo "<tr class=\"sectiontableentry1\"><td valign=\"baseline\"><a href=\"" . make_link("list", $dir_up, NULL) . "\">";
        echo "<img border=\"0\" align=\"absmiddle\" src=\"" . _EXT_URL . "/images/up.png\" ";
        echo "alt=\"" . $GLOBALS["messages"]["uplink"] . "\" title=\"" . $GLOBALS["messages"]["uplink"] . "\"/>&nbsp;&nbsp;..</a></td>\n";
        echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";
        echo "</tr>";
    }
    $i = 0;
    while (list($item, ) = each($list)) {
        if ($item == 'index.html') {
            continue;
        }
        $abs_item = get_abs_item($dir, $item);
        $is_writable = is_writable($abs_item);
        $is_chmodable = $GLOBALS['ext_File']->is_chmodable($abs_item);
        $is_readable = is_readable($abs_item);
        $is_deletable = $GLOBALS['ext_File']->is_deletable($abs_item);
        $file_info = @stat($abs_item);
        $is_file = false;
        //if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
        if (@is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            $link = make_link("download", $dir, $item);
            $is_file = true;
        }
        //else $link = "";
        $class = $i % 2 ? 'sectiontableentry1' : 'sectiontableentry2';
        //echo "<tr class=\"rowdata\">"
        echo '<tr class="' . $class . '">';
        // Icon + Link
        echo "<td nowrap=\"nowrap\">";
        if ($is_readable) {
            echo "<a href=\"" . $link . "\"";
            if ($is_file) {
                echo " title=\"" . $GLOBALS["messages"]["downlink"] . ": " . $item . "\"";
            }
            echo ">";
        }
        //else echo "<A>";
        echo "<img border=\"0\" ";
        echo "align=\"absmiddle\" vspace=\"5\" hspace=\"5\" src=\"" . _EXT_URL . "/images/" . get_mime_type($abs_item, "img") . "\" alt=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        $s_item = htmlspecialchars($s_item);
        if (!$is_file) {
            echo '<strong>' . $s_item . '</strong>';
        } else {
            echo $s_item;
        }
        if ($is_readable) {
            echo "</a>";
            // ...$extra...
        }
        echo "</td>\n";
        // Size
        echo "<td>" . parse_file_size(get_file_size($abs_item)) . "</td>\n";
        // type
        echo "<td>" . get_mime_type($abs_item, "type") . "</td>\n";
        // modified
        echo "<td>" . parse_file_date(get_file_date($abs_item)) . "</td>\n";
        // actions
        echo "</tr>\n";
        $i++;
    }
}
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:76,代码来源:extplorer.list.php


示例9: send_dircontents

/**
 * This function assembles an array (list) of files or directories in the directory specified by $dir
 * The result array is send using JSON
 *
 * @param string $dir
 * @param string $sendWhat Can be "files" or "dirs"
 */
function send_dircontents($dir, $sendWhat = 'files')
{
    // print table of files
    global $dir_up, $mainframe;
    // make file & dir tables, & get total filesize & number of items
    get_dircontents($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    if ($sendWhat == 'files') {
        $list = $file_list;
    } elseif ($sendWhat == 'dirs') {
        $list = $dir_list;
    } else {
        $list = make_list($dir_list, $file_list);
    }
    $i = 0;
    $items['totalCount'] = count($list);
    $items['items'] = array();
    $dirlist = array();
    if ($sendWhat != 'dirs') {
        // Replaced array_splice, because it resets numeric indexes (like files or dirs with a numeric name)
        // Here we reduce the list to the range of $limit beginning at $start
        $a = 0;
        $output_array = array();
        foreach ($list as $key => $value) {
            if ($a >= $GLOBALS['start'] && $a - $GLOBALS['start'] < $GLOBALS['limit']) {
                $output_array[$key] = $value;
            }
            $a++;
        }
        $list = $output_array;
    }
    while (list($item, $info) = each($list)) {
        // link to dir / file
        if (is_array($info)) {
            $abs_item = $info;
            if (extension_loaded('posix')) {
                $user_info = posix_getpwnam($info['user']);
                $file_info['uid'] = $user_info['uid'];
                $file_info['gid'] = $user_info['gid'];
            }
        } else {
            $abs_item = get_abs_item(ext_TextEncoding::fromUTF8($dir), $item);
            $file_info = @stat($abs_item);
        }
        $is_dir = get_is_dir($abs_item);
        if ($GLOBALS['use_mb']) {
            if (ext_isFTPMode()) {
                $items['items'][$i]['name'] = $item;
            } else {
                if (mb_detect_encoding($item) == 'ASCII') {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                } else {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                }
            }
        } else {
            $items['items'][$i]['name'] = ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item);
        }
        $items['items'][$i]['is_file'] = get_is_file($abs_item);
        $items['items'][$i]['is_archive'] = ext_isArchive($item) && !ext_isFTPMode();
        $items['items'][$i]['is_writable'] = $is_writable = @$GLOBALS['ext_File']->is_writable($abs_item);
        $items['items'][$i]['is_chmodable'] = $is_chmodable = @$GLOBALS['ext_File']->is_chmodable($abs_item);
        $items['items'][$i]['is_readable'] = $is_readable = @$GLOBALS['ext_File']->is_readable($abs_item);
        $items['items'][$i]['is_deletable'] = $is_deletable = @$GLOBALS['ext_File']->is_deletable($abs_item);
        $items['items'][$i]['is_editable'] = get_is_editable($abs_item);
        $items['items'][$i]['icon'] = _EXT_URL . "/images/" . get_mime_type($abs_item, "img");
        $items['items'][$i]['size'] = parse_file_size(get_file_size($abs_item));
        // type
        $items['items'][$i]['type'] = get_mime_type($abs_item, "type");
        // modified
        $items['items'][$i]['modified'] = parse_file_date(get_file_date($abs_item));
        // permissions
        $perms = get_file_perms($abs_item);
        if ($perms) {
            if (strlen($perms) > 3) {
                $perms = substr($perms, 2);
            }
            $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        } else {
            $items['items'][$i]['perms'] = ' (unknown) ';
        }
        $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        if (extension_loaded("posix")) {
            if ($file_info["uid"]) {
                $user_info = posix_getpwuid($file_info["uid"]);
                //$group_info = posix_getgrgid($file_info["gid"]);
                $items['items'][$i]['owner'] = $user_info["name"] . " (" . $file_info["uid"] . ")";
            } else {
                $items['items'][$i]['owner'] = " (unknown) ";
            }
        } else {
            $items['items'][$i]['owner'] = 'n/a';
        }
        if ($is_dir && $sendWhat != 'files') {
//.........这里部分代码省略.........
开发者ID:kostya1017,项目名称:our,代码行数:101,代码来源:list.php


示例10: widget

    function widget($args, $instance)
    {
        global $bp;
        $instance['group_id'] = bp_get_current_group_id();
        if ($instance['group_id'] > 0) {
            $group = $bp->groups->current_group;
            // If the group  public, or the user is super_admin or the user is member of group
            if ($group->status == 'public' || is_super_admin() || groups_is_user_member(bp_loggedin_user_id(), $group_id)) {
                extract($args);
                $title = apply_filters('widget_title', empty($instance['title']) ? sprintf(__('Recent %s for the group', 'bp-group-documents'), $this->bp_group_documents_name) : sanitize_text_field($instance['title']));
                echo $before_widget . $before_title . $title . $after_title;
                do_action('bp_group_documents_current_group_widget_before_html');
                $document_list = BP_Group_Documents::get_list_for_newest_widget(absint($instance['num_items']), $instance['group_id'], (bool) $instance['featured']);
                if ($document_list && count($document_list) >= 1) {
                    echo '<ul id="bp-group-documents-current-group" class="bp-group-documents-list">';
                    foreach ($document_list as $item) {
                        $document = new BP_Group_Documents($item['id']);
                        echo '<li>';
                        if (get_option('bp_group_documents_display_icons')) {
                            $document->icon();
                        }
                        ?>
                                                <a class="bp-group-documents-title" id="group-document-link-<?php 
                        echo $document->id;
                        ?>
" href="<?php 
                        $document->url();
                        ?>
" target="_blank"><?php 
                        echo esc_html($document->name);
                        ?>

                                                    <?php 
                        if (get_option('bp_group_documents_display_file_size')) {
                            echo ' <span class="group-documents-filesize">(' . get_file_size($document) . ')</span>';
                        }
                        ?>
</a> &nbsp;<div class="bp-group-documents-meta">
                                                    <?php 
                        $document->categories();
                        printf(__('Uploaded by %s on %s', 'bp-group-documents'), bp_core_get_userlink($document->user_id), date_i18n(get_option('date_format'), $document->created_ts));
                        ?>
                                                    <?php 
                        echo '</li>';
                    }
                    echo '</ul>';
                } else {
                    echo '<div class="widget-error">' . sprintf(__('There are no %s to display.', 'bp-group-documents'), $this->bp_group_documents_name) . '</div></p>';
                }
                echo '<div class="view-all"><a href="' . bp_get_group_permalink($bp->groups->current_group) . BP_GROUP_DOCUMENTS_SLUG . '#object-nav">' . __("View all", 'bp-group-documents') . '</a></div>';
                echo $after_widget;
            }
        }
    }
开发者ID:lilarock3rs,项目名称:bp-group-documents,代码行数:54,代码来源:widgets.php


示例11: bp_group_documents_display_content


//.........这里部分代码省略.........
        } else {
            ?>
	    	    <ul id="bp-group-documents-list" class="item-list">
			    <?php 
        }
        //loop through each document and display content along with admin options
        $count = 0;
        foreach ($template->document_list as $document_params) {
            $document = new BP_Group_Documents($document_params['id'], $document_params);
            ?>
	    		<li <?php 
            if (++$count % 2) {
                echo 'class="alt"';
            }
            ?>
 >
				    <?php 
            if (get_option('bp_group_documents_display_icons')) {
                $document->icon();
            }
            ?>
<a class="bp-group-documents-title" id="group-document-link-<?php 
            echo $document->id;
            ?>
" href="<?php 
            $document->url();
            ?>
" target="_blank">
				    <?php 
            echo str_replace("\\", "", esc_html(stripslashes($document->name)));
            ?>
				    <?php 
            if (get_option('bp_group_documents_display_file_size')) {
                echo ' <span class="group-documents-filesize">(' . get_file_size($document) . ')</span>';
            }
            ?>
</a> &nbsp;<div class="bp-group-documents-meta">
				    <?php 
            $document->categories();
            printf(__('Uploaded by %s on %s', 'bp-group-documents'), bp_core_get_userlink($document->user_id), date_i18n(get_option('date_format'), $document->created_ts));
            ?>
.
				    <?php 
            if (get_option('bp_group_documents_display_download_count')) {
                echo ' <span class="group-documents-download-count">' . $document->download_count . __(' downloads since then.', 'bp-group-documents') . '</span>';
            }
            ?>
	    	    			    </div>
					<?php 
            //show edit and delete options if user is privileged
            echo '<div class="admin-links">';
            if ($document->current_user_can('edit')) {
                $edit_link = wp_nonce_url($template->action_link . 'edit/' . $document->id, 'group-documents-edit-link') . '#edit-document-form';
                echo "<a href='{$edit_link}'>" . __('Edit', 'bp-group-documents') . "</a> | ";
            }
            if ($document->current_user_can('delete')) {
                $delete_link = wp_nonce_url($template->action_link . 'delete/' . $document->id, 'group-documents-delete-link');
                echo "<a href='{$delete_link}' class='bp-group-documents-delete'>" . __('Delete', 'bp-group-documents') . "</a>";
            }
            echo '</div>';
            if (BP_GROUP_DOCUMENTS_SHOW_DESCRIPTIONS && $document->description) {
                echo '<span class="group-documents-description">' . wp_kses(stripslashes($document->description), wp_kses_allowed_html('post')) . '</span>';
            }
            //eleni add this in order to display the Addthis button on 3/2/2011
            include_once ABSPATH . 'wp-admin/includes/plugin.php';
            if (is_plugin_active('buddypress-addthis-ls/bp-addthis-ls.php')) {
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:67,代码来源:bp_group_documents_functions.php


示例12: find_and_download

/**
 * @param string $spotify_id
 * @param string $artist
 * @param string $title
 * @param int    $duration
 * @param string $access_token
 */
function find_and_download($spotify_id, $artist, $title, $duration, $access_token)
{
    $artist = decode_special_chars(trim($artist));
    $title = decode_special_chars(trim($title));
    /**
     * API request
     */
    $q = urlencode("{$artist} - {$title}");
    $result = json_decode(file_get_contents("https://api.vk.com/method/audio.search?q={$q}&count=20&&access_token={$access_token}"), true);
    /**
     * Error happened
     */
    if (isset($result['error'])) {
        /**
         * If too many requests - wait for 3 seconds and try again
         */
        if ($result['error']['error_code'] == 6) {
            unset($q, $result);
            sleep(3);
            find_and_download($spotify_id, $artist, $title, $duration, $access_token);
        } else {
            echo "{$artist} - {$title}: {$result['error']['error_msg']}\n";
        }
        return;
    }
    $result = array_slice($result['response'], 1);
    if (!$result) {
        file_put_contents(__DIR__ . '/spotify_fail.csv', "{$spotify_id};{$artist} - {$title};{$duration}\n", FILE_APPEND);
        echo "Failed: {$artist} - {$title}\n";
        return;
    }
    /**
     * Normalize found tracks and calculate file size
     */
    foreach ($result as &$r) {
        $r['title'] = decode_special_chars(trim($r['title']));
        $r['artist'] = decode_special_chars(trim($r['artist']));
        $r = ['title' => $r['title'], 'title_levenshtein' => levenshtein($r['title'], $title), 'artist' => $r['artist'], 'artist_levenshtein' => levenshtein($r['artist'], $artist), 'size' => get_file_size($r['url']), 'url' => $r['url'], 'duration' => $r['duration'], 'duration_diff' => abs($r['duration'] - $duration), 'not_remix' => !preg_match('/remix/i', $title) && !preg_match('/remix/i', $r['title'])];
    }
    unset($r);
    /**
     * Sort found tracks by better fit and quality
     */
    usort($result, function ($track1, $track2) use($artist, $title) {
        if ($track1['title_levenshtein'] != $track2['title_levenshtein']) {
            return $track1['title_levenshtein'] < $track2['title_levenshtein'] ? -1 : 1;
        }
        if ($track1['artist_levenshtein'] != $track2['artist_levenshtein']) {
            return $track1['artist_levenshtein'] < $track2['artist_levenshtein'] ? -1 : 1;
        }
        if ($track1['not_remix'] != $track2['not_remix']) {
            return $track1['not_remix'] ? -1 : 1;
        }
        if ($track1['duration_diff'] != $track2['duration_diff']) {
            return $track1['duration_diff'] < $track2['duration_diff'] ? -1 : 1;
        }
        return $track1['size'] > $track2['size'] ? -1 : 1;
    });
    if (!is_dir('spotify')) {
        mkdir('spotify');
    }
    $found = $result[0];
    unset($result);
    file_put_contents(__DIR__ . '/spotify/' . str_replace('/', '|', "{$artist} - {$title}.mp3"), file_get_contents($found['url']));
    file_put_contents(__DIR__ . '/spotify_success.csv', "{$spotify_id};{$artist} - {$title};{$duration};{$found['artist']} - {$found['title']};{$found['duration']}\n", FILE_APPEND);
    echo "Succeed: {$artist} - {$title}\n";
    echo "Actually downloaded: {$found['artist']} - {$found['title']}\n";
}
开发者ID:sonictruth,项目名称:spotify-to-vk,代码行数:75,代码来源:spotify-to-vk.php


示例13: print_table

/**
 print table of files
*/
function print_table($dir, $list)
{
    if (!is_array($list)) {
        return;
    }
    while (list($item) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            $link = make_link("download", $dir, $item);
            $target = "_blank";
        }
        echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
        echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
        // Icon + Link
        echo "<TD nowrap>";
        if (permissions_grant($dir, $item, "read")) {
            echo "<A HREF=\"" . $link . "\">";
        }
        //else echo "<A>";
        echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
        echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item);
        if (permissions_grant($dir, $item, "read")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // ...$extra...
        // Size
        echo '<TD>' . parse_file_size(get_file_size($dir, $item)) . sprintf("%10s", "&nbsp;") . "</TD>\n";
        // Type
        echo "<td>" . _get_link_info($dir, $item, "type") . "</td>\n";
        // Modified
        echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
        // Permissions
        echo "<TD>";
        if (permissions_grant($dir, NULL, "change")) {
            echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
        if (permissions_grant($dir, NULL, "change")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // Actions
        echo "<TD>\n<TABLE>\n";
        // EDIT
        if (get_is_editable($dir, $item)) {
            _print_link("edit", permissions_grant($dir, $item, "change"), $dir, $item);
        } else {
            // UNZIP
            if (get_is_unzipable($dir, $item)) {
                _print_link("unzip", permissions_grant($dir, $item, "create"), $dir, $item);
            } else {
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
            }
        }
        // DOWNLOAD
        if (get_is_file($dir, $item)) {
            _print_link("download", permissions_grant($dir, $item, "read"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
        }
        echo "</TABLE>\n</TD></TR>\n";
    }
}
开发者ID:realtimeprojects,项目名称:quixplorer,代码行数:79,代码来源:fun_list.php


示例14: print_table

function print_table($dir, $list)
{
    if (!is_array($list)) {
        return;
    }
    while (list($item, ) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        //$extra="";
        //if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            //?? CK Hier wird kuenftig immer mit dem download-Link gearbeitet, damit
            //?? CK die Leute links klicken koennen
            //?? CK			$link = $GLOBALS["home_url"]."/".get_rel_item($dir, $item);
            $link = make_link("download", $dir, $item);
            $target = "_blank";
        }
        //else $link = "";
        if ($item == 'hn') {
            echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
            echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
            // Icon + Link
            echo "<TD nowrap>";
            if (permissions_grant($dir, $item, "read")) {
                echo "<A HREF=\"" . $link . "\">";
            }
            //else echo "<A>";
            echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
            echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
            $s_item = $item;
            if (strlen($s_item) > 50) {
                $s_item = substr($s_item, 0, 47) . "...";
            }
            echo htmlspecialchars($s_item);
            if (permissions_grant($dir, $item, "read")) {
                echo "</A>";
            }
            echo "</TD>\n";
            // ...$extra...
            // Size
            echo "<TD>" . parse_file_size(get_file_size($dir, $item)) . "</TD>\n";
            // Type
            echo "<TD>" . get_mime_type($dir, $item, "type") . "</TD>\n";
            // Modified
            echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
            // Permissions
            /*
            echo "<TD>";
            if (permissions_grant($dir, NULL, "change")) {
              echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
              echo $GLOBALS["messages"]["permlink"] . "\">";
            }
            echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
            if (permissions_grant($dir, NULL, "change"))
              echo "</A>";
            echo "</TD>\n";
            */
            // Actions
            echo "<TD>\n<TABLE>\n";
            // EDIT
            if (get_is_editable($dir, $item)) {
                //_print_link("edit", permissions_grant($dir, $item, "change"), $dir, $item);
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
            } else {
                // UNZIP
                if (get_is_unzipable($dir, $item)) {
                    _print_link("unzip", permissions_grant($dir, $item, "create"), $dir, $item);
                } else {
                    echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                    echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
                }
            }
            // DOWNLOAD
            if (get_is_file($dir, $item)) {
                //_print_link("download", permissions_grant($dir, $item, "read"), $dir, $item);
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
            } else {
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
            }
            echo "</TABLE>\n</TD></TR>\n";
        } else {
            if ($d 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_file_storage函数代码示例发布时间:2022-05-15
下一篇:
PHP get_file_perms函数代码示例发布时间: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