diff --git a/SeedDMS_Core/Core/inc.FileUtils.php b/SeedDMS_Core/Core/inc.FileUtils.php index abc56fb86..dc6238063 100644 --- a/SeedDMS_Core/Core/inc.FileUtils.php +++ b/SeedDMS_Core/Core/inc.FileUtils.php @@ -25,50 +25,50 @@ * @version Release: @package_version@ */ class SeedDMS_Core_File { - /** - * @param $old - * @param $new - * @return bool - */ - static function renameFile($old, $new) { /* {{{ */ + /** + * @param $old + * @param $new + * @return bool + */ + static function renameFile($old, $new) { /* {{{ */ return @rename($old, $new); } /* }}} */ - /** - * @param $file - * @return bool - */ - static function removeFile($file) { /* {{{ */ + /** + * @param $file + * @return bool + */ + static function removeFile($file) { /* {{{ */ return @unlink($file); } /* }}} */ - /** - * @param $source - * @param $target - * @return bool - */ - static function copyFile($source, $target) { /* {{{ */ + /** + * @param $source + * @param $target + * @return bool + */ + static function copyFile($source, $target) { /* {{{ */ return @copy($source, $target); } /* }}} */ - /** - * @param $source - * @param $target - * @return bool - */ - static function moveFile($source, $target) { /* {{{ */ - /** @noinspection PhpUndefinedFunctionInspection */ - if (!@copyFile($source, $target)) + /** + * @param $source + * @param $target + * @return bool + */ + static function moveFile($source, $target) { /* {{{ */ + /** @noinspection PhpUndefinedFunctionInspection */ + if (!@copyFile($source, $target)) return false; - /** @noinspection PhpUndefinedFunctionInspection */ - return @removeFile($source); + /** @noinspection PhpUndefinedFunctionInspection */ + return @removeFile($source); } /* }}} */ - /** - * @param $file - * @return bool|int - */ - static function fileSize($file) { /* {{{ */ + /** + * @param $file + * @return bool|int + */ + static function fileSize($file) { /* {{{ */ if(!$a = fopen($file, 'r')) return false; fseek($a, 0, SEEK_END); @@ -77,22 +77,22 @@ class SeedDMS_Core_File { return $filesize; } /* }}} */ - /** - * @param $size - * @param array $sizes - * @return string - */ - static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */ + /** + * @param $size + * @param array $sizes + * @return string + */ + static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */ if ($size == 0) return('0 Bytes'); - /** @noinspection PhpIllegalArrayKeyTypeInspection */ - return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]); + /** @noinspection PhpIllegalArrayKeyTypeInspection */ + return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]); } /* }}} */ - /** - * @param $str - * @return bool|int - */ - static function parse_filesize($str) { /* {{{ */ + /** + * @param $str + * @return bool|int + */ + static function parse_filesize($str) { /* {{{ */ preg_replace('/\s\s+/', ' ', $str); if(strtoupper(substr($str, -1)) == 'B') { $value = (int) substr($str, 0, -2); @@ -115,32 +115,32 @@ class SeedDMS_Core_File { return $value; break; } - /** @noinspection PhpUnreachableStatementInspection */ - return false; + /** @noinspection PhpUnreachableStatementInspection */ + return false; } /* }}} */ - /** - * @param $file - * @return string - */ - static function checksum($file) { /* {{{ */ + /** + * @param $file + * @return string + */ + static function checksum($file) { /* {{{ */ return md5_file($file); } /* }}} */ - /** - * @param $old - * @param $new - * @return bool - */ - static function renameDir($old, $new) { /* {{{ */ + /** + * @param $old + * @param $new + * @return bool + */ + static function renameDir($old, $new) { /* {{{ */ return @rename($old, $new); } /* }}} */ - /** - * @param $path - * @return bool - */ - static function makeDir($path) { /* {{{ */ + /** + * @param $path + * @return bool + */ + static function makeDir($path) { /* {{{ */ if( !is_dir( $path ) ){ $res=@mkdir( $path , 0777, true); @@ -195,11 +195,11 @@ class SeedDMS_Core_File { */ } /* }}} */ - /** - * @param $path - * @return bool - */ - static function removeDir($path) { /* {{{ */ + /** + * @param $path + * @return bool + */ + static function removeDir($path) { /* {{{ */ $handle = @opendir($path); while ($entry = @readdir($handle) ) { @@ -220,12 +220,12 @@ class SeedDMS_Core_File { return @rmdir($path); } /* }}} */ - /** - * @param $sourcePath - * @param $targetPath - * @return bool - */ - static function copyDir($sourcePath, $targetPath) { /* {{{ */ + /** + * @param $sourcePath + * @param $targetPath + * @return bool + */ + static function copyDir($sourcePath, $targetPath) { /* {{{ */ if (mkdir($targetPath, 0777)) { $handle = @opendir($sourcePath); while ($entry = @readdir($handle) ) { @@ -247,26 +247,26 @@ class SeedDMS_Core_File { return true; } /* }}} */ - /** - * @param $sourcePath - * @param $targetPath - * @return bool - */ - static function moveDir($sourcePath, $targetPath) { /* {{{ */ - /** @noinspection PhpUndefinedFunctionInspection */ - if (!copyDir($sourcePath, $targetPath)) + /** + * @param $sourcePath + * @param $targetPath + * @return bool + */ + static function moveDir($sourcePath, $targetPath) { /* {{{ */ + /** @noinspection PhpUndefinedFunctionInspection */ + if (!copyDir($sourcePath, $targetPath)) return false; - /** @noinspection PhpUndefinedFunctionInspection */ - return removeDir($sourcePath); + /** @noinspection PhpUndefinedFunctionInspection */ + return removeDir($sourcePath); } /* }}} */ // code by Kioob (php.net manual) - /** - * @param $source - * @param bool $level - * @return bool|string - */ - static function gzcompressfile($source, $level=false) { /* {{{ */ + /** + * @param $source + * @param bool $level + * @return bool|string + */ + static function gzcompressfile($source, $level=false) { /* {{{ */ $dest=$source.'.gz'; $mode='wb'.$level; $error=false;