Class Files

Description

File Utilities

  • version: $Id: Files.php 26 2004-03-31 02:35:21Z Wei Zhuo $
  • author: $Author: Wei Zhuo $

Located in /plugins/ImageManager/Classes/Files.php (line 21)


	
			
Method Summary
 string copyFile (string $source, string $destination_dir, string $destination_file, [boolean $unique = true])
 boolean createFolder (string $newFolder)
 boolean delFile (string $file)
 boolean delFolder (string $folder, [boolean $recursive = false])
 string escape (string $filename)
 string fixPath (string $path)
 string formatSize (int $size)
 string makeFile (string $pathA, string $pathB)
 string makePath (string $pathA, string $pathB)
Methods
copyFile (line 35)

Copy a file from source to destination. If unique == true, then if the destination exists, it will be renamed by appending an increamenting counting number.

  • return: the new copied filename, else error if anything goes bad.
string copyFile (string $source, string $destination_dir, string $destination_file, [boolean $unique = true])
  • string $source: where the file is from, full path to the files required
  • string $destination_file: name of the new file, just the filename
  • string $destination_dir: where the files, just the destination dir, e.g., /www/html/gallery/
  • boolean $unique: create unique destination file if true.
createFolder (line 79)

Create a new folder.

  • return: true if the new folder is created, false otherwise.
boolean createFolder (string $newFolder)
  • string $newFolder: specifiy the full path of the new folder.
delFile (line 102)

Delete a file.

  • return: true if deleted, false otherwise.
boolean delFile (string $file)
  • string $file: file to be deleted
delFolder (line 118)

Delete folder(s), can delete recursively.

  • return: true if deleted.
boolean delFolder (string $folder, [boolean $recursive = false])
  • string $folder: the folder to be deleted.
  • boolean $recursive: if true, all files and sub-directories are delete. If false, tries to delete the folder, can throw error if the directory is not empty.
escape (line 92)

Escape the filenames, any non-word characters will be replaced by an underscore.

  • return: the escaped safe filename
string escape (string $filename)
  • string $filename: the orginal filename
fixPath (line 160)

Append a / to the path if required.

  • return: path with trailing /
string fixPath (string $path)
  • string $path: the path
formatSize (line 204)

Format the file size, limits to Mb.

  • return: formated file size.
string formatSize (int $size)
  • int $size: the raw filesize
makeFile (line 189)

Similar to makePath, but the second parameter is not only a path, it may contain say a file ending.

  • return: combined file path.
string makeFile (string $pathA, string $pathB)
  • string $pathA: the leading path
  • string $pathB: the ending path with file
makePath (line 174)

Concat two paths together. Basically $pathA+$pathB

  • return: a trailing slash combinded path.
string makePath (string $pathA, string $pathB)
  • string $pathA: path one
  • string $pathB: path two

Documentation generated on Sat, 31 Dec 2005 14:56:52 -0500 by phpDocumentor 1.3.0RC3