constructor Bs_FileSystem [line 123]
Bs_FileSystem Bs_FileSystem(
)
|
|
* Constructor.
method basename [line 575]
string basename(
string
$path)
|
|
returns the base name of a path (filename).
replacement to php's basename() function which sucks because dirs do not end with '/' and some other stuff I don't recall. The path you give is first standardized replace '\' with '/' see http://www.php.net/manual/en/function.basename.php
Parameters:
method getCwd [line 220]
Gets the current process working directory by using PHP's getcwd() and converting the result to our standard.
Tags:
method getFileAttr [line 147]
hash getFileAttr(
[string
$path = ''], [boolean
$clearCache = FALSE])
|
|
Return most of the file attribute info. (Should work with Windows too).
this function only gets called from
NOTE: Invoking the stat or lstat system call on most systems is quite expensive. Therefore, the result of the last call to many of the status functions in PHP are stored for use on the next such call using the same file/dir-name. If you wish to force a new status check, for instance if the file is being checked many times and may change or disappear, set the param '$clearCache' to TRUE to force a system reread. !!!This value is only cached for the lifetime of a single request.!!!
Tags:
Parameters:
method getFileExtension [line 519]
string getFileExtension(
[string
$fullPath = NULL])
|
|
Get the file extension from a path.
examples: 'c:\myFile.php' -> 'php' 'c:\myFile.class.PHP' -> 'PHP' 'c:\myFile' -> '' 'c:\myFile.class.php.lnk' -> 'php' <= special case on winblows for links
may be used without param, then it will be for the file/dir that is currently in use. otherwise it is used pseudostatic.
the extension is NOT converted to lower case!
Tags:
Parameters:
method getFileName [line 589]
void getFileName(
mixed
$path)
|
|
Tags:
method getFullPath [line 464]
returns the directory or file that this object (subclassed file or dir object) is looking at.
Tags:
method getPathStem [line 490]
string getPathStem(
string
$path)
|
|
Get the stem part of a path.
Examples on Windows: (on *nix there is of course no drive prefix 'f:') "f:/dir 790/asdf/file.xyz.html" => "f:/dir 790/asdf/" "f:\\dir 790\\asdf\\file.xyz.html" => "f:/dir 790/asdf/" "f:\\dir 790\\asdf/" => "f:/dir 790/asdf/" "f:\\dir 790\\asdf" => "f:/dir 790/" <= even if asdf is a dir!! (see note II)
NOTE I: PHP's dirname() doesn't return the trailing slash, but we do. NOTE II: This method doesn't try to check if the last part is a file or a dir, when the trailing slash is not given. because the fullPath given doesn't need to exist (on this system)... so even if in 'c:/one/two' two is a directory, only 'c:/one/' will be returned.
Tags:
Parameters:
method getRealPath [line 245]
string getRealPath(
[string
$path = ''])
|
|
Returns canonicalized real pathname *with* ending '/' if it's a dir AND(!) checks for existence!
This method basically executes our Bs_FileSystem::getRealPathSplit() function and checks for file existence.
Make On windows, something like 'c:/dir////dir2' is converted to 'c:\dir\dir2', but i want to have it converted to 'c:/dir/dir2/'. I like to have foreslashes on all systems. And in this case, dir2 was a directory even if the trailing slash was missing. realPath() should come with the intelligence to add it if dir2 is not a file, imo.
Tags:
Parameters:
method getRealPathSplit [line 314]
hash getRealPathSplit(
[string
$path = ''])
|
|
Returns a splited canonicalized real pathname *with* ending '/' if it's a dir.
AND(!) checks for existence!
This method basically executes our Bs_FileSystem::getRealPathSplit() function and checks for file existens.
returns a hash: ['pathRoot'] <- Things like '/', 'c:/', 'http://', 'ftp://' ['pathCore'] <- e.g. 'path/to/a/subdir/' ['file'] <- if a file was in the path find it here ['tailDir'] <- for convinience the last dir of the ['pathCore'] e.g. 'subdir' ['realPath'] <- for convinience ['pathRoot'] . ['pathCore'] . ['file'];
Tags:
Parameters:
method getWithoutFileExtension [line 550]
string getWithoutFileExtension(
[string
$fullPath = NULL])
|
|
returns the filename without the file extension.
examples: 'myFile.php' -> 'myFile' 'myFile.class.php' -> 'myFile.class' 'myFile' -> 'myFile' 'c:\myFile.gif' -> 'myFile' 'c:\myFile.class.php.lnk' -> 'myFile.class' <= special case on winblows for links
Tags:
Parameters:
method isLink [line 697]
bool isLink(
[string
$fullPath = null])
|
|
tells wheter the current file/path (or $fullPath) is a link or not.
uses php's is_link() on *nix and something handmade on winblows.
may be used without param, then it will be for the file/dir that is currently in use. otherwise it is used pseudostatic.
Parameters:
method isValidFilename [line 609]
void isValidFilename(
mixed
$fileName, [mixed
$os = 'all'])
|
|
windows filename and dirname (tested on winnt 4.0 german)
1) cannot have one of these characters: \ / : * ? " < > | 2) cannot start or end with a space 3) cannot start with a dot '.' if you want to test with a scary filename, use this one (on windows): {}d % test.txt {} _-d°§+@ #ç&()=~^`´'$£ no file can be named '.' or '..' (which could cause bugs with these unix-like things).
linux filename 1) cannot have one of these characters: & 2) some more, don't know.
Tags:
method isValidFullPath [line 681]
void isValidFullPath(
mixed
$fullPath, [mixed
$system = NULL])
|
|
Tags:
method isValidPath [line 674]
void isValidPath(
mixed
$path, [mixed
$system = NULL])
|
|
Tags:
method makeValidFileName [line 638]
string makeValidFileName(
string
$fileName, [string
$os = 'all'])
|
|
removes/replaces invalid characters in the filename specified.
param $os: i recommend you use the default, 'all'. all => the returned file name will be usable on all systems. the behavior is the same as for 'linux'. win => remove these chars: \ / : * ? " < > | may have spaces, but may not start or end with one. will be cut. linux => remove all chars that are not a-zA-Z 0-9 _ . (underscore and dot) spaces are replaced with an underscore. SPACES AND/OR UNDERSCORES THAT ARE TOGETHER WILL BE CUT DOWN TO ONE! examples: "foo__" => "foo_" //2 underscores become one underscore "f oo__" => "f_oo_" //2 spaces become one underscore "f _ oo" => "f_oo" //space, underscore, space becomes one underscore
altough windows does not always like it, a dot at the beginning is left as is.
Tags:
Parameters:
method realPath [line 285]
string realPath(
string
$path)
|
|
Returns canonicalized real pathname *with* ending '/' if it's a dir.
No existence check! Replacement for php's realpath().
CAUTION: for the built in php function realpath(): Use this method (and php's realpath()) only with a path that exists on your current system!!! Otherwise you might get wrong results, the behavior is varying from returning an empty string to wrong paths.
Resolves references to './', '/./', '/../' and extra '/' characters in the input path and returns the canonicalized absolute pathname. The resulting path will *not* have './', '/./' or '/../' components.
NOTE 1: No file systems checks are made! So path may or *may not* exsist! See Bs_FileSystem::getRealPath() NOTE 2: Accespts *fore*- and *back*-slashes E.g. '/aa/bb\\cc\\dd/' NOTE 3: Special 'Path prefixes' are preserved E.g. if input path starts with '//' (network path incl stuff like ftp:// http://) '/' (absolute path) 'x:/' (Winblos drive letter *yuck*) BUT './' (relative path) is stripped ! E.g. ./aaa/bbb/ -> aaa/bbb/ The resulting path will have the same prefix. NOTE 4: If path does *not* end with a '/', it is considerd to be a *path and file* and it therefore the file will always suffix of the resulting path.
Tags:
Parameters:
method realPathSplit [line 351]
hash realPathSplit(
string
$path)
|
|
Returns a splited canonicalized real pathname *with* ending '/' if it's a dir.
No existence check!
NOTE 1: No file systems checks are made! So path may or *may not* exsist! See Bs_FileSystem::getRealPathSplit()
returns a hash: ['pathRoot'] <- Things like '/', 'c:/', 'http://', 'ftp://' ['pathCore'] <- e.g. 'path/to/a/subdir/' ['file'] <- if a file was in the path find it here ['tailDir'] <- for convinience the last dir of the ['pathCore'] e.g. 'subdir' ['realPath'] <- for convinience ['pathRoot'] . ['pathCore'] . ['file'];
Tags:
Parameters:
method setFullPath [line 442]
bool setFullPath(
string
$workingDir)
|
|
Set our view to the directory or file passed by '$workingDir'.
Tags:
Overridden in child classes as:
- Bs_Dir::setFullPath()
- Set our view to the directory passed by '$workingDir'.
Parameters:
method standardizePath [line 208]
string standardizePath(
string
$path)
|
|
The path format for input may be windows-like with '\' backslashes.
(Even some PHP functions spit out that fomat on Winblows). BUT in all output we use iX path format with '/' forslash. Luckelly Winblows has no problem with this format.
Tags:
Parameters: