A Utility Class for IO Operations.
This class provides methods not included in PEARS's IO packages.
Located in /code/framework/RSIO/RSIO.php (line 49)
Copies a directory including all subdirectories and files.
Returns the contents of the file $filename or an instance of RSError if fopen failed.
This method allows to easyly retrieve the contents of a file without being incompatible to PHP versions < 4.3.0 as the native method file_get_contents is. getFileContents uses http://www.php.net/fopen to retrieve a file handle. This method avoids the overhead of PEAR::File and it has the advantage that you do not have to call any rewind method as you have to do in PEAR::File before executing another 'readAll'-operation on the same file. Example:
1 $contents = RSIO::getFileContents('/my_path/my_file.txt');
2 if (PEAR::isError($contents) {
3 //error handling
4 } else {
5 echo $contents;
6 }
Renames all files and directories in $path recursively by doing a string replacement.
RSIO::replaceInFilename is called for each file and directory to do the actual replacement. See RSIO::replaceInFilename for details.
Renames a file by doing a string replacement.
Example:
1 RSIO::replaceInFilename(
2 '/mypath/tyops_to_be_repalced.txt',
3 array(
4 'repalce' => 'replace',
5 'tyop' => 'typo'
6 )
7 );
This would rename /mypath/tyops_to_be_repalced.txt to /mypath/typos_to_be_replaced.txt.
Documentation generated on Mon, 8 Dec 2003 13:13:08 +0100 by phpDocumentor 1.2.3