Create a new temporary file handler.
Parameters:
API Tags:
bool appendToFile(
string
$data
)
|
|
Append data to a file.
Parameters:
|
string |
$data: |
Data to append |
API Tags:
| Return: | Wether appending succeeded |
| Access: | public |
Close the current (open) file
API Tags:
| Return: | Wether we could close the file |
| Access: | public |
atkTmpFile create(
string
$filename, [
$baseDirectory = null], string
$base
)
|
|
Create a new temporary file handler.
Factory method, allowing a shorter syntax.
Parameters:
|
string |
$filename: |
|
|
string |
$base: |
directory for writing (default atktempdir) |
|
|
$baseDirectory: |
|
API Tags:
bool createDirectoryStructure(
)
|
|
Recursively creates the directory structure for this file.
API Tags:
| Return: | Wether we succeeded |
| Access: | public |
Wether or not the file exists.
API Tags:
| Return: | Exists? |
| Access: | public |
Returns the file age in seconds
API Tags:
| Return: | Seconds of file age. |
| Access: | public |
Returns the time the file was last changed, or FALSE in case of an error.
The time is returned as a Unix timestamp.
API Tags:
| Return: | Timestamp last changed |
| Access: | public |
Send the file contents directly to the browser.
API Tags:
| Return: | Wether the action succeeded |
| Access: | public |
Get the base directory for writing
Will default to the atktmp dir
API Tags:
Get the complete path of the file
Example:
$file->getPath(); => ./
atktmp/
tempdir/
tempfile.
inc
API Tags:
| Return: | Path for the file |
| Access: | public |
bool open(
string
$mode
)
|
|
Open the file with a specific mode (see PHPs fopen).
Close it first if it's already open with a different mode. And create the directory structure if we are writing to the file.
Parameters:
|
string |
$mode: |
Mode to open the file with |
API Tags:
| Return: | Wether opening succeeded |
| Access: | public |
Returns the contents of the file in an array, split by newline (see PHPs 'file' function).
Returns false if the file does not exist.
API Tags:
Returns the contents of the file in a string.
Returns false if the file does not exist.
API Tags:
Removes a file.
API Tags:
| Return: | Wether removing succeeded |
| Access: | public |
bool setBasedir(
string
$dir
)
|
|
Set the base directory for writing instead of the default atktmp dir
Parameters:
|
string |
$dir: |
base directory |
API Tags:
mixed write(
string
$data
)
|
|
Write data to the current (open) file.
Parameters:
|
string |
$data: |
Data to write to the file |
API Tags:
| Return: | Number of bytes written or false for error |
| Access: | public |
bool writeAsPhp(
string
$varname, string
$data
)
|
|
Exports a PHP variable to a file, makes the file a PHP file.
Parameters:
|
string |
$varname: |
Name of the variable |
|
string |
$data: |
Variable data |
API Tags:
| Return: | Wether the action succeeded |
| Access: | public |
bool writeFile(
string
$data
)
|
|
Write data to the file (creates the file if it does not exist and override any existing content).
Parameters:
|
string |
$data: |
Data to write to the file |
API Tags:
| Return: | Wether writing succeeded |
| Access: | public |