Documentation

ViewManagerFileSystem extends LocalFileSystem

Class ViewManagerFileSystem

Tags
copyright

Cloudrexx AG

author

Robin Glauser robin.glauser@comvation.com

author

Thomas Däppen thomas.daeppen@cloudrexx.com

subpackage

core_viewmanager

Table of Contents

Properties

$additionalFileSystems  : array<string|int, mixed>
An array containing additional file systems of type \Cx\Core\MediaSource\Model\Entity\LocalFileSystem
$fileListCache  : mixed
$localeCodes  : array<string|int, mixed>
List of locale codes ordered by translation fallback order per Cx instance
$nestingCount  : int
Counts the nesting level of __call()
$stringRepresentationBlank  : bool
Whether blank string representations are valid
$stringRepresentationFields  : array<string|int, mixed>
List of fields that should be available in the string representation
$stringRepresentationFormat  : string
Sprintf format for the string representation
$validators  : array<string|int, mixed>
Initialize this array as follows: array( 'columName' => Zend_Validate )
$virtual  : bool
Defines if an entity is virtual and therefore not persistable.

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
__get()  : mixed
This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
__toString()  : string
Returns this entity's identifying value
copyFolder()  : mixed
Copies the folder from the additional file systems and current filesystem to the given new folder path
createDirectory()  : string
Creates a new directory
createFromPath()  : LocalFileSystem
fileExists()  : bool
Check whether file exists in the filesytem
getComponentController()  : SystemComponent
Returns the component controller for this component
getFileFromPath()  : File|false
Returns the File instance for a given path
getFileList()  : array<string|int, mixed>
Returns the file list of installed webdesign templates.
getFullFileList()  : array<string|int, mixed>
Return the full/raw file list
getFullPath()  : string
Get full path of the given file, If file is application template then load from website/codebase path else Path will be checked in the following order 1. website repository 2. server website repository 3. codebase repository
getKeyAsString()  : string
Returns this entity's key
getLink()  : mixed
getOffsetPath()  : mixed
getRootPath()  : string
Get Root path of the filesystem
getThumbnails()  : mixed
getTranslatedFieldValue()  : mixed
Returns the value of a translatable field using fallback mechanisms
initializeValidators()  : mixed
Set $this->validators
isDirectory()  : bool
Check whether file is directory
isFile()  : bool
Check whether file is directory
isImage()  : int
isImageFile()  : bool
Check whether the file is image
isReadOnly()  : bool
Check whether the file is read only
isResettable()  : bool
Check whether the file is resettable
isVirtual()  : bool
Returns the virtuality of the entity
mergeFileList()  : array<string|int, mixed>
Merge two file lists into one
moveFile()  : string
Moves a file to a new location
readFile()  : string
Read the contents from given file, Check whether the file exists before calling this function
removeFile()  : string
Removes the given file from the OS FS
removeThumbnails()  : array<string|int, mixed>
setRootPath()  : mixed
Set root path of the filesystem
setVirtual()  : mixed
Set the virtuality of the entity
utf8EncodeArray()  : array<string|int, mixed>
Applies utf8_encode() to keys and values of an array From: http://stackoverflow.com/questions/7490105/array-walk-recursive-modify-both-keys-and-values
validate()  : mixed
writeFile()  : mixed
Writes $content to $file, erases all existing content
array_merge_recursive()  : array<string|int, mixed>
\array_merge_recursive() behaves unexpected with numerical indexes Fix from http://php.net/array_merge_recursive (array_merge_recursive_new)
getFallbackLocaleCodes()  : array<string|int, mixed>
Returns a list of all locale codes ordered by fallback order
getStringRepresentationBlank()  : bool
Whether blank string representations are valid
getStringRepresentationFields()  : array<string|int, mixed>
Returns a list of fields available in the string representation
getStringRepresentationFormat()  : string
Returns the sprintf() format for the string representation
locateFileInAdditionalFileSystem()  : mixed
Locate a file in one of the additional file systems and return the containing file system's root path.

Properties

$additionalFileSystems

An array containing additional file systems of type \Cx\Core\MediaSource\Model\Entity\LocalFileSystem

protected array<string|int, mixed> $additionalFileSystems = array()

$localeCodes

List of locale codes ordered by translation fallback order per Cx instance

protected static array<string|int, mixed> $localeCodes = array()

Array in the form: array(<instanceId> => array(<localeCode>, ...))

Tags
see
getFallbackLocaleCodes()

$nestingCount

Counts the nesting level of __call()

protected static int $nestingCount = 0

$stringRepresentationBlank

Whether blank string representations are valid

protected bool $stringRepresentationBlank = false

Whether blank string representations are valid

Tags
see
getStringRepresentationBlank()

$stringRepresentationFields

List of fields that should be available in the string representation

protected array<string|int, mixed> $stringRepresentationFields = array()

List of field names

Tags
see
getStringRepresentationFields()

$stringRepresentationFormat

Sprintf format for the string representation

protected string $stringRepresentationFormat = ''

Sprintf format string

Tags
see
getStringRepresentationFormat()

$validators

Initialize this array as follows: array( 'columName' => Zend_Validate )

protected array<string|int, mixed> $validators = array()

$virtual

Defines if an entity is virtual and therefore not persistable.

protected bool $virtual = false

Defaults to FALSE - not virtual.

Methods

__call()

Route methods like getName(), getType(), getDirectory(), etc.

public __call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
$methodName : string

Name of method to call

$arguments : array<string|int, mixed>

List of arguments for the method to call

Tags
throws
Exception

If __call() nesting level reaches 20

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

__get()

This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.

public __get(mixed $name) : mixed
Parameters
$name : mixed
Attributes
#[ReturnTypeWillChange]

__toString()

Returns this entity's identifying value

public __toString() : string

By default this returns the same as getKeyAsString(), but this method might get overridden by subclasses.

Return values
string

Identifying value for this entity

createDirectory()

Creates a new directory

public createDirectory(mixed $path, mixed $directory) : string
Parameters
$path : mixed

Path relative to this FS' root

$directory : mixed

Directory name

Tags
todo

Sanitize $directory

Return values
string

Status message

fileExists()

Check whether file exists in the filesytem

public fileExists(File $file) : bool
Parameters
$file : File
Return values
bool

True when exists, false otherwise

getFileFromPath()

Returns the File instance for a given path

public getFileFromPath(mixed $filepath) : File|false

$path needs to be within this FS' root, otherwise this method will return false.

Parameters
$filepath : mixed
Return values
File|false

File instance for $path of false

getFileList()

Returns the file list of installed webdesign templates.

public getFileList(mixed $directory[, mixed $recursive = true ][, mixed $readonly = false ]) : array<string|int, mixed>

Folders of webdesign templates that are not installed, will not be returned.

Parameters
$directory : mixed

Path relative to this FS' root

$recursive : mixed = true

(optional) If set to false, recursion is skipped

$readonly : mixed = false

Set to TRUE to make all files and folders readonly

Return values
array<string|int, mixed>

UTF8 encoded list of file names, see description

getFullFileList()

Return the full/raw file list

public getFullFileList(string $directory[, bool $recursive = true ][, bool $readonly = false ]) : array<string|int, mixed>

This returns the complete list of directories and files in the root directory as they exist in the underlying file system. This method is solely used by this component and should not be used anywhere else. Instead you should use ViewManagerFileSystem::getFileList().

Parameters
$directory : string

Path to fetch the directories and files of

$recursive : bool = true

Whether or not to return any subdirectories

$readonly : bool = false

Set to TRUE to make all files and folders readonly and files.

Return values
array<string|int, mixed>

List of directories and files in $directory

getFullPath()

Get full path of the given file, If file is application template then load from website/codebase path else Path will be checked in the following order 1. website repository 2. server website repository 3. codebase repository

public getFullPath(File $file) : string
Parameters
$file : File
Return values
string

getKeyAsString()

Returns this entity's key

public final getKeyAsString([string $separator = '/' ]) : string

If this entity has a composite key, the fields are separated by $separator.

Parameters
$separator : string = '/'

(optional) Separator for composite key fields, default "/"

Return values
string

Entity key as string

getRootPath()

Get Root path of the filesystem

public getRootPath() : string
Return values
string

getThumbnails()

public getThumbnails(mixed $thumbnailList, mixed $extension, mixed $file, mixed $thumbnails) : mixed
Parameters
$thumbnailList : mixed
$extension : mixed
$file : mixed
$thumbnails : mixed

getTranslatedFieldValue()

Returns the value of a translatable field using fallback mechanisms

public getTranslatedFieldValue(string $fieldName) : mixed

If the field is not translatable its value is returned anyway. Tries to return the value in the following locales (if non-empty):

  • Current locale
  • Default locale
  • All other locales
Parameters
$fieldName : string

Name of a translatable field

initializeValidators()

Set $this->validators

public initializeValidators() : mixed

Validators can be found in lib/FRAMEWORK/Validator.class.php These will be executed if validate() is called

isDirectory()

Check whether file is directory

public isDirectory(File $file) : bool
Parameters
$file : File
Return values
bool

True on success, false otherwise

isImage()

public isImage(mixed $extension) : int
Parameters
$extension : mixed
Return values
int

isVirtual()

Returns the virtuality of the entity

public isVirtual() : bool
Return values
bool

TRUE if the entity is virtual, otherwise FALSE

mergeFileList()

Merge two file lists into one

public mergeFileList(mixed $a, mixed $b) : array<string|int, mixed>
Parameters
$a : mixed
$b : mixed
Return values
array<string|int, mixed>

moveFile()

Moves a file to a new location

public moveFile(File $file, mixed $destination) : string
Parameters
$file : File

File to move

$destination : mixed

Destination path (absolute or relative to this FS' root)

Tags
todo:

Allow to move outside of FS

Return values
string

Status message

readFile()

Read the contents from given file, Check whether the file exists before calling this function

public readFile(File $file) : string
Parameters
$file : File
Return values
string

file content

removeFile()

Removes the given file from the OS FS

public removeFile(File $file) : string
Parameters
$file : File

File to remove

Tags
todo

check whether $file is part of this FS

Return values
string

Status message

removeThumbnails()

public removeThumbnails(File $file) : array<string|int, mixed>
Parameters
$file : File
Return values
array<string|int, mixed>

setRootPath()

Set root path of the filesystem

public setRootPath(string $rootPath) : mixed
Parameters
$rootPath : string
Tags
todo

This shouldn't be possible, drop this method

setVirtual()

Set the virtuality of the entity

public setVirtual(bool $virtual) : mixed
Parameters
$virtual : bool

TRUE to set the entity as virtual or otherwise to FALSE

utf8EncodeArray()

Applies utf8_encode() to keys and values of an array From: http://stackoverflow.com/questions/7490105/array-walk-recursive-modify-both-keys-and-values

public utf8EncodeArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

Array to encode

Return values
array<string|int, mixed>

UTF8 encoded array

writeFile()

Writes $content to $file, erases all existing content

public writeFile(File $file, mixed $content) : mixed
Parameters
$file : File

File to write to

$content : mixed

Content to write

array_merge_recursive()

\array_merge_recursive() behaves unexpected with numerical indexes Fix from http://php.net/array_merge_recursive (array_merge_recursive_new)

protected array_merge_recursive() : array<string|int, mixed>

This method behaves differently than the original since it overwrites already present keys

Return values
array<string|int, mixed>

Recursively merged array

getFallbackLocaleCodes()

Returns a list of all locale codes ordered by fallback order

protected getFallbackLocaleCodes() : array<string|int, mixed>
  • First entry is the current locale
  • Second entry is the default locale (if different from current, it's omitted otherwise)
  • Then all other locales follow (in no particular order)
Tags
todo

Order the array by the fallback order (same as in ContentManager)

Return values
array<string|int, mixed>

List of locale codes

getStringRepresentationBlank()

Whether blank string representations are valid

protected getStringRepresentationBlank() : bool
Return values
bool

Whether blank string representations are valid

getStringRepresentationFields()

Returns a list of fields available in the string representation

protected getStringRepresentationFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of field names

getStringRepresentationFormat()

Returns the sprintf() format for the string representation

protected getStringRepresentationFormat() : string
Return values
string

sprintf() format string

locateFileInAdditionalFileSystem()

Locate a file in one of the additional file systems and return the containing file system's root path.

protected locateFileInAdditionalFileSystem(string $filePath) : mixed

The additional file systems are defined in $this->additionalFileSystems

Parameters
$filePath : string

Path to the file to locate

Return values
mixed

Returns the root path of the file system the file is located in as string. If the file can't be located in any of the additional file systems FALSE is returned.


        
On this page

Search results