PHP Class AttachmentManager

Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Свойство Type Description
$m_config Configuration array.
$m_dirs Array of directory information.

Méthodes publiques

Méthode Description
__construct ( $p_config ) Constructor. Create a new Attachment Manager instance.
countFiles ( $path ) Count the number of files and directories in a given folder minus the thumbnail folders and thumbnails.
getBaseDir ( ) : string Get the base directory.
getBaseURL ( ) : string Get the base URL.
getDefaultThumb ( ) : string Get the default thumbnail.
getFileURL ( string $relative ) : string Get the URL of the relative file.
getFiles ( string $p_articleId, $p_languageId = null ) : array Get all the files and directories of a relative path.
getFiles ( string $p_articleId, $p_languageId = null, $p_filter = true ) : array Get all the files and directories of a relative path.
getFullPath ( string $relative ) : string Get the fullpath to a relative file.
isTmpFile ( string $file ) : boolean Check if the given file is a tmp file.
isValidBase ( )
validRelativePath ( string $path ) : boolean Check if the given path is part of the subdirectories under the base_dir.

Method Details

__construct() public méthode

Constructor. Create a new Attachment Manager instance.
public __construct ( $p_config )

countFiles() public méthode

Count the number of files and directories in a given folder minus the thumbnail folders and thumbnails.
public countFiles ( $path )

getBaseDir() public méthode

Get the base directory.
public getBaseDir ( ) : string
Résultat string base dir, see config.inc.php

getBaseURL() public méthode

Get the base URL.
public getBaseURL ( ) : string
Résultat string base url, see config.inc.php

getDefaultThumb() public méthode

Get the default thumbnail.
public getDefaultThumb ( ) : string
Résultat string default thumbnail, empty string if the thumbnail doesn't exist.

getFileURL() public méthode

basically appends the relative file to the base_url given in config.inc.php
public getFileURL ( string $relative ) : string
$relative string a file the relative to the base_dir
Résultat string the URL of the relative file.

getFiles() public méthode

Get all the files and directories of a relative path.
public getFiles ( string $p_articleId, $p_languageId = null ) : array
$p_articleId string
Résultat array of file and path information. array('url'=>'full url', 'storage'=>'full file path')

getFiles() public méthode

Get all the files and directories of a relative path.
public getFiles ( string $p_articleId, $p_languageId = null, $p_filter = true ) : array
$p_articleId string
Résultat array of file and path information. array('url'=>'full url', 'storage'=>'full file path')

getFullPath() public méthode

Get the fullpath to a relative file.
public getFullPath ( string $relative ) : string
$relative string the relative file.
Résultat string the full path, .ie. the base_dir + relative.

isTmpFile() public méthode

Check if the given file is a tmp file.
public isTmpFile ( string $file ) : boolean
$file string file name
Résultat boolean true if it is a tmp file, false otherwise

isValidBase() public méthode

public isValidBase ( )

validRelativePath() public méthode

Check if the given path is part of the subdirectories under the base_dir.
public validRelativePath ( string $path ) : boolean
$path string the relative path to be checked
Résultat boolean true if the path exists, false otherwise

Property Details

$m_config public_oe property

Configuration array.
public $m_config

$m_dirs public_oe property

Array of directory information.
public $m_dirs