本文整理汇总了PHP中formatFileSize函数的典型用法代码示例。如果您正苦于以下问题:PHP formatFileSize函数的具体用法?PHP formatFileSize怎么用?PHP formatFileSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatFileSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: losslesslyOptimiseImage
function losslesslyOptimiseImage($path, $jpegOrPng)
{
$originalModifiedTime = filemtime($path);
$originalFilesize = filesize($path);
if ($jpegOrPng == 'jpeg') {
$response = shellCommand('jpegoptim -o ' . $path);
} elseif ($jpegOrPng == 'png') {
$response = shellCommand('optipng -o7 ' . $path);
}
clearstatcache();
$optimisedFilesize = filesize($path);
$optimisedModifiedTime = filemtime($path);
if ($originalModifiedTime != $optimisedModifiedTime || $originalFilesize != $optimisedFilesize) {
$this->logError(basename($path) . ' &image-optimised-from; ' . formatFileSize($originalFilesize) . ' &to; ' . formatFileSize($optimisedFilesize) . ' (' . round($optimisedFilesize / $originalFilesize * 100) . '&percent;)', 'note');
} else {
if (strpos($response, 'not found') !== false) {
if ($jpegOrPng == 'jpeg') {
$this->logError('&jpegoptim-not-available;', 'warning');
} elseif ($jpegOrPng == 'png') {
$this->logError('&optipng-not-available;', 'warning');
}
} else {
}
}
}
开发者ID:Nolfneo,项目名称:docvert,代码行数:25,代码来源:ConvertImages.php
示例2: createDownloadsArray
function createDownloadsArray($result)
{
global $CONFIG;
global $downloads_dir;
$downloads = array();
while ($data = mysql_fetch_array($result)) {
$id = $data['id'];
$category = $data['category'];
$type = $data['type'];
$ttitle = $data['title'];
$description = $data['description'];
$filename = $data['location'];
$numdownloads = $data['downloads'];
$clientsonly = $data['clientsonly'];
$filesize = @filesize($downloads_dir . $filename);
$filesize = formatFileSize($filesize);
$fileext = end(explode(".", $filename));
if ($fileext == "doc") {
$type = "doc";
}
if ($fileext == "gif" || $fileext == "jpg" || $fileext == "jpeg" || $fileext == "png") {
$type = "picture";
}
if ($fileext == "txt") {
$type = "txt";
}
if ($fileext == "zip") {
$type = "zip";
}
$type = "<img src=\"images/" . $type . ".png\" align=\"absmiddle\" alt=\"\" />";
$downloads[] = array("type" => $type, "title" => $ttitle, "urlfriendlytitle" => getModRewriteFriendlyString($ttitle), "description" => $description, "downloads" => $numdownloads, "filesize" => $filesize, "clientsonly" => $clientsonly, "link" => $CONFIG['SystemURL'] . ("/dl.php?type=d&id=" . $id));
}
return $downloads;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:34,代码来源:downloads.php
示例3: index
/**
* 上传文件,返回上传文件的地址
* @param HttpRequest $request
*/
public function index(HttpRequest $request)
{
$userid = $request->getParameter('userid', 'intval');
$mediaId = $request->getParameter('media_id', 'intval');
$type = $request->getParameter('type', 'trim');
//图片的最大尺寸,大于这个尺寸就等比例裁剪
$width = $request->getParameter('width', 'intval');
if ($width <= 0) {
$width = 800;
}
if (!$type) {
$type = 'image';
}
$__uploadDir = $type . '/' . date('Y') . '/' . date('m') . '/' . date('d');
$uploadDir = getConfig('upload_dir') . $__uploadDir;
//上传图片
$config = array("upload_dir" => $uploadDir, 'max_size' => 2048000);
$upload = new FileUpload($config);
$result = $upload->upload('Filedata');
if ($result && $result['is_image'] == 1) {
//缩放图片
if ($width < $result['image_width']) {
$src = $result['file_path'];
$thumb = ImageThumb::getInstance();
$thumb->setFlag(2);
//规定宽度,等比缩放
$filename = $thumb->makeThumb(array($width, 0), $src, null, true);
//重新获取图片的尺寸和大小
$info = getimagesize($filename);
$result['image_width'] = $info[0];
$result['image_height'] = $info[1];
$result['file_size'] = filesize($filename);
}
//添加图片图片信息到数据库
$service = Beans::get('image.image.service');
$url = '/res/upload/' . $__uploadDir . '/' . $result['file_name'];
$data = array('userid' => $userid, 'media_id' => $mediaId, 'url' => $url, 'filename' => $result['local_name'], 'type' => $type, 'filesize' => formatFileSize($result['file_size']), 'width' => intval($result['image_width']), 'height' => intval($result['image_height']), 'add_time' => time(), 'grabed' => 1);
//保存到数据库失败
if (!$service->add($data)) {
//删除图片
@unlink($result['file_path']);
}
AjaxResult::ajaxResult(1, $url);
} else {
@unlink($result['file_path']);
AjaxResult::ajaxResult(0, '图片上传失败,' . $upload->getUploadMessage());
}
}
开发者ID:jifangshiyanshi,项目名称:tuonews,代码行数:52,代码来源:UploadAction.class.php
示例4: makeFileList
function makeFileList($path)
{
$filelist = scandir($path);
$list = array();
foreach ($filelist as $file) {
if (!is_dir($path . '/' . $file)) {
$item = array();
$item['name'] = $file;
$item['extension'] = pathinfo($path . '/' . $file, PATHINFO_EXTENSION);
$item['size'] = filesize($path . '/' . $file);
$item['size_str'] = formatFileSize($item['size']);
$item['url'] = $path . '/' . $file;
$list[] = $item;
}
}
return $list;
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:17,代码来源:fileadmin.function.php
示例5: indexAction
/**
* 管理
*/
public function indexAction()
{
$iframe = $this->get('iframe') ? 1 : 0;
$dir = $this->get('dir') ? base64_decode($this->get('dir')) : '';
$dir = substr($dir, 0, 1) == '/' ? substr($dir, 1) : $dir;
$dir = str_replace('//', '/', $dir);
if ($this->checkFileName($dir)) {
$this->adminMsg(lang('m-con-20'));
}
$list = array();
if ($this->isPostForm()) {
$name = $this->post('kw');
if (empty($name)) {
$this->adminMsg(lang('a-att-31'));
}
if ($this->checkFileName($name)) {
$this->adminMsg(lang('m-con-20'));
}
$dir = '';
$data = $this->getfiles($this->dir, $name);
} else {
$data = file_list::get_file_list($this->dir . $dir);
}
if ($data) {
foreach ($data as $t) {
if ($t == 'index.html') {
continue;
}
$path = $dir . $t . '/';
$ext = is_dir($this->dir . $path) ? 'dir' : strtolower(trim(substr(strrchr($t, '.'), 1, 10)));
$ico = file_exists(basename(VIEW_DIR) . '/admin/images/ext/' . $ext . '.gif') ? $ext . '.gif' : $ext . '.png';
$fileinfo = array();
if (is_file($this->dir . $dir . $t)) {
$file = $this->dir . $dir . $t;
$fileinfo = array('path' => $file, 'time' => date(TIME_FORMAT, filemtime($file)), 'size' => formatFileSize(filesize($file)), 'ext' => $ext);
}
$list[] = array('name' => $t, 'dir' => base64_encode($path), 'path' => $this->dir . $path, 'ico' => $ico, 'isimg' => in_array($ext, array('gif', 'jpg', 'png', 'jpeg', 'bmp')) ? 1 : 0, 'isdir' => is_dir($this->dir . $path) ? 1 : 0, 'fileinfo' => $fileinfo, 'url' => is_dir($this->dir . $path) ? url('admin/attachment/index', array('dir' => base64_encode($path), 'iframe' => $iframe)) : '');
}
}
$this->view->assign(array('dir' => $this->dir . $dir, 'istop' => $dir ? 1 : 0, 'pdir' => url('admin/attachment/index', array('dir' => base64_encode(str_replace(basename($dir), '', $dir)), 'iframe' => $iframe)), 'list' => $list, 'iframe' => $iframe));
$this->view->display('admin/attachment_list');
}
开发者ID:rainbow88,项目名称:hummel,代码行数:45,代码来源:AttachmentController.php
示例6: getFileListInDirEx
public static function getFileListInDirEx($dir)
{
$fileList = array();
$d = dir($dir);
if (is_object($d)) {
//echo "Handle: " . $d->handle . "\n";
//echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
if ($entry != '..' && $entry != '.' && is_file($dir . $entry)) {
$pathFileName = $dir . $entry;
$arrTmp['fullpath'] = $pathFileName;
$arrTmp['name'] = $entry;
$arrTmp['size'] = formatFileSize(filesize($pathFileName));
$arrTmp['cdate'] = date('Y-m-d H:i:s', filemtime($pathFileName));
//$fileList[$dir.$entry] = $entry;
$fileList[$pathFileName] = $arrTmp;
}
//echo $entry."\n";
}
$d->close();
}
return $fileList;
}
开发者ID:uwitec,项目名称:outbuying,代码行数:23,代码来源:Files.php
示例7: makefile
function makefile($fileid, $statichtml = 0)
{
global $DMC, $DBPrefix, $strDownFile, $strDownFile1, $strDownFile2, $strPlayMusic, $strOnlinePlay, $strOnlineStop, $strDownload, $strRightBtnSave, $settingInfo;
$kkstr = "";
$dataInfo = $DMC->fetchArray($DMC->query("select id,name,attTitle,downloads,fileSize,fileWidth,fileHeight from " . $DBPrefix . "attachments where id='{$fileid}' or name='{$fileid}'"));
if (is_array($dataInfo)) {
$fileType = strtolower(substr($dataInfo['name'], strrpos($dataInfo['name'], ".") + 1));
if (in_array($fileType, array('wma', 'mp3', 'rm', 'ra', 'qt', 'wmv', 'swf', 'flv', 'mpg', 'avi', 'divx', 'asf', 'rmvb'))) {
$fid = "media" . validCode(4);
if (strpos($dataInfo['name'], "://") < 1) {
$dataInfo['name'] = "attachments/" . $dataInfo['name'];
}
if (strpos(";{$settingInfo['ajaxstatus']};", "M") < 1) {
$intWidth = $dataInfo['fileWidth'] == 0 ? 400 : $dataInfo['fileWidth'];
$intHeight = $dataInfo['fileHeight'] == 0 ? 300 : $dataInfo['fileHeight'];
$kkstr .= "<div class=\"UBBPanel\">";
$kkstr .= "<div class=\"UBBTitle\"><img src=\"images/music.gif\" alt=\"\" style=\"margin:0px 2px -3px 0px\" border=\"0\"/>{$strPlayMusic} -- " . $dataInfo['attTitle'];
$kkstr .= "</div>";
$kkstr .= "<div class=\"UBBContent\">";
$kkstr .= "<a id=\"" . $fid . "_href\" href=\"javascript:MediaShow('" . $fileType . "','{$fid}','" . $dataInfo['name'] . "','{$intWidth}','{$intHeight}','{$strOnlinePlay}','{$strOnlineStop}')\">";
$kkstr .= "<img name=\"" . $fid . "_img\" src=\"images/mm_snd.gif\" style=\"margin:0px 3px -2px 0px\" border=\"0\" alt=\"\"/>";
$kkstr .= "<span id=\"" . $fid . "_text\">{$strOnlinePlay}</span></a><div id=\"" . $fid . "\">";
$kkstr .= "</div></div></div>";
} else {
$kkstr .= "<div class=\"UBBPanel\">";
$kkstr .= "<div class=\"UBBTitle\"><img src=\"images/music.gif\" alt=\"\" style=\"margin:0px 2px -3px 0px\" border=\"0\"/>{$strPlayMusic} -- " . $dataInfo['attTitle'];
$kkstr .= "</div>";
$kkstr .= "<div class=\"UBBContent\">";
$kkstr .= "<a id=\"" . $fid . "_href\" href=\"javascript:void(0)\" onclick=\"javascript:f2_ajax_media('f2blog_ajax.php?ajax_display=media&media={$fid}&id={$dataInfo['id']}','{$fid}','{$strOnlinePlay}','{$strOnlineStop}')\">";
$kkstr .= "<img name=\"" . $fid . "_img\" src=\"images/mm_snd.gif\" style=\"margin:0px 3px -2px 0px\" border=\"0\" alt=\"\"/>";
$kkstr .= "<span id=\"" . $fid . "_text\">{$strOnlinePlay}</span></a><div id=\"" . $fid . "\" style=\"display:none;\">";
$kkstr .= "</div></div></div>";
}
} else {
if ($statichtml == 1) {
//静态页面
$kkstr .= "<img src=\"images/download.gif\" alt=\"{$strDownFile}\" style=\"margin:0px 2px -4px 0px\"/><a href=\"download.php?id=" . $dataInfo['id'] . "\">" . $dataInfo['attTitle'] . "</a> (" . formatFileSize($dataInfo['fileSize']) . " ,{$strDownFile1}<?php echo !empty(\$cachedownload['" . $dataInfo['id'] . "'])?\$cachedownload['" . $dataInfo['id'] . "']:'0'?>{$strDownFile2})";
} else {
$dataInfo['downloads'] = $dataInfo['downloads'] != "" ? $dataInfo['downloads'] : "0";
$kkstr .= "<img src=\"images/download.gif\" alt=\"{$strDownFile}\" style=\"margin:0px 2px -4px 0px\"/><a href=\"download.php?id=" . $dataInfo['id'] . "\">" . $dataInfo['attTitle'] . "</a> (" . formatFileSize($dataInfo['fileSize']) . " , {$strDownFile1}" . $dataInfo['downloads'] . "{$strDownFile2})";
}
}
}
return $kkstr;
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:45,代码来源:function.php
示例8: fileinfoAction
/**
* 文件信息查看
*/
public function fileinfoAction()
{
$file = $this->post('file');
//文件
if ($file && is_file($file)) {
echo lang('a-att-6') . ':' . $file . '<br>' . lang('a-att-7') . ':' . date(TIME_FORMAT, @filemtime($file)) . '<br>' . lang('a-att-8') . ':' . formatFileSize(filesize($file)) . ' <a href="' . $file . '" target=_blank>' . lang('a-att-10') . '</a>';
} else {
echo '<a href="' . $file . '" target=_blank>' . $file . '</a>';
}
}
开发者ID:rainbow88,项目名称:hummel,代码行数:13,代码来源:ApiController.php
示例9: attachmentAction
/**
* 附件管理
*/
public function attachmentAction()
{
$dir = urldecode($this->get('dir'));
$type = $this->get('type');
$mdir = 'uploadfiles/member/' . $this->memberinfo['id'] . '/';
//会员附件目录
$mdir = $type == 1 ? $mdir . 'file/' : $mdir . 'image/';
if ($this->checkFileName($dir)) {
$this->memberMsg(lang('m-con-20'), url('member/content/attachment', array('type' => $type)));
}
$dir = substr($dir, 0, 1) == '/' ? substr($dir, 1) : $dir;
$data = file_list::get_file_list($mdir . $dir . '/');
$list = array();
if ($data) {
foreach ($data as $t) {
$path = $mdir . $dir . '/' . $t;
$ext = is_dir($path) ? 'dir' : strtolower(trim(substr(strrchr($t, '.'), 1, 10)));
$ico = file_exists(basename(VIEW_DIR) . '/admin/images/ext/' . $ext . '.gif') ? $ext . '.gif' : $ext . '.png';
$info = array();
if (is_file($path)) {
if (strpos($t, '.thumb.') !== false) {
continue;
}
$info = array('ext' => $ext, 'path' => $path, 'time' => date('Y-m-d H:i:s', filemtime($path)), 'size' => formatFileSize(filesize($path), 2));
}
$list[] = array('dir' => urlencode($dir . '/' . $t), 'ico' => $ico, 'url' => is_dir($path) ? url('member/content/attachment', array('dir' => urlencode($dir . '/' . $t), 'type' => $type)) : '', 'name' => $t, 'path' => $path, 'info' => $info, 'isimg' => in_array($ext, array('gif', 'jpg', 'png', 'jpeg', 'bmp')) ? 1 : 0, 'isdir' => is_dir($path) ? 1 : 0);
}
}
$this->view->assign(array('dir' => $dir, 'type' => $type, 'list' => $list, 'pdir' => url('member/content/attachment', array('dir' => urlencode(str_replace(basename($dir), '', $dir)), 'type' => $type)), 'istop' => $dir ? 1 : 0, 'countsize' => formatFileSize(count_member_size($this->memberinfo['id'], $type == 1 ? 'file' : 'image'), 2), 'meta_title' => lang('m-con-5') . '-' . lang('member') . '-' . $this->site['SITE_NAME']));
$this->view->display('member/attachment');
}
开发者ID:rainbow88,项目名称:hummel,代码行数:34,代码来源:ContentController.php
示例10: makeFormElement
/**
* @return string HTML code for image form element.
* @param int $id Image ID.
* @param array $element_params
* @desc Make image form element
*/
function makeFormElement($id=null, $element_params=null) {
GLOBAL $parser;
GLOBAL $db;
$tpl = &$parser->tpl;
$this->init($parser,$id);
if ($this->isNew()) {
// create thumbnails
foreach ($this->image['images'] as $key=>$params) {
if ($key!=0) {
$tpl->setCurrentBlock('new_thumbnail');
$tpl->setVariable(array(
'NAME' => $this->field_name.'_'.$key,
'THUMBNAIL_NAME' => $params['name'],
'THUMBNAIL_WIDTH' => $params['width'],
'THUMBNAIL_HEIGHT' => $params['height']
));
$tpl->parseCurrentBlock();
}
}
// create original
$tpl->setCurrentBlock('new');
$tpl->setVariable(array(
'NAME' => $this->field_name.'_0',
'IMG_NAME' => $this->field_name
));
$tpl->parseCurrentBlock();
} else {
// create thumbnails
foreach ($this->image[images] as $key=>$params) {
if ($key!=0) {
$file_name = $this->path.$this->id.'_'.$key;
$http_file_name = HTTP_ROOT.$this->root_path.$this->id.'_'.$key;
if (file_exists($file_name)) {
// if thumbnail exists
$thumbnail_info = getimagesize($file_name);
$tpl->setCurrentBlock('update_thumbnail');
$tpl->setVariable(array(
'THUMBNAIL_NAME' => $params[name],
'THUMBNAIL_W' => $thumbnail_info[0],
'THUMBNAIL_H' => $thumbnail_info[1],
'THUMBNAIL_FILE_NAME' => $http_file_name,
'EDITORS_PATH' => 'editors/',
'ID' => $this->id,
'KEY' => $key,
'IMAGE_NAME' => $this->image_name
));
$tpl->parseCurrentBlock();
} else {
// if thumbnail NOT exists
}
}
}
$thumbnail_file_name = $this->path.$this->id.'_t';
$thumbnail_http_file_name = HTTP_ROOT.$this->root_path.$this->id.'_t';
$original_thumbnail_info = getimagesize($thumbnail_file_name);
$original_file_name = $this->path.$this->id.'_0';
$original_info = getimagesize($original_file_name);
$file_size = filesize($original_file_name);
$tpl->parseVariable(array(
'NAME' => $this->field_name.'_0',
'IMAGE_FILE_DELETE' => 'is_delete',
'APPLY_TO_THUMBNAILS' => 'apply_to_thumbnails',
'ORIGINAL_THUMBNAIL_SRC' => $thumbnail_http_file_name,
'ORIGINAL_THUMBNAIL_INFO' => $original_thumbnail_info[3],
'TIMESTAMP' => time(),
'IMAGE_SRC' => $this->path.$this->id,
'IMAGE_TYPE' => strtolower(imageGetTypeName($original_info[2])),
'IMAGE_W' => $original_info[0],
'IMAGE_H' => $original_info[1],
'IMAGE_FILE_SIZE' => formatFileSize($file_size),
'IMG_NAME' => $this->field_name,
'EDITORS_PATH' => 'editors/',
'ID' => $this->id,
'KEY' => '0',
'IMAGE_NAME' => $this->image_name
// 'FILENAME' => str_replace(SYS_ROOT,'',$file_name)
),'update');
}
return trim($tpl->get());
}
开发者ID:naffis,项目名称:rejectmail-php,代码行数:98,代码来源:image.type.php
示例11: array
$sizes = array();
$bknums = array();
$shares = array();
$cssClasses = array();
$i = 0;
$params = array();
foreach ($data as $entry) {
$param = array('host' => $_GET['host'], 'backupnum' => $entry['backupnum'], 'sharename' => $entry['sharename'], 'dir' => $entry['filepath']);
if ($entry['type'] == 'd') {
$sizes[] = '';
$name = '<a href="#" onclick="BrowseDir(\'' . $entry['filepath'] . '\')">' . $entry['filename'] . "</a>";
$cssClasses[] = 'folder';
$params['isdir'] = '1';
//$viewVersionsActions[] = $emptyAction;
} else {
$sizes[] = formatFileSize($entry['filesize']);
$param_str = "host=" . $_GET['host'] . "&backupnum=" . $entry['backupnum'] . "&sharename=" . urlencode($entry['sharename']);
$param_str .= "&dir=" . urlencode($entry['filepath']);
$name = '<a href="#" onclick="RestoreFile(\'' . $param_str . '\')">' . $entry['filename'] . "</a>";
$cssClasses[$i] = 'file';
//$viewVersionsActions[] = $viewVersionsAction;
}
$i++;
$names[] = $name;
$params[] = $param;
}
$count = count($data);
$n = new OptimizedListInfos($names, _T('File', 'backuppc'));
$n->disableFirstColumnActionLink();
$n->addExtraInfo($sizes, _T("Size", "backuppc"));
$n->setMainActionClasses($cssClasses);
开发者ID:sebastiendu,项目名称:mmc,代码行数:31,代码来源:ajaxFileSearch.php
示例12: substr
break;
}
}
$ActionMessage = substr($str, 1) . " {$strCacheTitle}{$strUpdate}{$strSuccess}";
$action = "";
}
$edit_url = "{$PHP_SELF}";
//查找连接
if ($action == "") {
// 查找
$title = "{$strCacheTitle}";
$cachedb = array();
foreach ($cacheArr as $name => $desc) {
$filepath = F2BLOG_ROOT . "cache/cache_" . $name . '.php';
if (is_file($filepath)) {
$cachefile['name'] = $name;
$cachefile['desc'] = $desc;
$cachefile['size'] = formatFileSize(filesize($filepath));
$cachefile['mtime'] = format_time("L", filemtime($filepath));
$cachedb[] = $cachefile;
} else {
$cachefile['name'] = $name;
$cachefile['desc'] = $desc;
$cachefile['size'] = " ";
$cachefile['mtime'] = " ";
$cachedb[] = $cachefile;
}
}
unset($cachefile);
include "cache_list.inc.php";
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:cache.php
示例13: foreach
<th>Filename</th>
<th>File Size</th>
<th>Date Modified</th>
<th>Backup</th>
</tr>
</thead>
<?php
$banners = $concept[banners];
if (file_exists($base_url)) {
foreach ($banners as $key => $banner) {
// gets all the banner info
$bannerName = formatDisplayName($banner[banner_name]);
$bannerZipFile = $base_url . $banner[banner_base_name] . ".zip";
$bannerHtmlFile = getHtmlFile($base_url . $banner[banner_base_name]);
$bannerFileSize = formatFileSize(filesize($bannerZipFile));
$bannerDateModified = formatDate(filemtime($bannerZipFile));
$bannerBackup = $base_url . $banner[banner_base_name] . ".jpg";
?>
<tr>
<!-- thumbnail -->
<td class="backup-thumbnail"><a href="<?php
echo $bannerHtmlFile;
?>
" target="_blank"><img src="<?php
echo $bannerBackup;
?>
" alt=""></a></td>
<!-- filename -->
<td><a href="<?php
echo $bannerHtmlFile;
开发者ID:AdrianSane,项目名称:Projects,代码行数:31,代码来源:index.php
示例14: renderCell
function renderCell($cell)
{
switch ($cell['realm']) {
case 'user':
echo "<table class='slbcell vscell'><tr><td rowspan=3 width='5%'>";
printImageHREF('USER');
echo '</td><td>' . mkA($cell['user_name'], 'user', $cell['user_id']) . '</td></tr>';
if (strlen($cell['user_realname'])) {
echo "<tr><td><strong>" . niftyString($cell['user_realname']) . "</strong></td></tr>";
} else {
echo "<tr><td class=sparenetwork>no name</td></tr>";
}
echo '<td>';
if (!isset($cell['etags'])) {
$cell['etags'] = getExplicitTagsOnly(loadEntityTags('user', $cell['user_id']));
}
echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : ' ';
echo "</td></tr></table>";
break;
case 'file':
echo "<table class='slbcell vscell'><tr><td rowspan=3 width='5%'>";
switch ($cell['type']) {
case 'text/plain':
printImageHREF('text file');
break;
case 'image/jpeg':
case 'image/png':
case 'image/gif':
printImageHREF('image file');
break;
default:
printImageHREF('empty file');
break;
}
echo "</td><td>";
echo mkA('<strong>' . niftyString($cell['name']) . '</strong>', 'file', $cell['id']);
echo "</td><td rowspan=3 valign=top>";
if (isset($cell['links']) and count($cell['links'])) {
printf("<small>%s</small>", serializeFileLinks($cell['links']));
}
echo "</td></tr><tr><td>";
echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : ' ';
echo '</td></tr><tr><td>';
if (isolatedPermission('file', 'download', $cell)) {
// FIXME: reuse renderFileDownloader()
echo "<a href='?module=download&file_id={$cell['id']}'>";
printImageHREF('download', 'Download file');
echo '</a> ';
}
echo formatFileSize($cell['size']);
echo "</td></tr></table>";
break;
case 'ipv4vs':
case 'ipvs':
case 'ipv4rspool':
renderSLBEntityCell($cell);
break;
case 'ipv4net':
case 'ipv6net':
echo "<table class='slbcell vscell'><tr><td rowspan=3 width='5%'>";
printImageHREF('NET');
echo '</td><td>' . mkA("{$cell['ip']}/{$cell['mask']}", $cell['realm'], $cell['id']);
echo getRenderedIPNetCapacity($cell);
echo '</td></tr>';
echo "<tr><td>";
if (strlen($cell['name'])) {
echo "<strong>" . niftyString($cell['name']) . "</strong>";
} else {
echo "<span class=sparenetwork>no name</span>";
}
// render VLAN
renderNetVLAN($cell);
echo "</td></tr>";
echo '<tr><td>';
echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : ' ';
echo "</td></tr></table>";
break;
case 'rack':
echo "<table class='slbcell vscell'><tr><td rowspan=3 width='5%'>";
$thumbwidth = getRackImageWidth();
$thumbheight = getRackImageHeight($cell['height']);
echo "<img border=0 width={$thumbwidth} height={$thumbheight} title='{$cell['height']} units' ";
echo "src='?module=image&img=minirack&rack_id={$cell['id']}'>";
echo "</td><td>";
echo mkA('<strong>' . niftyString($cell['name']) . '</strong>', 'rack', $cell['id']);
echo "</td></tr><tr><td>";
echo niftyString($cell['comment']);
echo "</td></tr><tr><td>";
echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : ' ';
echo "</td></tr></table>";
break;
case 'location':
echo "<table class='slbcell vscell'><tr><td rowspan=3 width='5%'>";
printImageHREF('LOCATION');
echo "</td><td>";
echo mkA('<strong>' . niftyString($cell['name']) . '</strong>', 'location', $cell['id']);
echo "</td></tr><tr><td>";
echo niftyString($cell['comment']);
echo "</td></tr><tr><td>";
echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : ' ';
//.........这里部分代码省略.........
开发者ID:xtha,项目名称:salt,代码行数:101,代码来源:interface.php
示例15: formatFileSize
<tr>
<td colspan="3" background="images/content/dotted_attach.gif"></td>
</tr>
<tr>
<td height="31" align="center"> <img src="images/content/AlignFree.gif" onclick="insert_file('F')" alt="<?php
echo $strSelFilFree;
?>
"/> </td>
<td align="center"> <img src="images/content/attachDown.gif" onClick="Javascript:onclick_download()" alt="<?php
echo $strDownload;
?>
"/> </td>
<td align="center"> <img src="images/content/attachDel.gif" onClick="Javascript:onclick_delete(this.form)" alt="<?php
echo $strDelete;
?>
"/> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<?php
echo $strAttType . "<font color=red>" . $cfg_upload_file . "</font><br>" . $strAttachmentsError1 . "<font color=red>" . formatFileSize($cfg_upload_size) . "</font><br>";
?>
<input name="attfile" class="filebox" type="file" style="font-size: 9pt; height:24px" onchange="Javascript:onclick_update(this.form)" size="50"/>
</td>
</tr>
</table>
</form>
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:30,代码来源:attach.php
示例16: indexcAction
/**
* 生成首页
*/
public function indexcAction()
{
ob_start();
$this->view->assign(array('indexc' => 1, 'meta_title' => $this->site['SITE_TITLE'], 'meta_keywords' => $this->site['SITE_KEYWORDS'], 'meta_description' => $this->site['SITE_DESCRIPTION']));
$this->view->setTheme(true);
$this->view->display('index');
$this->view->setTheme(false);
$sites = App::get_site();
if (count($sites) > 1) {
$size = file_put_contents(APP_ROOT . 'cache/index/' . $this->siteid . '.html', ob_get_clean(), LOCK_EX);
@unlink(APP_ROOT . 'index.html');
} else {
$size = file_put_contents(APP_ROOT . 'index.html', ob_get_clean(), LOCK_EX);
}
$this->adminMsg(lang('a-con-107') . '(' . formatFileSize($size) . ')', '', 3, 1, 1);
}
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:19,代码来源:HtmlController.php
示例17: foreach
$uploads = $SOUP->get('uploads');
$id = $SOUP->get('id', 'editUploads');
?>
<script type="text/javascript">
$(document).ready(function(){
$('#<?php
echo $id;
?>
input.delete').click(function(){
var li = $(this).parent();
var id = $(li).attr('id').slice(7); // file-
var deleted = $('<input type="hidden" name="deleted['+id+']" value="'+id+'" />');
$(li).append(deleted);
$(li).fadeOut();
});
});
</script>
<div id="<?php
echo $id;
?>
">
<?php
if (!empty($uploads)) {
echo '<ul class="segmented-list uploads">';
foreach ($uploads as $u) {
echo '<li id="delete-' . $u->getID() . '">';
echo '<input type="button" class="delete" value="Delete" />';
echo '<a href="' . $u->getDownloadURL() . '">' . $u->getOriginalName() . '</a> (' . formatFileSize($u->getSize()) . ')';
echo '</li>';
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:editUploads.tpl.php
示例18: formatEventDetails
function formatEventDetails($event)
{
$details = '';
switch ($event->getEventTypeID()) {
case 'edit_update_uploads':
case 'edit_task_uploads':
$addedIDs = explode(',', $event->getData2());
$added = '';
foreach ($addedIDs as $a) {
if ($a == '') {
continue;
}
// skip blanks
$upload = Upload::load($a);
$added .= $upload->getOriginalName() . ' (' . formatFileSize($upload->getSize()) . ')<br /><br />';
}
if (!empty($added)) {
$details .= '<ins>' . $added . '</ins>';
}
$deletedIDs = explode(',', $event->getData1());
$deleted = '';
foreach ($deletedIDs as $d) {
if ($d == '') {
continue;
}
// skip blanks
$upload = Upload::load($d);
$deleted .= $upload->getOriginalName() . ' (' . formatFileSize($upload->getSize()) . ')<br /><br />';
}
if (!empty($deleted)) {
$details .= '<del>' . $deleted . '</del>';
}
break;
case 'edit_pitch':
case 'edit_specs':
case 'edit_rules':
case 'edit_task_description':
case 'edit_update_message':
$from = $event->getData1();
$to = $event->getData2();
$from = str_replace(' ', '<br />', $from);
$to = str_replace(' ', '<br />', $to);
$diff = new FineDiff($from, $to);
$htmlDiff = $diff->renderDiffToHTML();
$htmlDiff = html_entity_decode($htmlDiff, ENT_QUOTES, 'UTF-8');
$htmlDiff = html_entity_decode($htmlDiff, ENT_QUOTES, 'UTF-8');
$details .= $htmlDiff;
break;
case 'edit_task_title':
case 'edit_update_title':
$from = $event->getData1();
$to = $event->getData2();
$diff = new FineDiff($from, $to);
$htmlDiff = $diff->renderDiffToHTML();
$htmlDiff = html_entity_decode($htmlDiff, ENT_QUOTES, 'UTF-8');
$htmlDiff = html_entity_decode($htmlDiff, ENT_QUOTES, 'UTF-8');
$details .= $htmlDiff;
break;
case 'edit_task_leader':
$details .= 'Old Leader: <del>' . formatUserLink($event->getUser1ID(), $event->getProjectID()) . '</del><br /><br />';
$details .= 'New Leader: <ins>' . formatUserLink($event->getUser2ID(), $event->getProjectID()) . '</ins>';
break;
case 'edit_task_num_needed':
$old = $event->getData1() != null ? $event->getData1() : '∞';
$new = $event->getData2() != null ? $event->getData2() : '∞';
$details .= 'Old: <del>' . $old . '</del> people needed<br /><br />';
$details .= 'New: <ins>' . $new . '</ins> people needed';
break;
case 'edit_task_deadline':
case 'edit_project_deadline':
$old = $event->getData1() != null ? formatTimeTag($event->getData1()) : '(none)';
$new = $event->getData2() != null ? formatTimeTag($event->getData2()) : '(none)';
$details .= 'Old Deadline: <del>' . $old . '</del><br /><br />';
$details .= 'New Deadline: <ins>' . $new . '</ins>';
break;
case 'edit_project_status':
$old = formatProjectStatus($event->getData1());
$new = formatProjectStatus($event->getData2());
$details .= 'Old Project Status: <del>' . $old . '</del><br /><br />';
$details .= 'New Project Status: <ins>' . $new . '</ins>';
break;
case 'edit_accepted_status':
$old = formatAcceptedStatus($event->getData1());
$new = formatAcceptedStatus($event->getData2());
$details .= 'Old Status: <del>' . $old . '</del><br /><br />';
$details .= 'New Status: <ins>' . $new . '</ins>';
break;
case 'create_task_comment':
case 'create_task_comment_reply':
case 'create_update_comment':
case 'create_update_comment_reply':
$details .= formatComment($event->getData1());
break;
case 'create_discussion':
$details .= '<strong>' . $event->getData1() . '</strong><br /><br />';
$details .= formatDiscussionReply($event->getData2());
break;
case 'create_discussion_reply':
$details .= formatDiscussionReply($event->getData1());
break;
//.........这里部分代码省略.........
开发者ID:malimu,项目名称:Pipeline,代码行数:101,代码来源:formatEvents.php
|
请发表评论