filesys
A collection of actions related to the filesystem.
Method Summary
void append2file (String $filename, String $content)
void current_dir ()
void dir_copy ( $source, $dest, [ $overwrite = false])
unknown dir_copyrelative (Strint $source, String $dest, [Boolean $overwrite = false])
Boolean file_exist (String $filename)
String fix_path (String $path)
String get_absolute_dir (String $path)
void get_contents (String $path)
void get_content_relative (String $path)
array get_directories ()
String get_extension (String $file)
void get_file (String $filename)
void get_fileasarray (String $filename)
array get_files ()
String get_relativepath (String $fromUrl, String $toUrl)
String get_relative_fromrelative (string $fromUrl, String $toUrl)
String get_relative_tocurrent (String $toUrl)
Boolean iswriteable (String $filename)
void is__writable ( $path)
void mkdir (String $dirName, [Boolean $fromCurrent = true])
void read_file (String $filename)
void rename ( $oldname, $newname)
void setfilter (Mixed $filter)
unknown unrealpath (unknown_type $start_dir, unknown_type $final_dir, [unknown_type $dirsep = DIRECTORY_SEPARATOR])
boolean writeFile (String $filename, String $content)
Methods
Constructor
* access: public
filesystem __construct (optional 0)
* optional 0: string Path - Takes the path to the working directory / file
append2file (line 460)
Appends content to an existing file If doesn't exist it attemps to create it
* access: public
void append2file (String $filename, String $content)
* String $filename
* String $content
current_dir (line 64)
Returns the current execution directory
* access: public
* example: example not found
void current_dir ()
dir_copy (line 407)
Copy a directory tree including all files
void dir_copy ( $source, $dest, [ $overwrite = false])
* $source
* $dest
* $overwrite
dir_copyrelative (line 393)
Copies a relative directory to another
unknown dir_copyrelative (Strint $source, String $dest, [Boolean $overwrite = false])
* Strint $source: - relative path to a directory
* String $dest: - relative path to destination
* Boolean $overwrite: - overwrite if exist
file_exist (line 104)
Verify if a file exist, wrapper for file_exists PHP function
* access: public
* example: example not found
Boolean file_exist (String $filename)
* String $filename
fix_path (line 139)
Verify and fix a path to end always with a slash
* access: public
* example: example not found
String fix_path (String $path)
* String $path
get_absolute_dir (line 258)
Returns the real path of a directory like C:/bla/bla
* return: Absolute path
* example: example not found
String get_absolute_dir (String $path)
* String $path: relative $path
get_contents (line 175)
Populates the class with the content of a directory. Files and child directories
This function because of PHP capabilities sometimes solve the relative paths correctly but '' as current is not properly translated
* access: public
* example: example not found
void get_contents (String $path)
* String $path: - An absolute path
get_content_relative (line 160)
Populates the class with the content of a directory, based on a relative path
This function solves '' as current properly
* access: public
* example: example not found
void get_content_relative (String $path)
* String $path
get_directories (line 216)
Wrapper, returns the directories array, after get_contents (or relative) has been called
* access: public
array get_directories ()
get_extension (line 120)
Get the extension of a file
* access: public
* example: example not found
String get_extension (String $file)
* String $file
get_file (line 355)
Loads the content of a file in a String.
alias of file_get_contents
* example: example not found
void get_file (String $filename)
* String $filename
get_fileasarray (line 382)
Retrieves the content of a file as an array is just the @file function with fixing for relativepath
* example: example not found
void get_fileasarray (String $filename)
* String $filename
get_files (line 207)
Wrapper, returns the file array after get_contents (or relative) function has been called
* access: public
array get_files ()
get_relativepath (line 292)
Solve the relative URL in between 2 paths 2d parameter is relative path from 1st
* access: public
* example: example not found
String get_relativepath (String $fromUrl, String $toUrl)
* String $fromUrl
* String $toUrl
get_relative_fromrelative (line 318)
Returns the relative Url from a relative url
* example: example not found
String get_relative_fromrelative (string $fromUrl, String $toUrl)
* string $fromUrl
* String $toUrl
get_relative_tocurrent (line 274)
Solves the relative path to a target directory Very useful for redirects
* access: public
* example: example not found
String get_relative_tocurrent (String $toUrl)
* String $toUrl
iswriteable (line 482)
Replace PHP function, on windows return weird results always.
return wheter a file can be written (related to system permissions)
* access: public
* example: example not found
Boolean iswriteable (String $filename)
* String $filename
is__writable (line 487)
* access: public
void is__writable ( $path)
* $path
mkdir (line 83)
Creates a new directory in the current path
* access: public
* example: example not found
void mkdir (String $dirName, [Boolean $fromCurrent = true])
* String $dirName
* Boolean $fromCurrent: - True: relative to current, False: Absolute
read_file (line 364)
Alias of file_get_contents
void read_file (String $filename)
* String $filename
rename (line 509)
* access: public
void rename ( $oldname, $newname)
* $oldname
* $newname
setfilter (line 229)
Sets the file filter for populating files on get_contents function
* access: public
void setfilter (Mixed $filter)
* Mixed $filter: Array - Array of allowed extension String - a single extension to allow String keywords equivalents:
o images: array("jpg","JPG","gif","GIF","PNG","png")
unrealpath (line 521)
Can't remember, should fix something in real path
unknown unrealpath (unknown_type $start_dir, unknown_type $final_dir, [unknown_type $dirsep = DIRECTORY_SEPARATOR])
* unknown_type $start_dir
* unknown_type $final_dir
* unknown_type $dirsep
writeFile (line 439)
Writes a file, alias to file_put_contents same as calling fopen, fwrite, fclose in sequence
* access: public
boolean writeFile (String $filename, String $content)
* String $filename: - filename with path to save
* String $content: - content of the file