Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes

file Class Reference

Static Public Member Functions

static init ()
static saveCache ()
static exists ($file)
static name ($file)
static nyroExists ($prm)
static webExists ($file)
static read ($file)
static write ($file, $content)
static copy ($oldName, $newName)
static move ($oldName, $newName)
static createDir ($path, $chmod=0777)
static date ($file)
static isLater ($file1, $file2)
static size ($file)
static humanSize ($file)
static delete ($file)
static multipleDelete ($pattern)
static getExt ($file)
static getType ($file)
static fetch ($file, array $vars=array())
static search ($pattern)

Private Member Functions

 __construct ()

Static Private Member Functions

static initCfg ()
static initCache ()

Static Private Attributes

static $cfg
static $searchFiles = array()
static $saveCacheFiles = false
static $cacheFiles = null

Detailed Description

To read and write files Same use like globals variables Singleton

Definition at line 12 of file file.class.php.


Constructor & Destructor Documentation

__construct (  )  [private]

No instanciation for this class

Definition at line 46 of file file.class.php.


Member Function Documentation

static copy ( oldName,
newName 
) [static]

Copy a file to a new location

Parameters:
string $oldName Old name path
string $newName New name path
Returns:
bool True if success

Definition at line 268 of file file.class.php.

static createDir ( path,
chmod = 0777 
) [static]

Create a directory, and all subdirectory if needed If directory already exists, nothing is done

Parameters:
string $path
string $chmod
Returns:
bool True if directory exists

Definition at line 291 of file file.class.php.

static date ( file  )  [static]

Get the file update date

Parameters:
string $file The file path
Returns:
int Timestamp

Definition at line 302 of file file.class.php.

static delete ( file  )  [static]

Delete a file

Parameters:
string $file The file path
Returns:
bool True if success

Definition at line 354 of file file.class.php.

static exists ( file  )  [static]

Check if a file exists

Parameters:
string $file File path
Returns:
bool

Definition at line 97 of file file.class.php.

static fetch ( file,
array $  vars = array() 
) [static]

Fetch a file with vars (used in tpl)

Parameters:
string $file File path name
array $vars Variables used in the php file
Returns:
string The file fetched

Definition at line 436 of file file.class.php.

static getExt ( file  )  [static]

Get the file extension

Parameters:
string $file The filename
Returns:
null|string The extension

Definition at line 398 of file file.class.php.

static getType ( file  )  [static]

Get the Mime Type of a file

Parameters:
string $file File path name
Returns:
string

Definition at line 408 of file file.class.php.

static humanSize ( file  )  [static]

Get a human file size

Parameters:
string $file The file path
Returns:
string The human size

Definition at line 338 of file file.class.php.

static init (  )  [static]

Init the file elements

Definition at line 51 of file file.class.php.

static initCache (  )  [static, private]

Initialize the cache object

Definition at line 66 of file file.class.php.

static initCfg (  )  [static, private]

Init the file configuration

Definition at line 58 of file file.class.php.

static isLater ( file1,
file2 
) [static]

Compare 2 date files

Parameters:
string $file1 The first file path
string $file2 The second file path
Returns:
bool True if the first file is later than the second

Definition at line 314 of file file.class.php.

static move ( oldName,
newName 
) [static]

Move a file to a new location

Parameters:
string $oldName Old name path
string $newName New name path
Returns:
bool True if success

Definition at line 279 of file file.class.php.

static multipleDelete ( pattern  )  [static]

Delete files with a pattern

Parameters:
string $pattern The pattern to delete files (glob used)
Returns:
int Number of files deleted

Definition at line 384 of file file.class.php.

static name ( file  )  [static]

Get the filename from a path

Parameters:
string $file
Returns:
string

Definition at line 118 of file file.class.php.

static nyroExists ( prm  )  [static]

Try to find the file location, in the nyro installation in this order: my directory, plugin directory and nyro directory. The order can be reverse by setting rtl parameter to false. If the file is located on a subdirectory, use _ to replace /.

Parameters:
array $prm Possible values :

  • name (required) string: FileName (with _ to replace /)
  • realName boolean: Indicate if the given name is real or should be parsed
  • type string: class, extend, cfg, tpl, lib or other (default: class)
  • rtl bool: see description (default: true)
  • list bool: Search all the matched files and return the order list. (default: false)
  • tplExt string: Tpl Extension (default: request::get('out'))
Returns:
false|string|array The absolute file location, an absolute file location array or false if not found

Definition at line 137 of file file.class.php.

static read ( file  )  [static]

Read a file

Parameters:
string $file The file path
Returns:
string|false The file content

Definition at line 242 of file file.class.php.

static saveCache (  )  [static]

Save the cache

Definition at line 84 of file file.class.php.

static search ( pattern  )  [static]

Search files regarding a pattern

Parameters:
string $pattern
Returns:
array

Definition at line 451 of file file.class.php.

static size ( file  )  [static]

Get a file size

Parameters:
string $file The file path
Returns:
int The file size

Definition at line 325 of file file.class.php.

static webExists ( file  )  [static]

Check if a file exists in the web directory

Parameters:
string $file Filename
Returns:
bool

Definition at line 232 of file file.class.php.

static write ( file,
content 
) [static]

Write into a file

Parameters:
string $file The file path
string $content The file content
Returns:
bool True if success

Definition at line 256 of file file.class.php.


Field Documentation

$cacheFiles = null [static, private]

Definition at line 41 of file file.class.php.

$cfg [static, private]

Definition at line 19 of file file.class.php.

$saveCacheFiles = false [static, private]

Definition at line 34 of file file.class.php.

$searchFiles = array() [static, private]

Checkif a file exists

Parameters:
string $file The file path
Returns:
bool

Definition at line 27 of file file.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations
Generated on Thu Jan 26 2012 18:40:07 for nyroFwk by doxygen 1.7.1