本文整理汇总了PHP中transformFileSize函数的典型用法代码示例。如果您正苦于以下问题:PHP transformFileSize函数的具体用法?PHP transformFileSize怎么用?PHP transformFileSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transformFileSize函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructor
*
* @param string $rootFolder
*/
function __construct($rootFolder)
{
$this->rootFolder = $rootFolder;
$this->sessionAction = new SessionAction();
$objRootFolder = new file($this->rootFolder);
$tem = $objRootFolder->getFileInfo();
$obj = new manager($this->rootFolder, false);
$obj->setSessionAction($this->sessionAction);
$selectedDocuments = $this->sessionAction->get();
$fileType = $obj->getFolderInfo($this->rootFolder);
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($this->rootFolder);
$tem['type'] = (is_dir($this->rootFolder)?'folder':'file');
$tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder)));
//$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
//$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
$tem['url'] = getFileUrl($this->rootFolder);
$tem['friendly_path'] = transformFilePath($this->rootFolder);
$tem['file'] = 0;
$tem['subdir'] = 0;
$manager = null;
$this->rootFolderInfo = $tem;
$tem = null;
}
示例2: echo
echo ($count++ == 1 ? '' : ',') . "'" . $k . "':'" . ($k == 'ctime' || $k == 'mtime' ? date(DATE_TIME_FORMAT, $v) : $v) . "'";
}
echo "};\n";
$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
echo 'numRows = ' . sizeof($fileList) . ";\n";
echo "files = {\n";
$count = 1;
foreach ($fileList as $file) {
echo ($count > 1 ? "," : '') . $count++ . ":{";
$j = 1;
foreach ($file as $k => $v) {
if ($k == 'ctime' || $k == 'mtime') {
$v = @date(DATE_TIME_FORMAT, $v);
}
if ($k == 'size') {
$v = transformFileSize($v);
}
echo ($j++ > 1 ? "," : '') . "'" . $k . "':'" . $v . "'";
}
echo ($j++ > 1 ? "," : '') . "'url':'" . getFileUrl($file['path']) . "'";
echo "}\n";
}
echo "};</script>\n";
if (!empty($_GET['view'])) {
switch ($_GET['view']) {
case 'detail':
case 'thumbnail':
case 'text':
$view = $_GET['view'];
break;
default:
示例3: transformFileSize
$error = IMG_UNDO_COPY_FAILED;
} else {
//remove the session image
if (@unlink($sessionImage)) {
$history->restore();
}
//only one left, remove the session original if demo
if ($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo)) {
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
$originalImage = $_POST['file_path'];
}
}
$imagePath = $originalImage;
} else {
$error = IMG_SAVE_IMG_OPEN_FAILED;
}
if (isset($imageInfo)) {
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
}
}
}
echo "error:'" . $error . "'\n";
if (isset($image) && is_object($image)) {
$image->DestroyImages();
}
echo $info;
echo ",history:" . $history->getNumRestorable() . "\n";
echo "}";
示例4: manager
if(sizeof($tem))
{
include_once(CLASS_MANAGER);
$manager = new manager($upload->getFilePath(), false);
$fileType = $manager->getFileType($upload->getFileName());
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($path);
$tem['type'] = "file";
$tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['short_name'] = shortenFileName($tem['name']);
$tem['flag'] = 'noFlag';
$obj->close();
foreach($tem as $k=>$v)
{
$info .= sprintf(", %s:'%s'", $k, $v);
}
$info .= sprintf(", url:'%s'", getFileUrl($path));
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
}else
示例5: doSearch
/**
* get the file according to the search keywords
*
*/
function doSearch($baseFolderPath = null)
{
$baseFolderPath = addTrailingSlash(backslashToSlash(is_null($baseFolderPath) ? $this->rootFolder : $baseFolderPath));
$dirHandler = @opendir($baseFolderPath);
if ($dirHandler) {
while (false !== ($file = readdir($dirHandler))) {
if ($file != '.' && $file != '..') {
$path = $baseFolderPath . $file;
if (is_file($path)) {
$isValid = true;
$fileTime = @filemtime($path);
$fileSize = @filesize($path);
if ($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) {
$isValid = false;
}
if ($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) {
$isValid = false;
}
if ($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) {
$isValid = false;
}
if ($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) {
$isValid = false;
}
if ($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) {
$isValid = false;
}
if ($isValid && isListingDocument($path)) {
$finalPath = $path;
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$obj->setSessionAction($this->sessionAction);
$selectedDocuments = $this->sessionAction->get();
$fileType = $obj->getFileType($finalPath);
foreach ($fileType as $k => $v) {
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = is_dir($finalPath) ? 'folder' : 'file';
$tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['flag'] = array_search($tem['path'], $selectedDocuments) !== false ? $this->sessionAction->getAction() == "copy" ? 'copyFlag' : 'cutFlag' : 'noFlag';
$tem['url'] = getFileUrl($tem['path']);
$this->rootFolderInfo['file']++;
$manager = null;
$this->files[] = $tem;
$tem = null;
}
} elseif (is_dir($path) && $this->searchkeywords['recursive']) {
$this->Search($baseFolderPath);
}
}
}
}
}
示例6: transformFileSize
//<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
foreach($fileList as $file)
{
$css = ($css == "" || $css == "even"?"odd":"even");
$strDisabled = ($file['is_writable']?"":" disabled");
$strClass = ($file['is_writable']?"left":" leftDisabled");
if($file['type'] == 'file')
{
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> />
</td>
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>"> </span></a></td>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>"><?php echo $file['name']; ?></a></td>
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
</tr>
<?php
}else
{
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/>
</td>
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?> ><span class="<?php echo ($file['file']||$file['subdir']?$file['cssClass']:"folderEmpty"); ?>"> </span></a></td>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td>
<td class="docInfo" id="tdrd<?php echo $count; ?>"> </td>
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
</tr>
<?php
示例7: transformFileSize
echo $path_chamilo_file;
//fix for Chamilo
?>
"
target="_blank">
<?php
echo $file['name'];
?>
</a>
</td>
<td class="docInfo" id="tdrd<?php
echo $count;
?>
"><?php
echo transformFileSize($file['size']);
?>
</td>
<!-- hide while implementing this Chamilo -->
<!--<td class="docInfo" id="tdth<?php
//echo $count;
?>
"><?php
//echo @date(DATE_TIME_FORMAT,$file['mtime']);
?>
</td> -->
</tr>
<?php
} else {
?>
<tr class="<?php