当前位置: 首页>>代码示例>>PHP>>正文


PHP FileHelper::formatBytes方法代码示例

本文整理汇总了PHP中FileHelper::formatBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHelper::formatBytes方法的具体用法?PHP FileHelper::formatBytes怎么用?PHP FileHelper::formatBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHelper的用法示例。


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

示例1: filesize

 $filescreatedlist = FileHelper::createZip($filestozip, $folderusersmodulestmp . $packagename, true, $folderusersmodulestmp);
 // Get size of package
 $bytes = filesize($folderusersmodulestmp . $packagename);
 $filecreatedcount = count($filescreatedlist);
 // Format numbers
 $filecreatedcount_format = number_format($filecreatedcount);
 $totallinescalculated_format = number_format($totallinescalculated);
 // Connect to database
 $database = new Database(HOST, DBNAME, DBUSER, DBPASS);
 // Posted data
 $posted_date = date('Y-m-d H:i:s');
 // Insert into database
 $varObject->description = str_replace("'", "\\'", $varObject->description);
 $create_package_record = array('uid' => $_SESSION['uid'], 'midparent' => $varObject->midparent, 'm_name' => $varObject->name, 'm_file_name' => $varObject->filename, 'version' => $varObject->version, 'jversion' => $varObject->jversion, 'brversion' => $varObject->brversion, 'description' => $varObject->description, 'license' => $varObject->license, 'copyright' => $varObject->copyright, 'author' => $varObject->author, 'author_email' => $varObject->author_email, 'author_url' => $varObject->author_url, 'date_created' => $posted_date, 'filesize' => $bytes, 'lines_created' => $totallinescalculated, 'files_created' => $filecreatedcount, 'minutes_saved' => $totaltimesaved, 'download_count' => 1);
 $mid = $database->insert('br_modules', $create_package_record);
 $filesize = FileHelper::formatBytes($bytes);
 // Move to user folder from tmp
 $userfolder = $folderusersmodules . $mid . DS;
 FileHelper::foldercheck($userfolder);
 FileHelper::createfile($userfolder . $indexfile, $indexlines);
 FileHelper::copyToLocation($folderusersmodulestmp . $packagename, $userfolder . $packagename);
 $filecreatedpath = BASE_URL . 'users' . DS . $_SESSION['uid'] . DS . 'modules' . DS . $mid . DS . $packagename;
 // Clean up tmp folder now that zip has been created
 FileHelper::deleteDir($folderusersmodulestmp);
 // account for hours in display..
 if ($totaltimesaved > 60) {
 }
 // Set permissions of paths
 chmod($folderusersmodules, 0777);
 chmod($userfolder, 0777);
 // Call header
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:module-create.php

示例2: count

        $filesizetotal += $userAllComponent->filesize;
        $componentversionstotal += 1;
    }
    $filesizetotal = FileHelper::formatBytes($filesizetotal);
}
$userComponentsCount = count($userComponents);
$textComponents = $userComponentsCount > 1 || $userComponentsCount == 0 ? 'components' : 'component';
// Modules
$filesizetotalmod = 0;
$moduleversionstotal = 0;
if (is_array($userAllModules)) {
    foreach ($userAllModules as $userAllModule) {
        $filesizetotalmod += $userAllModule->filesize;
        $moduleversionstotal += 1;
    }
    $filesizetotalmod = FileHelper::formatBytes($filesizetotalmod);
}
$userModulesCount = count($userModules);
$textModules = $userModulesCount > 1 || $userModulesCount == 0 ? 'modules' : 'module';
include 'template/header.php';
?>
			<div id="section-container">
				<div class="container">
					<div class="row">
						<div class="span12">
							<h1><?php 
echo $greeting;
?>
!</h1>
							<?php 
if ($_SESSION['paid'] == 1) {
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:dashboard.php

示例3: foreach

									<?php 
        $c = 1;
        foreach ($userComponents as $userComponent) {
            $userComponentFirst = $userComponent;
            // grab all components under parent
            $userComponentHistory = $database->select('br_components', '*', 'uid="' . $uid . '" AND cidparent="' . $userComponent->id . '"', 'object');
            $date_created = $userComponent->date_created;
            $date_modified = '';
            if ($userComponentHistory) {
                $compCount = count($userComponentHistory) - 1;
                $userComponent = $userComponentHistory[$compCount];
                $date_modified = $userComponent->date_created;
                $date_modified = date('m-d-Y h:ia', strtotime($date_modified));
            }
            $date_created = date('m-d-Y h:ia', strtotime($date_created));
            $file_size = FileHelper::formatBytes($userComponent->filesize);
            $views = $database->select('br_components_views', '*', 'cid="' . $userComponent->id . '"', 'object');
            $views_count = count($views);
            if ($userComponent->category_view) {
                $views_count += 1;
            }
            if ($userComponent->tags_view) {
                $views_count += 1;
            }
            switch ($userComponent->jversion) {
                case '3.2':
                    $j_version = 'label-j32';
                    $j_version_print = '3.2';
                    break;
                case '3.0':
                    $j_version = 'label-j30';
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:components.php

示例4: foreach

											<th width="75"><center><img src="images/black-rabbit.png" height="23" width="23" /></center></th>
											<th width="75">Filesize</th>
											<th width="180"></th>
										</tr>
									</thead>
									<tbody>
									<?php 
        $m = 1;
        foreach ($userModules as $userModule) {
            // grab all components under parent
            $userModuleHistory = $database->select('br_modules', '*', 'uid="' . $uid . '" AND midparent="' . $userModule->id . '"', 'object');
            if ($userModuleHistory) {
                $modCount = count($userModuleHistory) - 1;
                $userModule = $userModuleHistory[$modCount];
            }
            $filesize = FileHelper::formatBytes($userModule->filesize);
            // safe guard the parent id, always stay with the parent
            $midparent = $userModule->midparent == 0 ? $userModule->id : $userModule->midparent;
            $jlabel = $userModule->jversion == '2.5.0' ? 'label-j25' : 'label-j30';
            ?>
										<tr>
											<td align="right"><?php 
            echo $m;
            ?>
</td>
											<td><?php 
            echo $userModule->m_name;
            ?>
</td>
											<td style="text-align: right;"><?php 
            echo $userModule->version;
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:modules.php


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