make all functions static

This commit is contained in:
Uwe Steinmann 2014-01-28 08:11:57 +01:00
parent b07869a3bb
commit 72e01f99e4

View File

@ -25,25 +25,25 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
class SeedDMS_Core_File { class SeedDMS_Core_File {
function renameFile($old, $new) { /* {{{ */ static function renameFile($old, $new) { /* {{{ */
return @rename($old, $new); return @rename($old, $new);
} /* }}} */ } /* }}} */
function removeFile($file) { /* {{{ */ static function removeFile($file) { /* {{{ */
return @unlink($file); return @unlink($file);
} /* }}} */ } /* }}} */
function copyFile($source, $target) { /* {{{ */ static function copyFile($source, $target) { /* {{{ */
return @copy($source, $target); return @copy($source, $target);
} /* }}} */ } /* }}} */
function moveFile($source, $target) { /* {{{ */ static function moveFile($source, $target) { /* {{{ */
if (!@copyFile($source, $target)) if (!@copyFile($source, $target))
return false; return false;
return @removeFile($source); return @removeFile($source);
} /* }}} */ } /* }}} */
function fileSize($file) { /* {{{ */ static function fileSize($file) { /* {{{ */
if(!$a = fopen($file, 'r')) if(!$a = fopen($file, 'r'))
return false; return false;
fseek($a, 0, SEEK_END); fseek($a, 0, SEEK_END);
@ -52,12 +52,12 @@ class SeedDMS_Core_File {
return $filesize; 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'); if ($size == 0) return('0 Bytes');
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]); 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); preg_replace('/\s\s+/', ' ', $str);
if(strtoupper(substr($str, -1)) == 'B') { if(strtoupper(substr($str, -1)) == 'B') {
$value = (int) substr($str, 0, -2); $value = (int) substr($str, 0, -2);
@ -83,15 +83,15 @@ class SeedDMS_Core_File {
return false; return false;
} /* }}} */ } /* }}} */
function checksum($file) { /* {{{ */ static function checksum($file) { /* {{{ */
return md5_file($file); return md5_file($file);
} /* }}} */ } /* }}} */
function renameDir($old, $new) { /* {{{ */ static function renameDir($old, $new) { /* {{{ */
return @rename($old, $new); return @rename($old, $new);
} /* }}} */ } /* }}} */
function makeDir($path) { /* {{{ */ static function makeDir($path) { /* {{{ */
if( !is_dir( $path ) ){ if( !is_dir( $path ) ){
$res=@mkdir( $path , 0777, true); $res=@mkdir( $path , 0777, true);
@ -146,7 +146,7 @@ class SeedDMS_Core_File {
*/ */
} /* }}} */ } /* }}} */
function removeDir($path) { /* {{{ */ static function removeDir($path) { /* {{{ */
$handle = @opendir($path); $handle = @opendir($path);
while ($entry = @readdir($handle) ) while ($entry = @readdir($handle) )
{ {
@ -167,7 +167,7 @@ class SeedDMS_Core_File {
return @rmdir($path); return @rmdir($path);
} /* }}} */ } /* }}} */
function copyDir($sourcePath, $targetPath) { /* {{{ */ static function copyDir($sourcePath, $targetPath) { /* {{{ */
if (mkdir($targetPath, 0777)) { if (mkdir($targetPath, 0777)) {
$handle = @opendir($sourcePath); $handle = @opendir($sourcePath);
while ($entry = @readdir($handle) ) { while ($entry = @readdir($handle) ) {
@ -189,14 +189,14 @@ class SeedDMS_Core_File {
return true; return true;
} /* }}} */ } /* }}} */
function moveDir($sourcePath, $targetPath) { /* {{{ */ static function moveDir($sourcePath, $targetPath) { /* {{{ */
if (!copyDir($sourcePath, $targetPath)) if (!copyDir($sourcePath, $targetPath))
return false; return false;
return removeDir($sourcePath); return removeDir($sourcePath);
} /* }}} */ } /* }}} */
// code by Kioob (php.net manual) // code by Kioob (php.net manual)
function gzcompressfile($source,$level=false) { /* {{{ */ static function gzcompressfile($source,$level=false) { /* {{{ */
$dest=$source.'.gz'; $dest=$source.'.gz';
$mode='wb'.$level; $mode='wb'.$level;
$error=false; $error=false;