| core_file

# Class: Bs_FileUtil Source Location: /core/file/Bs_FileUtil.class.php
### Class Overview
    Bs_Object
       |
       --Bs_FileUtil
file helper class. not sure if i should start another class or if i should throw this into bs_file. #### Author(s): andrej arn <at blueshoes dot org> #### Version: 4.3.$Revision: 1.3 $ $Date: 2003/11/19 08:18:13 $ #### Copyright: blueshoes.org | ### Methods Bs_FileUtil countLinesDir countLinesFile decodeFilename encodeFilename getMimeType removeEmptyLines
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 21] file helper class. not sure if i should start another class or if i should throw this into bs_file. dependencies: Bs_System, Bs_Dir (in countLinesDir()), #### Tags:
version: | 4.3.$Revision: 1.3 $ $Date: 2003/11/19 08:18:13 $
copyright: | blueshoes.org
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Methods ### constructor Bs_FileUtil [line 27]
`Bs_FileUtil Bs_FileUtil( )`
* Constructor. [ Top ] ### method countLinesDir [line 154]
`int countLinesDir( string $fullPath, [string $regExp = NULL], [bool $recursive = FALSE])`
counts the lines in all files in a directory, even recursive if you want. example: this will tell you the number of lines in the dir specified, for all *.class.php files, including subdirectories: $fullPath = 'C:/usr/local/lib/php/blueshoes-4.2/core/html/form/'; $regExp = '\.class\.php$'; $numLines = $Bs_FileUtil->countLinesDir($fullPath, $regExp, TRUE); #### Parameters:
string | $fullPath |
string | $regExp | (a regexp the file has to pass, eg to only use some file types. default is NULL.)
bool | $recursive | (if you want to do it recursively, default is FALSE.)
[ Top ] ### method countLinesFile [line 130]
`int countLinesFile( string $fullPath)`
counts the lines in the file specified. if it's not a file or if it is not readable, 0 is returned. #### Tags:
return: | (0-n)
#### Parameters:
string | $fullPath |
[ Top ] ### method decodeFilename [line 77]
`string decodeFilename( mixed $filename, [char $e = '_'])`
#### Tags:
access: | public
#### Parameters:
char | $e | (escape character, default is the underscore '_'.)
[ Top ] ### method encodeFilename [line 39]
`string encodeFilename( mixed $filename, [char $e = '_'])`
#### Tags:
access: | public
#### Parameters:
char | $e | (escape character, default is the underscore '_'.)
[ Top ] ### method getMimeType [line 186]
`string getMimeType( string $param)`
returns the mime type for a file type. example: Bs_FileUtil->getMimeType('doc') => 'application/msword' the function only knows the 'official' ones, see the apache conf file named mime.types.default and it's comment. extract: For more information about Internet media types, please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type registry is at ftp://ftp.iana.org/in-notes/iana/assignments/media-types/. #### Tags:
throws: | bool FALSE
#### Parameters:
string | $param | (file extension without the dot, eg 'zip'.)
[ Top ] ### method removeEmptyLines [line 108]
`bool removeEmptyLines( string $fullPath)`
removes all empty lines of the given file. #### Tags:
return: | TRUE on success
throws: | bool FALSE.
#### Parameters:
string | $fullPath |
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:09:10 +0100 by phpDocumentor 1.2.3