XOOPS  2.6.0
XoopsFileHandler Class Reference

Public Member Functions

 __construct ($path, $create=false, $mode=0755)
 
 __destruct ()
 
 append ($data, $force=false)
 
 close ()
 
 create ()
 
 delete ()
 
 executable ()
 
 exists ()
 
 ext ()
 
 folder ()
 
 group ()
 
 info ()
 
 lastAccess ()
 
 lastChange ()
 
 md5 ($maxsize=5)
 
 name ()
 
 offset ($offset=false, $seek=SEEK_SET)
 
 open ($mode= 'r', $force=false)
 
 owner ()
 
 perms ()
 
 prepare ($data)
 
 pwd ()
 
 read ($bytes=false, $mode= 'rb', $force=false)
 
 readable ()
 
 safe ($name=null, $ext=null)
 
 size ()
 
 writable ()
 
 write ($data, $mode= 'w', $force=false)
 

Public Attributes

 $folder = null
 
 $handle = null
 
 $info = array()
 
 $lock = null
 
 $name = null
 

Detailed Description

Definition at line 37 of file file.php.

Constructor & Destructor Documentation

XoopsFileHandler::__construct (   $path,
  $create = false,
  $mode = 0755 
)

Constructor

Parameters
string$pathPath to file
boolean$createCreate file if it does not exist (if true)
integer$modeMode to apply to the folder holding the file

public

Definition at line 88 of file file.php.

References $path, create(), exists(), folder(), XoopsFile\getHandler(), name(), and safe().

Here is the call graph for this function:

XoopsFileHandler::__destruct ( )

Closes the current file if it is opened

Definition at line 112 of file file.php.

References close().

Here is the call graph for this function:

Member Function Documentation

XoopsFileHandler::append (   $data,
  $force = false 
)

Append given data string to this File.

Parameters
string$dataData to write
bool$forceforce the file to open
Returns
bool Success public

Definition at line 280 of file file.php.

References write().

Here is the call graph for this function:

XoopsFileHandler::close ( )

Closes the current file if it is opened.

Returns
boolean True if closing was successful or file was already closed, otherwise false public

Definition at line 291 of file file.php.

Referenced by __destruct().

Here is the caller graph for this function:

XoopsFileHandler::create ( )

Creates the File.

Returns
boolean Success public

Definition at line 123 of file file.php.

References $dir, exists(), folder(), and pwd().

Referenced by __construct(), and open().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::delete ( )

Deletes the File.

Returns
boolean Success public

Definition at line 305 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::executable ( )

Returns true if the File is executable.

Returns
boolean true if its executable, false otherwise public

Definition at line 474 of file file.php.

References pwd().

Here is the call graph for this function:

XoopsFileHandler::exists ( )

Returns true if the File exists.

Returns
bool true if it exists, false otherwise public

Definition at line 423 of file file.php.

References pwd().

Referenced by __construct(), create(), delete(), group(), lastAccess(), lastChange(), open(), owner(), perms(), and size().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::ext ( )

Returns the File extension.

Returns
string The File extension public

Definition at line 336 of file file.php.

References info().

Referenced by safe().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::folder ( )

Returns the current folder.

Returns
XoopsFolderHandler Current folder public

Definition at line 551 of file file.php.

References $folder.

Referenced by __construct(), create(), and pwd().

Here is the caller graph for this function:

XoopsFileHandler::group ( )

Returns the File group.

Returns
int|bool the Filegroup public

Definition at line 509 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::info ( )

Returns the File informations array

Returns
array The File informations public

Definition at line 319 of file file.php.

References $info, name(), and pwd().

Referenced by ext(), and name().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::lastAccess ( )

Returns last access time.

Returns
int|bool timestamp Timestamp of last access time public

Definition at line 523 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::lastChange ( )

Returns last modified time.

Returns
int|bool timestamp Timestamp of last modification public

Definition at line 537 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::md5 (   $maxsize = 5)

Get md5 Checksum of file with previous check of Filesize

Parameters
integer$maxsizein MB or true to force
Returns
string md5 Checksum See md5_file() public

Definition at line 393 of file file.php.

References pwd(), and size().

Here is the call graph for this function:

XoopsFileHandler::name ( )

Returns the File name without extension.

Returns
string The File name without extension. public

Definition at line 353 of file file.php.

References $name, and info().

Referenced by __construct(), info(), and pwd().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::offset (   $offset = false,
  $seek = SEEK_SET 
)

Sets or gets the offset for the currently opened file.

Parameters
mixed$offsetThe $offset in bytes to seek. If set to false then the current offset is returned.
integer$seekPHP 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

Definition at line 210 of file file.php.

References open().

Here is the call graph for this function:

XoopsFileHandler::open (   $mode = 'r',
  $force = false 
)

Opens the current file with a given $mode

Parameters
string$modeA valid 'fopen' mode string (r|w|a ...)
boolean$forceIf 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

Definition at line 144 of file file.php.

References create(), exists(), and pwd().

Referenced by offset(), read(), and write().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::owner ( )

Returns the File's owner.

Returns
int|bool the Fileowner

Definition at line 495 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::perms ( )

Returns the "chmod" (permissions) of the File.

Returns
string Permissions for the file public

Definition at line 435 of file file.php.

References exists(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::prepare (   $data)

Prepares a ascii string for writing fixes line endings

Parameters
string$dataData to prepare for writing.
Returns
string public

Definition at line 233 of file file.php.

XoopsFileHandler::pwd ( )

Returns the full path of the File.

Returns
string Full path to file public

Definition at line 412 of file file.php.

References folder(), and name().

Referenced by create(), delete(), executable(), exists(), group(), info(), lastAccess(), lastChange(), md5(), open(), owner(), perms(), read(), readable(), size(), and writable().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::read (   $bytes = false,
  $mode = 'rb',
  $force = false 
)

Return the contents of this File as a string.

Parameters
string | bool$byteswhere to start
string$modemode of file access
boolean$forceIf 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

Definition at line 171 of file file.php.

References open(), and pwd().

Here is the call graph for this function:

XoopsFileHandler::readable ( )

Returns true if the File is readable.

Returns
boolean true if file is readable, false otherwise public

Definition at line 485 of file file.php.

References pwd().

Here is the call graph for this function:

XoopsFileHandler::safe (   $name = null,
  $ext = null 
)

makes filename safe for saving

Parameters
string$namethe name of the file to make safe if different from $this->name
string$extthe extension of the file
Returns
string

Definition at line 374 of file file.php.

References $ext, $name, and ext().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::size ( )

Returns the Filesize, either in bytes or in human-readable format.

Returns
bool|int filesize as int or as a human-readable string public

Definition at line 449 of file file.php.

References exists(), and pwd().

Referenced by md5().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFileHandler::writable ( )

Returns true if the File is writable.

Returns
boolean true if its writable, false otherwise public

Definition at line 463 of file file.php.

References pwd().

Here is the call graph for this function:

XoopsFileHandler::write (   $data,
  $mode = 'w',
  $force = false 
)

Write given data to this File.

Parameters
string$dataData to write to this File.
string$modeMode of writing. See fwrite().
bool$forceforce the file to open
Returns
bool Success public

Definition at line 252 of file file.php.

References open().

Referenced by append().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

XoopsFileHandler::$folder = null

Definition at line 45 of file file.php.

Referenced by folder().

XoopsFileHandler::$handle = null

Definition at line 69 of file file.php.

XoopsFileHandler::$info = array()

Definition at line 61 of file file.php.

Referenced by info().

XoopsFileHandler::$lock = null

Definition at line 77 of file file.php.

XoopsFileHandler::$name = null

Definition at line 53 of file file.php.

Referenced by name(), and safe().


The documentation for this class was generated from the following file: