PHP Class Files

Inheritance: extends Controller
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Méthode Description
copyFile ( string $source, string $destination_dir, string $destination_file, boolean $unique = true ) : string 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.
createFolder ( string $newFolder ) : boolean Create a new folder.
delFile ( string $file ) : boolean Delete a file.
delFolder ( string $folder, boolean $recursive = false ) : boolean Delete folder(s), can delete recursively.
escape ( string $filename ) : string Escape the filenames, any non-word characters will be replaced by an underscore.
fixPath ( string $path ) : string Append a / to the path if required.
formatSize ( integer $size ) : string Format the file size, limits to Mb.
makeFile ( string $pathA, string $pathB ) : string Similar to makePath, but the second parameter is not only a path, it may contain say a file ending.
makePath ( string $pathA, string $pathB ) : string Concat two paths together. Basically $pathA+$pathB

Method Details

copyFile() public méthode

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.
public copyFile ( string $source, string $destination_dir, string $destination_file, boolean $unique = true ) : string
$source string where the file is from, full path to the files required
$destination_dir string where the files, just the destination dir, e.g., /www/html/gallery/
$destination_file string name of the new file, just the filename
$unique boolean create unique destination file if true.
Résultat string the new copied filename, else error if anything goes bad.

createFolder() public méthode

Create a new folder.
public createFolder ( string $newFolder ) : boolean
$newFolder string specifiy the full path of the new folder.
Résultat boolean true if the new folder is created, false otherwise.

delFile() public méthode

Delete a file.
public delFile ( string $file ) : boolean
$file string file to be deleted
Résultat boolean true if deleted, false otherwise.

delFolder() public méthode

Delete folder(s), can delete recursively.
public delFolder ( string $folder, boolean $recursive = false ) : boolean
$folder string the folder to be deleted.
$recursive boolean 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.
Résultat boolean true if deleted.

escape() public méthode

Escape the filenames, any non-word characters will be replaced by an underscore.
public escape ( string $filename ) : string
$filename string the orginal filename
Résultat string the escaped safe filename

fixPath() public méthode

Append a / to the path if required.
public fixPath ( string $path ) : string
$path string the path
Résultat string path with trailing /

formatSize() public méthode

Format the file size, limits to Mb.
public formatSize ( integer $size ) : string
$size integer the raw filesize
Résultat string formated file size.

makeFile() public méthode

Similar to makePath, but the second parameter is not only a path, it may contain say a file ending.
public makeFile ( string $pathA, string $pathB ) : string
$pathA string the leading path
$pathB string the ending path with file
Résultat string combined file path.

makePath() public méthode

Concat two paths together. Basically $pathA+$pathB
public makePath ( string $pathA, string $pathB ) : string
$pathA string path one
$pathB string path two
Résultat string a trailing slash combinded path.