FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Files Class Reference
Inheritance diagram for Files:
Component Thing

Public Member Functions

 list ($types=null)
 List files. More...
 
 total ()
 Total size used (in bytes). More...
 
 save ($filename, $data)
 Save a file. More...
 
 fetch ($filename)
 Read a file. More...
 
 delete ($filename)
 Delete a file. More...
 
 clear ()
 Delete all files. More...
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

 $quota = 16
 Maximum total user files size (per user; in mega bytes). More...
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 filename ($filename)
 Get full filename for a file. More...
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_user = null
 
 $_root = null
 Root directory for the user files. More...
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 5 of file Files.php.

Member Function Documentation

◆ clear()

clear ( )

Delete all files.

Definition at line 83 of file Files.php.

◆ delete()

delete (   $filename)

Delete a file.

Parameters
string$filenameUser filename, including optional directories.
Returns
bool True on success.

Definition at line 72 of file Files.php.

◆ fetch()

fetch (   $filename)

Read a file.

Parameters
string$filenameUser filename, including optional directories.
Returns
mixed Data. False on error or null if file does not exist.

Definition at line 64 of file Files.php.

◆ filename()

filename (   $filename)
protected

Get full filename for a file.

Parameters
string$filenameUser filename, including optional directories.
Returns
string Full filename (including root). False if root not set, no user ID, or incorrect filename.

Definition at line 17 of file Files.php.

◆ list()

list (   $types = null)

List files.

Parameters
string | array$typesAllowed types (regex or array with extensions).
Returns
array Key = full name, value = info.

Definition at line 27 of file Files.php.

◆ save()

save (   $filename,
  $data 
)

Save a file.

Parameters
string$filenameUser filename, including optional directories.
mixed$dataData to save.
Returns
int Number of bytes written or false on error.

Definition at line 52 of file Files.php.

◆ total()

total ( )

Total size used (in bytes).

Returns
int

Definition at line 41 of file Files.php.

Field Documentation

◆ $_root

$_root = null
protected

Root directory for the user files.

Definition at line 10 of file Files.php.

◆ $_user

$_user = null
protected

Definition at line 9 of file Files.php.

◆ $quota

$quota = 16

Maximum total user files size (per user; in mega bytes).

Definition at line 7 of file Files.php.


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