Methods summary
public
|
#
__construct( string $path, boolean $create = false, integer $mode = 0755 )
Constructor
Parameters
- $path
- Path to file
- $create
- Create file if it does not exist (if true)
- $mode
- Mode to apply to the folder holding the file
|
public
|
#
__destruct( )
Closes the current file if it is opened
Closes the current file if it is opened
|
public
boolean
|
#
create( )
Creates the File.
Returns
boolean Success
|
public
boolean
|
#
open( string $mode = 'r', boolean $force = false )
Opens the current file with a given $mode
Opens the current file with a given $mode
Parameters
- $mode
- A valid 'fopen' mode string (r|w|a ...)
- $force
If true then the file will be re-opened even if
its already opened, otherwise it won't
Returns
boolean True on success, false on failure
|
public
mixed
|
#
read( string|boolean $bytes = false, string $mode = 'rb', boolean $force = false )
Return the contents of this File as a string.
Return the contents of this File as a string.
Parameters
- $bytes
- where to start
- $mode
- mode of file access
- $force
- If true then the file will be re-opened even if its already opened, otherwise it won't
Returns
mixed string on success, false on failure
|
public
mixed
|
#
offset( mixed $offset = false, integer $seek = SEEK_SET )
Sets or gets the offset for the currently opened file.
Sets or gets the offset for the currently opened file.
Parameters
- $offset
- The $offset in bytes to seek. If set to false then the current offset is returned.
- $seek
- PHP Constant SEEK_SET | SEEK_CUR | SEEK_END determining what the $offset is relative to
Returns
mixed True on success, false on failure (set mode),
false on failure or integer offset on success (get mode)
|
public
string
|
#
prepare( string $data )
Prepares a ascii string for writing
fixes line endings
Prepares a ascii string for writing
fixes line endings
Parameters
- $data
- Data to prepare for writing.
Returns
string
|
public
boolean
|
#
write( string $data, string $mode = 'w', boolean $force = false )
Write given data to this File.
Write given data to this File.
Parameters
- $data
- Data to write to this File.
- $mode
- Mode of writing. See fwrite().
- $force
- force the file to open
Returns
boolean Success
|
public
boolean
|
#
append( string $data, boolean $force = false )
Append given data string to this File.
Append given data string to this File.
Parameters
- $data
- Data to write
- $force
- force the file to open
Returns
boolean Success
|
public
boolean
|
#
close( )
Closes the current file if it is opened.
Closes the current file if it is opened.
Returns
boolean True if closing was successful or file was already closed, otherwise false
|
public
boolean
|
#
delete( )
Deletes the File.
Returns
boolean Success
|
public
array
|
#
info( )
Returns the File information array
Returns the File information array
Returns
array The File information
|
public
string
|
#
ext( )
Returns the File extension.
Returns the File extension.
Returns
string The File extension
|
public
string
|
#
name( )
Returns the File name without extension.
Returns the File name without extension.
Returns
string The File name without extension.
|
public
string
|
#
safe( string $name = null, string $ext = null )
makes filename safe for saving
makes filename safe for saving
Parameters
- $name
- the name of the file to make safe if different from $this->name
- $ext
- the extension of the file
Returns
string
|
public
string
|
#
md5( integer $maxsize = 5 )
Get md5 Checksum of file with previous check of Filesize
Get md5 Checksum of file with previous check of Filesize
Parameters
- $maxsize
- in MB or true to force
Returns
|
public
string
|
#
pwd( )
Returns the full path of the File.
Returns the full path of the File.
Returns
string Full path to file
|
public
boolean
|
#
exists( )
Returns true if the File exists.
Returns true if the File exists.
Returns
boolean true if it exists, false otherwise
|
public
string
|
#
perms( )
Returns the "chmod" (permissions) of the File.
Returns the "chmod" (permissions) of the File.
Returns
string Permissions for the file
|
public
boolean|integer
|
#
size( )
Returns the Filesize, either in bytes or in human-readable format.
Returns the Filesize, either in bytes or in human-readable format.
Returns
boolean|integer filesize as int or as a human-readable string
|
public
boolean
|
#
writable( )
Returns true if the File is writable.
Returns true if the File is writable.
Returns
boolean true if its writable, false otherwise
|
public
boolean
|
#
executable( )
Returns true if the File is executable.
Returns true if the File is executable.
Returns
boolean true if its executable, false otherwise
|
public
boolean
|
#
readable( )
Returns true if the File is readable.
Returns true if the File is readable.
Returns
boolean true if file is readable, false otherwise
|
public
integer|boolean
|
#
owner( )
Returns the File's owner.
Returns the File's owner.
Returns
integer|boolean the Fileowner
|
public
integer|boolean
|
#
group( )
Returns the File group.
Returns
integer|boolean the Filegroup
|
public
integer|boolean
|
#
lastAccess( )
Returns last access time.
Returns last access time.
Returns
integer|boolean timestamp Timestamp of last access time
|
public
integer|boolean
|
#
lastChange( )
Returns last modified time.
Returns last modified time.
Returns
integer|boolean timestamp Timestamp of last modification
|
public
XoopsFolderHandler
|
#
folder( )
Returns the current folder.
Returns the current folder.
Returns
|