mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
make all functions static
This commit is contained in:
parent
b07869a3bb
commit
72e01f99e4
|
@ -25,25 +25,25 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Core_File {
|
||||
function renameFile($old, $new) { /* {{{ */
|
||||
static function renameFile($old, $new) { /* {{{ */
|
||||
return @rename($old, $new);
|
||||
} /* }}} */
|
||||
|
||||
function removeFile($file) { /* {{{ */
|
||||
static function removeFile($file) { /* {{{ */
|
||||
return @unlink($file);
|
||||
} /* }}} */
|
||||
|
||||
function copyFile($source, $target) { /* {{{ */
|
||||
static function copyFile($source, $target) { /* {{{ */
|
||||
return @copy($source, $target);
|
||||
} /* }}} */
|
||||
|
||||
function moveFile($source, $target) { /* {{{ */
|
||||
static function moveFile($source, $target) { /* {{{ */
|
||||
if (!@copyFile($source, $target))
|
||||
return false;
|
||||
return @removeFile($source);
|
||||
} /* }}} */
|
||||
|
||||
function fileSize($file) { /* {{{ */
|
||||
static function fileSize($file) { /* {{{ */
|
||||
if(!$a = fopen($file, 'r'))
|
||||
return false;
|
||||
fseek($a, 0, SEEK_END);
|
||||
|
@ -52,12 +52,12 @@ class SeedDMS_Core_File {
|
|||
return $filesize;
|
||||
} /* }}} */
|
||||
|
||||
function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
if ($size == 0) return('0 Bytes');
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
} /* }}} */
|
||||
|
||||
function parse_filesize($str) { /* {{{ */
|
||||
static function parse_filesize($str) { /* {{{ */
|
||||
preg_replace('/\s\s+/', ' ', $str);
|
||||
if(strtoupper(substr($str, -1)) == 'B') {
|
||||
$value = (int) substr($str, 0, -2);
|
||||
|
@ -83,15 +83,15 @@ class SeedDMS_Core_File {
|
|||
return false;
|
||||
} /* }}} */
|
||||
|
||||
function checksum($file) { /* {{{ */
|
||||
static function checksum($file) { /* {{{ */
|
||||
return md5_file($file);
|
||||
} /* }}} */
|
||||
|
||||
function renameDir($old, $new) { /* {{{ */
|
||||
static function renameDir($old, $new) { /* {{{ */
|
||||
return @rename($old, $new);
|
||||
} /* }}} */
|
||||
|
||||
function makeDir($path) { /* {{{ */
|
||||
static function makeDir($path) { /* {{{ */
|
||||
|
||||
if( !is_dir( $path ) ){
|
||||
$res=@mkdir( $path , 0777, true);
|
||||
|
@ -146,7 +146,7 @@ class SeedDMS_Core_File {
|
|||
*/
|
||||
} /* }}} */
|
||||
|
||||
function removeDir($path) { /* {{{ */
|
||||
static function removeDir($path) { /* {{{ */
|
||||
$handle = @opendir($path);
|
||||
while ($entry = @readdir($handle) )
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ class SeedDMS_Core_File {
|
|||
return @rmdir($path);
|
||||
} /* }}} */
|
||||
|
||||
function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||
if (mkdir($targetPath, 0777)) {
|
||||
$handle = @opendir($sourcePath);
|
||||
while ($entry = @readdir($handle) ) {
|
||||
|
@ -189,14 +189,14 @@ class SeedDMS_Core_File {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||
if (!copyDir($sourcePath, $targetPath))
|
||||
return false;
|
||||
return removeDir($sourcePath);
|
||||
} /* }}} */
|
||||
|
||||
// code by Kioob (php.net manual)
|
||||
function gzcompressfile($source,$level=false) { /* {{{ */
|
||||
static function gzcompressfile($source,$level=false) { /* {{{ */
|
||||
$dest=$source.'.gz';
|
||||
$mode='wb'.$level;
|
||||
$error=false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user