本文整理汇总了PHP中CUtils::getFileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtils::getFileSize方法的具体用法?PHP CUtils::getFileSize怎么用?PHP CUtils::getFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtils
的用法示例。
在下文中一共展示了CUtils::getFileSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStatic
public function getStatic()
{
global $PRJ_REF;
$ret = '';
if ($this->dbValue) {
$ret = '<a href="' . $PRJ_REF . $this->dbValue . '">' . $this->dbValue . '</a> (' . CUtils::getFileSize($this->dbValue) . ')';
}
return $ret;
}
示例2: getStatic
public function getStatic()
{
global $PRJ_REF;
$ret = '';
if ($this->dbValue) {
$path = pathinfo($this->dbValue);
$ret = $path['basename'] . ' ' . CUtils::getFileSize($this->dbValue);
}
return $ret;
}
示例3: smarty_function_raFInfo
/**
* Smarty {raFInfo} function plugin
*
* Type: function<br>
* Name: raFInfo<br>
* @author Roman Alyakrytskiy
* @param array
* @param Smarty
* @return array
*/
function smarty_function_raFInfo($params, &$smarty)
{
if (!isset($params['file'])) {
$smarty->trigger_error('raFInfo: Не указан параметр: file');
} elseif (!isset($params['var'])) {
$smarty->trigger_error('raFInfo: Не указан параметр: var');
} else {
$ipath = pathinfo($params['file']);
$smarty->assign($params['var'], array('ext' => $ipath['extension'], 'size' => CUtils::getFileSize($params['file'])));
}
}
示例4: getStatic
public function getStatic()
{
global $PRJ_REF;
$photo = $this->dbValue;
$width = '';
$extra_text = '';
if (isset($this->props['sizes'])) {
if ($this->dbValue) {
$path_parts = pathinfo($this->dbValue);
$photo = $path_parts['dirname'] . '/default_' . $path_parts['basename'];
$asizes = explode(',', $this->props['sizes']);
foreach ($asizes as $k => $sz) {
$asz = explode('|', $sz);
if ($k && sizeof($asz) == 2) {
$extra_text .= ($extra_text ? ' | ' : '') . '<a target="_blank" href="' . $path_parts['dirname'] . '/' . $asz[0] . '_' . $path_parts['basename'] . '">' . $asz[1] . '</a>';
}
}
$extra_text = $extra_text ? '<span class="imageinfo">' . $extra_text . '</span>' : '';
}
} else {
$width = ' width="50"';
}
return $photo ? '<a target="_blank" href="' . $this->dbValue . '"><img ' . $width . ' border="0" src="' . $PRJ_REF . $photo . '"></a><span class="imageinfo">(' . CUtils::getFileSize($this->dbValue) . ')</span>' . $extra_text : '';
}
示例5: makeArchive
function makeArchive($fD)
{
$my_time = time();
$my_key = CUtils::genKey(8);
$objResponse = new xajaxResponse();
$objResponse->assign("archive_info", 'innerHTML', '');
$filename = 'admin/backup/' . date('YmdHi', $my_time) . '_' . $my_key . '.tar.gz';
$filename_sql = 'admin/backup/' . date('YmdHi', $my_time) . '_' . $my_key . '.sql';
$filename_sql2 = 'admin/backup/' . date('YmdHi', $my_time) . '_' . $my_key . '_after_connect.sql';
$f = fopen($GLOBALS['PRJ_DIR'] . '/' . $filename_sql2, "a");
fwrite($f, "/*!41000 SET NAMES 'cp1251' */;");
fclose($f);
set_time_limit(0);
$GLOBALS['db']->backupDB($filename_sql);
inc_lib('tools/CArchive.php');
$test = new gzip_file($filename);
$test->set_options(array('basedir' => $GLOBALS['PRJ_DIR'] . '/', 'overwrite' => 1, 'level' => 5));
$test->add_files(array("*.*"));
//$test->exclude_files(array("admin/lib/templates_c/*.php", "*.gz"));
$cfiles = 0;
$sfiles = 0;
foreach ($test->files as $key => $current) {
if (stristr($current['name'], '.tar.gz')) {
unset($test->files[$key]);
} else {
$sfiles += $current['stat'][7];
$cfiles++;
}
}
$test->create_archive();
$text = '';
$text .= 'Количество файлов: ' . $cfiles;
$text .= '<br>';
$text .= 'Размер неупакованых файлов: ' . CUtils::getSize($sfiles, 2);
$text .= '<br>';
$text .= 'Размер архива: ' . CUtils::getFileSize('/' . $filename, 2);
//$text = 'test';
@unlink($GLOBALS['PRJ_DIR'] . '/' . $filename_sql);
@unlink($GLOBALS['PRJ_DIR'] . '/' . $filename_sql2);
$objResponse->assign("archive_info", 'innerHTML', $text);
$objResponse->script("hideDiv('waiting');window.location.reload()");
return $objResponse;
}