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


PHP transformFileSize函数代码示例

本文整理汇总了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;			
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:35,代码来源:class.search.php

示例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:
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:ajax_get_file_listing.php

示例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 "}";
开发者ID:rip-projects,项目名称:judge,代码行数:31,代码来源:ajax_image_undo.php

示例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 
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:ajax_file_upload.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:61,代码来源:class.search.php

示例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']; ?>">&nbsp;</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; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>">&nbsp;</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']; ?>">&nbsp;</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; ?>">&nbsp;<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"); ?>">&nbsp;</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; ?>">&nbsp;</td>
										<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
									</tr>
									<?php
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:_ajax_get_details_listing.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 
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:_ajax_get_details_listing.php


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