\FAAObjectHandler

Summary

Methods
Properties
Constants
KnownPlugins()
Context()
CallHook()
Plugin()
SystemInformation()
MkFolder()
CopyFile()
CopyFolder()
FileExists()
ClassExists()
ReadFixedColumnFile()
ReadCsv()
WriteCsv()
Unzip()
Zip()
TailLogfile()
SubstringAfter()
GetLock()
SelfLockedOrOpen()
TryUnLock()
TryGetLock()
RevokeLock()
ExtractExtension()
StripQueryAndAnchor()
ExtractFileName()
ExtractFolderName()
ExtractFolder()
MemoryBytesReadable()
GzCompressFile()
DecodeJsonFile()
DecodeJson()
ArrayToObject()
EncodeJson()
StoreEncodedJson()
DeleteFile()
Chmod()
WriteFile()
GetClassNames()
ListIdFiles()
MimeType()
ListFolders()
ReadFolder()
ListFiles()
Debug()
Warn()
Log()
SysLog()
DropFolder()
FilterFolderFilesByModificationTime()
ConfigGetPreset()
VersionStringToNumber()
CallExecutable()
GetMountedHardDrives()
CollatorExists()
GetSortKey()
CalculateFolderSize()
IsBase64()
UpdateEntity()
RegisterBaseObject()
GetNextOfSequence()
ResolvedTypeFamily()
RegisterContentType()
GetType()
GetRelatedTypes()
GetChildTypes()
FilterTypeListAssoc()
FilterListAssoc()
GetRawObject()
GetObjectDirect()
GetRawObjectDirect()
FormattedId()
GetTranslation()
GetTranslationObject()
IdToPath()
ListEntries()
GetAssignableEntityTypes()
GetEntityTypes()
CleanByRelation()
GetActiveLanguages()
RemoveFieldsFromType()
AddFieldsToType()
AddTabToType()
GetTypeClassPath()
ExtractAttributeNames()
ExtractAttributeOptions()
TypeExists()
GetEntityAttributes()
indexSort()
$ForcedSave
No constants found
RegisterPlugins()
ListImplementedHandlers()
extractTitle()
No protected properties found
N/A
DropFolderRecurse()
Encrypt()
Decrypt()
CalculateFolderSizeRecurse()
updateEntityAttributes()
updateEntityAttribute()
updateEntityAttributeFile()
updateEntityAttributeFileMove()
updateEntityAttributeTable()
updateEntityAttributeRelation()
resolveSubType()
listEntriesOfType()
listFolderEntities()
$plugins
$hooks
$context
$log_template
$file_count
$directory_count
$size
$affected
$classes
$size_unit
$collator
$translations
$active_languages
$assignableTypes
$attribute_options
N/A

Properties

$ForcedSave

$ForcedSave : boolean

Buffer for forced content save state

Type

boolean

$plugins

$plugins : array<mixed,\FAA\Interfaces\Plugin>

The plugin buffer

Type

array<mixed,\FAA\Interfaces\Plugin>

$hooks

$hooks : array

The hooks buffer

Type

array

$log_template

$log_template : string

The template for log messages in ::Log()

Type

string — The template

$file_count

$file_count : integer

File counter used in dir size recursion counter method

Type

integer — The buffer

$directory_count

$directory_count : integer

Dir counter used in dir size recursion counter method

Type

integer — The buffer

$size

$size : integer

Size counter used in dir size recursion counter method

Type

integer — The buffer

$affected

$affected : array

List of affected files and directories in recursion

Type

array — The list of paths

$classes

$classes : array

Buffer for class exists tests

Type

array — The status of the classes

$size_unit

$size_unit : array

Available file size short codes

Type

array — Used in the readable form

$collator

$collator : integer

Cache if collators are available

Type

integer — Initial set to -1

$translations

$translations : array

translation list buffer

Type

array — Buffer with texts

$active_languages

$active_languages : array

The active languages buffer

Type

array

$assignableTypes

$assignableTypes : array

buffer of assignable types

Type

array

$attribute_options

$attribute_options : array

static storage for attribute options

Type

array

Methods

KnownPlugins()

KnownPlugins() : array<mixed,\FAA\Interfaces\Plugin>

Get the known plugins

Returns

array<mixed,\FAA\Interfaces\Plugin>

Context()

Context(null  $context = null) : void|null|\FAA\Obj\Request|\FAA\Obj\CronJob

Get/Set the global context

Parameters

null $context

Returns

void|null|\FAA\Obj\Request|\FAA\Obj\CronJob

CallHook()

CallHook(string  $name,   $returns = false,   $parameter = null) : boolean

Call hook

Calls the interfaces and plugins that are registered on this hook

Available system hooks are:

OnClearAllCache Called when all system caches are cleared at once, has no given argument

OnIndex Called in search index cron job. Has a reference to the job and the list of indexed elements. $parameter contains the content type (ct), the list of changes (list) and the name of the plugin (handler)

OnNewIndex Called in Cache::RecreateIndex with list of files inside the storage folder.

OnSyncronize Called on sync. Gets the list of changed files based on the history buffer. Arguments are similar to OnNewIndex.

RequestOnUrlParsed Called in request constructor, can be used to modify the request itself and the parsed url. Has a reference to the request and the parsed url

OnGetEntityAttributes Called in entity attribute loader. Can be used to modify the whole entity object e.g. add custom fields or tabs.

OnLoadEntityFormPreset Called when using the widget method to get a content type preset. Call is Widget::loadEntityFormPreset $returns is the parsed content type object with resolved attributes.

OnRegisterWidgetIncludes Called on TemplateEngine::renderExtension. Gets as argument the includes list in $param->returns

OnBasketLoadFieldPresetStatus Called in Basket::LoadFieldPresetStatus. Gets as argument the list of available status switches in $param->returns These include a label, value and a set of fields

OnDeleteContent Called in BaseContent when successfully deleted. Gets a reference to the status object and the deleted object. State is referenced in $returns, the deleted object in $parameter

OnAddOrUpdateContent Called in BaseContent when successfully updated or, created. Gets a reference to the status object and the object. State is referenced in $returns, the changed object in $parameter

OnBeforeAddOrUpdateContent Called in base content right before the saver operation State is referenced in $returns, the changed object in $parameter

OnBeforeUserAdminSave Called before saving user data. Gets a reference to the users data payload.

OnUserAdminLoad Called in users widget, when loading own user data (loadSingle). Gets return data and the widget as argument. $returns contains the plain user object, $parameter is a reference to the user widget.

OnUserOwnLoad Called in users widget, when loading own user data (LoadOwn, SendGoogleAuthMail). Gets return data and the widget as argument. $returns contains the plain user object, $parameter is a reference to the user widget.

BasketChangeStatus Hook is called when basket status was changed successfully. $returns contains reference to a system result object. $parameter is an object with the basket instance in key 'basket' and the changes in key 'payload' plus the language

OnBeforeConvertBasketToTask Called right before converting basket to task, has information about the basket and the payload for the new task

OnInitTaskWidget Called in project tasks widget after preparation of data in init call The returns contains an array with the preset data, parameter is the original user request

OnPrepareSiteMapLinks Called in site map generator with returns as result object and $parameter filled with list of links

OnProjectLoadEmployeeRoles Called in project widget when loading employee roles, $returns is the list of roles

OnAfterSendMail Called after successful sending email

OnBeforeResendSendMail Called before sending email to customer (again)

OnAfterPermissionCheck Called in check access to directory, The argument is of type AccessHookArgument, the result a result

OnGetAccessList Called when fetching the user session as last step. Arguments are the response and the user object

OnAfterBasketRegisterUser Called in basket widget after registration of basket is done. Arguments are the result object and an array with user_id and payload as values

OnPreImportContents Called when executing the import cronjob Argument is a file entry after the unzip process

OnRenameFolder Called when renaming the folder by short attribute update or when moving it entirely Called with Result object as return and a FolderMoveHookArgument as parameter

OnDisplay404 Called right before serving the 404 page. Allows the plugins to do some checks before. Argument is the Request object, return is a result object.

OnAddOrUpdateTask Called in task widget on create or update of task Called with Result object as return and a Task as parameter

OnAddService Called on create new service Returns is a result object and param is class with relation and payload

OnCleanupGarbage Called in garbage collect cron job Called with Result object as return and a Job as parameter

OnGetLoginRedirectUrl Called in the getter for the redirect url after successful login Called with Result object as return and the original request url as parameter

OnAfterRelationDelete Called after relation was deleted Called with Result object as return and the combination of relation and content as parameter

OnExecuteSearchUser Call in user search handler Gets the result object nd the search parameters as arguments

OnGetSearchFieldsUser Called after fetch user fields for search The returns argument is the fields of the user

OnUserStatusChange Called after the user active status is change but before saving the user Param is array with user from and target status

OnAfterUserLoginByPassword Called after user password check, param is object with user, credentials and a found indication

OnAfterUserRegisterSession Called after session registration, this is the point where the user is actually logged in Param is the user object.

OnPreUserRegisterSession Called before session registration is done, param is the user object

OnMapArrayIncludes Called after static assets are parsed in template handling Param is the list of links and the result object

OnRenderLoginExtraPre / OnRenderLoginExtra Called on rendering the login template, Response my be usd to add an additional html content

OnAfterRestUserPassword Called after password reset, with arguments result and the user object

Parameters

string $name

Name of hook

$returns
$parameter

Returns

boolean

Plugin()

Plugin(string  $name) : \FAA\Interfaces\Plugin

Get plugin Get one of the registered plugins. This function uses the cache

Parameters

string $name

Get plugin instance

Returns

\FAA\Interfaces\Plugin

A plugin instance or null when not registered

SystemInformation()

SystemInformation(\FAA\Obj\Request  $request) 

Parameters

\FAA\Obj\Request $request

MkFolder()

MkFolder(string  $root, array  $components, boolean  $make = true) : string|boolean

Create folder path

When the make argument set to true this function will try create the folder Return the folder components without root part

Parameters

string $root

The path to the base folder

array $components

The list of folder components

boolean $make

Try to create the folder

Returns

string|boolean —

The combined relative path as string

CopyFile()

CopyFile(string  $source, string  $target) : \FAA\Obj\Result

Copy file Copy a single file with obtaining lock on index before

Parameters

string $source

Absolute path to source

string $target

Absolute path to target

Returns

\FAA\Obj\Result

A system result object

CopyFolder()

CopyFolder(string  $source, string  $target) : \FAA\Obj\Result

Copy folder This method copies the source folder to the target folder path. The folder itself is not coiped but all of its contents.

This method creates the target folder f it is not present.

Parameters

string $source

The source folder destination

string $target

The target folder name

Returns

\FAA\Obj\Result

A system result object

FileExists()

FileExists(string  $fileName, boolean  $caseSensitive = true) : boolean

Check if file exists

Does check if a file is existing, will also check if the file exists as lower case by glob as fallback.

Parameters

string $fileName

The path to the file

boolean $caseSensitive

Use case sensitive path, defaults to true

Returns

boolean —

File exists

ClassExists()

ClassExists(string  $className) : boolean

Class exists

A cached version of class exists to prevent autoloader from starting

Parameters

string $className

The name of the calss

Returns

boolean —

Status is existing

ReadFixedColumnFile()

ReadFixedColumnFile(string  $path, integer  $length = 10000) : \FAA\Obj\Result

Read file with fixed column width

Automatic file parser based on the heads and assuming a " " space is used to make the cols equal

Parameters

string $path

Absolute link to the file to open

integer $length

Limiter for line length

Returns

\FAA\Obj\Result

A system result object

ReadCsv()

ReadCsv(string  $path, string  $delimiter = ';', string  $enclosure = "'", integer  $length = 100000, string  $escape = "\\", boolean  $check_head = true) : \FAA\Obj\Result

Read a CSV file to local storage

Fetch the file and add it to a local result object file is parsed with php function to get csv from file, arguments of this methods align with official one

Parameters

string $path

The absolute path to file to open

string $delimiter

Have a look at http://php.net/manual/de/function.fgetcsv.php delimiter

string $enclosure

Have a look at http://php.net/manual/de/function.fgetcsv.php enclosure

integer $length

Have a look at http://php.net/manual/de/function.fgetcsv.php length

string $escape

Have a look at http://php.net/manual/de/function.fgetcsv.php escape

boolean $check_head

When set, check the first line as head and validate following line lengths

Returns

\FAA\Obj\Result

A system result object

WriteCsv()

WriteCsv(string  $path, array  $list, string  $delimiter = ';', string  $enclosure = "'", string  $escape = "\\") : \FAA\Obj\Result

Write a array of entries to csv file

Parameters

string $path

The absolute path to file to open

array $list

The source to write

string $delimiter

Have a look at http://php.net/manual/de/function.fgetcsv.php delimiter

string $enclosure

Have a look at http://php.net/manual/de/function.fgetcsv.php enclosure

string $escape

Have a look at http://php.net/manual/de/function.fgetcsv.php escape

Returns

\FAA\Obj\Result

The write result

Unzip()

Unzip(string  $file, string  $target = null) : \FAA\Obj\Result

Unzip a file

Take the archive, unzip it and place the results in the defined folder or an automated one

Parameters

string $file

Absolute path to file

string $target

The output folder or, null for dynamic one

Returns

\FAA\Obj\Result

The unzip result

Zip()

Zip(string  $source, string  $target) : \FAA\Obj\Result

Create a zip archive from folder or file contents

Parameters

string $source
string $target

Returns

\FAA\Obj\Result

TailLogfile()

TailLogfile(string  $path, integer  $max = 200, integer  $buffer = 4096) : \FAA\Obj\Result

tail a log file get set of lines inside a logfile

Parameters

string $path

The target log file path

integer $max

Maximum buffer length of array

integer $buffer

Maximum buffer length of line characters

Returns

\FAA\Obj\Result

A default system result object

SubstringAfter()

SubstringAfter(  $string,   $needle,   $offset) 

Parameters

$string
$needle
$offset

GetLock()

GetLock() : \FAA\Obj\Result

obtain lock try to obtain the lock indicated by lock file in var

Returns

\FAA\Obj\Result

A default system result object

SelfLockedOrOpen()

SelfLockedOrOpen(  $pid,   $path = null) 

Parameters

$pid
$path

TryUnLock()

TryUnLock(integer  $pid, string  $path = null) : boolean

obtain lock with retry try to obtain the lock indicated by lock file in var

Parameters

integer $pid

Additional lock level reliability with process id

string $path

Path to lock file to obtain lock at

Returns

boolean —

A default system result object

TryGetLock()

TryGetLock(string  $path = null, integer  $try_count = FAA_WRITE_RETRY, float  $seconds = 0.25, integer  $pid) : boolean

obtain lock with retry try to obtain the lock indicated by lock file in var

Parameters

string $path

Path to lock file to obtain lock at

integer $try_count

Number of retry runs

float $seconds

Seconds to wait per run

integer $pid

Additional lock level reliability with process id

Returns

boolean —

True on successful lock otherwise false

RevokeLock()

RevokeLock() : \FAA\Obj\Result

release lock try to release the lock indicated by lock file in var

Returns

\FAA\Obj\Result

A default system result object

ExtractExtension()

ExtractExtension(string  $path) : string

Extract file extension

May return false if no extension could be found

Parameters

string $path

A complete file path

Returns

string —

The file extension

StripQueryAndAnchor()

StripQueryAndAnchor(string  $path) : string

Extract file name

Parameters

string $path

A complete file path

Returns

string —

The file name without additional parts

ExtractFileName()

ExtractFileName(string  $path) : string

Extract file name

Parameters

string $path

A complete file path

Returns

string —

The file name

ExtractFolderName()

ExtractFolderName(string  $path) : string

Extract folder name from root

Parameters

string $path

A complete file path

Returns

string —

The file root folder

ExtractFolder()

ExtractFolder(string  $path) : string

Extract folder path from root

Parameters

string $path

A complete file path

Returns

string —

The file root folder

MemoryBytesReadable()

MemoryBytesReadable(integer  $size) : string

Memory readable Convert size of bytes in human readable units

Parameters

integer $size

The size in bytes

Returns

string —

The calculated size

GzCompressFile()

GzCompressFile(string  $source, integer  $level = 9, boolean  $clean = true) : \FAA\Obj\Result

GZIPs a file on disk (appending .gz to the name)

From http://stackoverflow.com/questions/6073397/how-do-you-create-a-gz-file-using-php Based on function by Kioob at: http://www.php.net/manual/en/function.gzwrite.php#34955

Parameters

string $source

Path to file that should be compressed

integer $level

GZIP compression level (default: 9)

boolean $clean

Clean source file after compression (default: true)

Returns

\FAA\Obj\Result

A default system result object

DecodeJsonFile()

DecodeJsonFile(string  $path,   $mode = true,   $crypt = false) : \FAA\Obj\Result

parse json from file to object or assoc use the json parse to fetch text data from a given path and return it as object with assoc or object payload

Parameters

string $path

The absolute path to a certain storage file

$mode

(boolean) Parse as assoc or object, default assoc

$crypt

(boolean) Decrypt string before parsing

Returns

\FAA\Obj\Result

A default system result object

DecodeJson()

DecodeJson(string  $data, boolean  $mode = true, boolean|string  $crypt = false) : \FAA\Obj\Result

Parse json from string to object or assoc

Use the json parse function to decode a string to assoc or object It will use the given code in crypt to decrypt or fall back to system key

Parameters

string $data

The payload to decode

boolean $mode

Parse as assoc or object, default is true and therefor assoc array

boolean|string $crypt

Decrypt string before parsing

Returns

\FAA\Obj\Result

A default system result object

ArrayToObject()

ArrayToObject(array  $array) : \stdClass

Convert array to object

Convert the given array element to object, using the json methods

Parameters

array $array

The input values to convert

Returns

\stdClass —

The converted element as object

EncodeJson()

EncodeJson(mixed  $data, integer  $mode = JSON_PRETTY_PRINT, boolean  $crypt = false) : \FAA\Obj\Result

Serialize a given input to json representation use the json parse function to decode an assoc or object

Parameters

mixed $data

The payload to encode

integer $mode

Serialize readable or unformatted

boolean $crypt

Encrypt the result after serialisation

Returns

\FAA\Obj\Result

A default system result object

StoreEncodedJson()

StoreEncodedJson(string  $path, mixed  $data, integer  $mode = JSON_PRETTY_PRINT, boolean  $crypt = false) : \FAA\Obj\Result

serialize a given input use the json parse function to create json representation and store it in a certain file this method does a encryption also on demand

Parameters

string $path

The target file path

mixed $data

The payload to encode

integer $mode

Serialize readable or not formatted

boolean $crypt

Encrypt the result after serialisation

Returns

\FAA\Obj\Result

A default system result object

DeleteFile()

DeleteFile(string  $path) : boolean

Deletes single file This method deletes a single file, it will wait when the system is in git lock mode

Parameters

string $path

The target file path

Returns

boolean —

True on success otherwise false

Chmod()

Chmod(  $file,   $octal) : boolean

Chamge the permissions

Parameters

$file
$octal

Returns

boolean

WriteFile()

WriteFile(string  $path, string  $data, integer  $flags) : boolean

Write string to file This method writes the given data to the defined file, it will wait when the system is in git lock mode.

This method returns valid result also for writing empty strings unlike file put contents default behavior

Parameters

string $path

The target file path

string $data

The payload to store in the target file

integer $flags

File put content flags (http://php.net/manual/de/function.file-put-contents.php)

Returns

boolean —

True on success otherwise false

GetClassNames()

GetClassNames(array  $paths) : array

List classes in folder Fetch a list of classes inside the folder

Parameters

array $paths

List of paths to search

Returns

array —

A list of class names found in the folder

ListIdFiles()

ListIdFiles(string  $dir, string  $ext = 'json', boolean  $to_int = true) : array

find file ids find a list of file ids inside a folder and its sub directories

Parameters

string $dir

The root folder path to search in

string $ext

Filter by extension

boolean $to_int

Convert to integer when set to true

Returns

array —

A list containing the found id's

MimeType()

MimeType(string  $file) : string

Get mime type of file

Parameters

string $file

The absolute file path

Returns

string —

The mime type of the file

ListFolders()

ListFolders(string  $path) : array

List folder names in certain root folder

Parameters

string $path

The absolute path to the folder

Returns

array

ReadFolder()

ReadFolder(string  $dir) : array<mixed,\FAA\Obj\Sys\File>

Read folder

Will list all files and folders of a folder

Parameters

string $dir

Path to root folder

Returns

array<mixed,\FAA\Obj\Sys\File> —

An array of file objects

ListFiles()

ListFiles(string  $dir, string  $ext = '/^json$/', boolean  $full = false) : array

list files Iterate over directory and list the found files

Parameters

string $dir

The root folder path to search in

string $ext

Filter by extension (can be empty, a string or a regex)

boolean $full

Check the full name of the file or just the extension when false

Returns

array —

A list containing the found files

Debug()

Debug(  $object) 

log debug object writs a formatted log message including back trace to the global log file

Parameters

$object

(mixed) The object to be logged

Warn()

Warn(  $object) 

log warn object writs a formatted log message including back trace to the global log file

Parameters

$object

(mixed) The object to be logged

Log()

Log(mixed  $object, string  $msg = null) 

log object writs a formatted log message including back trace to the global log file

Parameters

mixed $object

The object to be logged

string $msg

Additional message

SysLog()

SysLog(string  $level, mixed  $object) : boolean

log message writs a formatted log message including back trace to the global log file

Parameters

string $level

Name of the log level

mixed $object

The object to be logged

Returns

boolean —

Status if write to log worked

DropFolder()

DropFolder(string  $folder, boolean  $full = false) : array

Delete a full folder this method clears or delete a folder recursively, side effect will fill list of delete folders and files

Parameters

string $folder

The path to delete

boolean $full

Also remove the root folder

Returns

array —

List of deleted folders and files

FilterFolderFilesByModificationTime()

FilterFolderFilesByModificationTime(string  $root, integer  $timestamp, boolean  $older = true) : \FAA\Obj\Result

Get a list of files that are either older or newer a certain time point

Parameters

string $root

The start point for the recursion

integer $timestamp

The time point to flip

boolean $older

When true result list files are older than the time stamp otherwise newer

Returns

\FAA\Obj\Result

A system result object containing the files

ConfigGetPreset()

ConfigGetPreset(string  $name) : \FAA\Obj\Result

Load a config preset

Fetch a preset from default system storage location and return it decoded

Parameters

string $name

The preset name

Returns

\FAA\Obj\Result

A system result object

VersionStringToNumber()

VersionStringToNumber(string  $number, string  $regex = '/[^0-9\.]/i', string  $replace = '', integer  $pads = 4) : string

Convert version number Converts the given number to a unified string e.g. 'v1.234.33' will become 102340033

Parameters

string $number

The version number to calculate

string $regex

Replacement expression to clear the number upfront

string $replace

Replacement string for regex_replace

integer $pads

Add this amount of zeros to the left

Returns

string —

The cleared version number

CallExecutable()

CallExecutable(string  $cmd, string  $folder, string  $outfile = '') : \FAA\Obj\Result

Execute a system command Uses installed executable to perform a system call

Parameters

string $cmd

The command to execute

string $folder

The working directory

string $outfile

Optional output file of the call result

Returns

\FAA\Obj\Result

A system result object

GetMountedHardDrives()

GetMountedHardDrives() : \FAA\Obj\Result

list available disk space use system commands to retrieve disk informations, this method is partial cached On windows we use fsutil on *nix we use df -h

Returns

\FAA\Obj\Result

A default system result object

CollatorExists()

CollatorExists() : boolean

Check if collators available Test if the ICU collator functions ae available. This function is cached.

Returns

boolean —

True when collator is available

GetSortKey()

GetSortKey(string  $text, string  $collation = FAA_LOCALE, boolean  $encode = false) : \FAA\Obj\Result

Calculate the sort key Using the ICU collator to create a sort key representation of the given string.

Parameters

string $text

The text to convert to sort key

string $collation

The collation to use for convert e.g. en_US or, de

boolean $encode

When set to true, convert the sort key to urlencoded representation

Returns

\FAA\Obj\Result

A default system result object

CalculateFolderSize()

CalculateFolderSize(string  $folder) : array

calculate size of a specific folder use a recursive working function to calculate a folder size

Parameters

string $folder

The path to calculate the size of

Returns

array —

A assoc structure holding the folder information

IsBase64()

IsBase64(string  $string, boolean  $simple = true) : boolean

guess if string is base64 will try to guess if the given string is base64

Parameters

string $string

The string to check

boolean $simple

Use a simple method to check the given content

Returns

boolean —

True on success otherwise false

UpdateEntity()

UpdateEntity(\FAA\Obj\Generic\BaseContent  $entity, array  $data, boolean  $validate = false) : \FAA\Obj\Result

update object apply changes to a certain object using the given change data set

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

array $data

An associative array containing the values for update

boolean $validate

Interpret results with attribute rules

Returns

\FAA\Obj\Result

A system result object

RegisterBaseObject()

RegisterBaseObject(string  $type, string|array<mixed,string>  $base_type = null) : \FAA\Obj\Result

Register a basic content object by type Create a content object

Parameters

string $type

The content type name, lowercase

string|array<mixed,string> $base_type

Alternative list of filter content types or a string with the root type

Returns

\FAA\Obj\Result

A default system result object

GetNextOfSequence()

GetNextOfSequence(string  $type) : \FAA\Obj\Result

Interface function to get a set of ids

Parameters

string $type

The system object type

Returns

\FAA\Obj\Result

A result object with a numeric unique id as payload

ResolvedTypeFamily()

ResolvedTypeFamily(string  $root, string|null  $language = null) : \FAA\Obj\Result

Get resolved family list of types

Parameters

string $root

Name of the root type to resolve

string|null $language

The language to resolve for

Returns

\FAA\Obj\Result

A system result object

RegisterContentType()

RegisterContentType(  $payload) : \FAA\Obj\Result

Register a new content type

Creates a new content type preset element This method is capable of creation internal or additional content type presets. It will generate the basic code part and the structure json.

Parameters

$payload

array The content type data

Returns

\FAA\Obj\Result

A system result object

GetType()

GetType(string  $typename) : \FAA\Obj\Generic\Type|null

Get certain content type by name

Parameters

string $typename

The key of the type

Returns

\FAA\Obj\Generic\Type|null —

The resolved type object or null when not found

GetRelatedTypes()

GetRelatedTypes(string  $typename) : \FAA\Obj\Result

Get plain list of related types (top and down)

Parameters

string $typename

The key of the type

Returns

\FAA\Obj\Result

A system result object when found, with array of types in payload

GetChildTypes()

GetChildTypes(string|array  $typename) : \FAA\Obj\Result

get types and subtypes form storage load the list of registered and related object types

Parameters

string|array $typename

A system type name or, a list of names

Returns

\FAA\Obj\Result

A system result object

FilterTypeListAssoc()

FilterTypeListAssoc(string  $type, array  $filters, string  $language = '') : \FAA\Obj\Result

filter result list by type does a quick filtering in the given list, this method operates language independant results will be determinated using a strpos() operation

Parameters

string $type

A array of system object types or a string with a single type name

array $filters

The search parameter

string $language

The language to search in

Returns

\FAA\Obj\Result

A result objects with found values

FilterListAssoc()

FilterListAssoc(array<mixed,\FAA\Obj\Generic\BaseContent>  $list, array  $filters, string  $language = '') : array<mixed,\FAA\Obj\Generic\BaseContent>

filter result list does a quick filtering in the given list, this method operates language independent results will be specified using a strpos() operation

Parameters

array<mixed,\FAA\Obj\Generic\BaseContent> $list

A array of system objects

array $filters

The search filters with value and matcher type

string $language

The language to search in

Returns

array<mixed,\FAA\Obj\Generic\BaseContent> —

A list of system content objects

GetRawObject()

GetRawObject(integer  $id, string  $type) : \FAA\Obj\Result

Get entity form storage Load the attributes of a certain object type identified by id

Parameters

integer $id

The object id

string $type

The object type

Returns

\FAA\Obj\Result

A default system result object

GetObjectDirect()

GetObjectDirect(integer|string  $id, string  $type, string  $hash = '') : \FAA\Obj\Generic\BaseContent

Get entity instance

Load the full object of a certain object type identified by id, only available for not named object types. Can fetch versions of the object. Will return null in case of error.

Parameters

integer|string $id

The object id

string $type

The object type

string $hash

When set the system will try to fetch a certain version of the object from storage

Returns

\FAA\Obj\Generic\BaseContent

The content instance or, null

GetRawObjectDirect()

GetRawObjectDirect(integer|string  $id, string  $type, string  $hash = '') : \FAA\Obj\Result

Get raw entity form storage Load the full object of a certain object type identified by id, only available for not named object types

Parameters

integer|string $id

The object id

string $type

The object type

string $hash

When set the system will try to fetch a certain version of the object from storage

Returns

\FAA\Obj\Result

A default system result object

FormattedId()

FormattedId(integer  $id, string  $prefix, string  $pad_string = '0', integer  $pad_length = 5, integer  $pad_type = STR_PAD_LEFT) : string

expose the formatted object id provide an interface to extract the current id with formatting options

Parameters

integer $id

A object id

string $prefix

A prefix

string $pad_string

The pad character

integer $pad_length

The padding length

integer $pad_type

The padding type

Returns

string —

The formatted id

GetTranslation()

GetTranslation(string  $data, string  $l, string  $type = 'code', string  $src = '') : \FAA\Obj\Result

get translations fetch translation data from storage or add on demand

Parameters

string $data

Pointer to text for translation

string $l

Language code

string $type

Type of translation

string $src

Relative path to source file

Returns

\FAA\Obj\Result

A default system result object

GetTranslationObject()

GetTranslationObject(string  $id) : \FAA\Obj\Generic\Translation

Fetch translation Load a single translation instance

Parameters

string $id

Object id

Returns

\FAA\Obj\Generic\Translation

A system translation object or null

IdToPath()

IdToPath(integer  $id, string  $type, string  $root = FAA_PATHS_DATAABS, boolean  $mkdir = true) : string

Convert id to path Convert the given numeric id to absolute path

Parameters

integer $id

A content id

string $type

The content type

string $root

The data root folder, defaults is system data storage folder

boolean $mkdir

Create directory on demand

Returns

string —

The absolute folder path

ListEntries()

ListEntries(string  $dir = null, mixed  $types = 'generic', string  $language = null, boolean  $raw = false) : \FAA\Obj\Result

list generic objects Read a list of groups from local storage Uses the generic object load to get the entry list

Parameters

string $dir

Absolute path to source dir or, null

mixed $types

The requested object type or a list of types

string $language

The language code or null for not translated view

boolean $raw

Return entries as raw objects or normalized

Returns

\FAA\Obj\Result

A default system result set

GetAssignableEntityTypes()

GetAssignableEntityTypes(string  $language = null, boolean  $plain = false) : \FAA\Obj\Result

Get entity type set of assignable contents

Load the list of registered system content types that have tha assignable flag. The list can be either objects or simple names of types. This method is cached.

Parameters

string $language

The language code or null for raw view

boolean $plain

When true, return only names of the elements

Returns

\FAA\Obj\Result

A system result object

GetEntityTypes()

GetEntityTypes(string  $language = null, boolean  $skipattributes = false) : \FAA\Obj\Result

Get entity type set

Load the list of registered system content types

Parameters

string $language

The language code or null for raw view

boolean $skipattributes

Skip attributes when true

Returns

\FAA\Obj\Result

A system result object

CleanByRelation()

CleanByRelation(\FAA\Obj\Generic\BaseContent  $relation) : \FAA\Obj\Result

Delete entity from file system and git repo

This method can delete a content object from our local storage system

Parameters

\FAA\Obj\Generic\BaseContent $relation

The reference to the system content

Returns

\FAA\Obj\Result

A default system result set

GetActiveLanguages()

GetActiveLanguages() : array

Get active languages

Create a list of active languages and return as array of strings. This method is cached locally

Returns

array —

The active language keys

RemoveFieldsFromType()

RemoveFieldsFromType(\stdClass  $type, array  $fields) 

Remove fields from type

Remove some fields from the element type e.g. when inherited from parent.

Parameters

\stdClass $type

A simplified object type data set

array $fields

A list of fields to remove

AddFieldsToType()

AddFieldsToType(\stdClass  $type, array  $fields) 

Add fields to type

Add some fields to the element type.

Parameters

\stdClass $type

A simplified object type data set

array $fields

A list of fields to add

AddTabToType()

AddTabToType(object  $type, object  $tab) 

Add tab to type

Can be used in hook to assign an "virtual" tab to an existing content type definition

Parameters

object $type

A resolved type object

object $tab

A tab configuration to assign

GetTypeClassPath()

GetTypeClassPath(string  $typeName, boolean  $system = false) : string

Get path to class

Resolve the path to a certain content type, either to a system or a additional type

Parameters

string $typeName

Name of the content type

boolean $system

When true search in system path

Returns

string

ExtractAttributeNames()

ExtractAttributeNames(string  $type_id, string  $language = FAA_DEFAULT_LANGUAGE) : array

Get attribute names

Get just the list of translated attributes of an content type. This method is cached locally.

Parameters

string $type_id

Name of the type to resolve

string $language

Translate language

Returns

array —

The list of attributes

ExtractAttributeOptions()

ExtractAttributeOptions(string  $type_id, string  $attribute_name, string  $language = FAA_DEFAULT_LANGUAGE, integer|string  $table_index = -1) : \FAA\Obj\Result

Get translated options list of attribute

Extract list of labels from a certain attribute from a certain content type. This method is cached in static context of this class.

Parameters

string $type_id

The content type id

string $attribute_name

The target attribute name

string $language

The language to translate for, when given default "__" the item labels are not resolved

integer|string $table_index

The index in the table heads. may be -1 for regular resolve, can be a string as well

Returns

\FAA\Obj\Result

A system result object

TypeExists()

TypeExists(  $typeName) : string|null

Check if content type exists and return path to definition file

Parameters

$typeName

Returns

string|null

GetEntityAttributes()

GetEntityAttributes(string  $typeName, string  $language = null, boolean  $parentresolve = false, array  $recurse = array(), boolean  $skipattributes = false, boolean  $skiphook = false) : \FAA\Obj\Result

Get entity form attributes

Load the attribute set of a certain object type Will resolve parent attributes and tas as well, when defined

Parameters

string $typeName

The content type key

string $language

The language code or null for raw view

boolean $parentresolve

When true, resolve with parents

array $recurse

List of called parent object types

boolean $skipattributes

When set to true we skip attributes

boolean $skiphook

When set to true we skip the hook calls

Returns

\FAA\Obj\Result

A system result object

indexSort()

indexSort(  $a,   $b) 

Parameters

$a
$b

RegisterPlugins()

RegisterPlugins() 

Register plugins

Load the plugins from filesystem and register them for hook calling This function is cached.

ListImplementedHandlers()

ListImplementedHandlers(string  $type) : array

Get sender list Get the list of registered handlers

Parameters

string $type

The handler folder to search in

Returns

array —

A list of registered handlers

extractTitle()

extractTitle(\stdClass  $content, string  $language) : string

Get title Extract a translated title

Parameters

\stdClass $content

A content object

string $language

The content language

Returns

string —

The translated title

DropFolderRecurse()

DropFolderRecurse(string  $folder, boolean  $full = false) : boolean

delete a full folder this method is the recursion helper for DropFolder()

Parameters

string $folder

The path to delete

boolean $full

Also remove the root folder

Returns

boolean —

The delete status

Encrypt()

Encrypt(string  $encrypt, string  $mc_key = FAA_CODE) : string

encrypt data will try to encrypt the given data with the system encryption code or a customer defined one The function does a blowfish encryption and a base64 conversion

Parameters

string $encrypt

The string to encrypt

string $mc_key

The key

Returns

string —

The encrypted string base64 encoded

Decrypt()

Decrypt(string  $encrypted, string  $mc_key = FAA_CODE) : string

decrypt data will try to decrypt the given data with the system encryption code or a customer defined one The function does a blowfish decryption and a base64 conversion on demand

Parameters

string $encrypted

The string to decrypt (must be base64 encoded)

string $mc_key

The key

Returns

string —

The decrypted string

CalculateFolderSizeRecurse()

CalculateFolderSizeRecurse(string  $folder) : boolean

Helper function to calculate size Recursively calculate size of a specific folder

Parameters

string $folder

The path to calculate the size of

Returns

boolean —

The delete result status

updateEntityAttributes()

updateEntityAttributes(\FAA\Obj\Generic\BaseContent  $entity, \FAA\Obj\Result  $result, \stdClass  $attrSet, mixed  $data, boolean  $validate, string  $prefix = '') 

update object attribute list apply changes to a certain object using the given change dataset

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

\FAA\Obj\Result $result

A system result object

\stdClass $attrSet

An object containing the attribute definitions

mixed $data

The new value for this attribute

boolean $validate

Interpret results with attribute rules

string $prefix

A prefix in child mode

updateEntityAttribute()

updateEntityAttribute(\FAA\Obj\Generic\BaseContent  $entity, \FAA\Obj\Result  $result, \stdClass  $attr, mixed  $data, boolean  $validate, string  $prefix = '') 

update object attribute apply changes to a certain object attribute using the given change dataset

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

\FAA\Obj\Result $result

A system result object

\stdClass $attr

An object containing the attribute definitions

mixed $data

The new value for this attribute

boolean $validate

Interpret results with attribute rules

string $prefix

A prefix in child mode

updateEntityAttributeFile()

updateEntityAttributeFile(\FAA\Obj\Generic\BaseContent  $entity, \FAA\Obj\Result  $result, \stdClass  $attr, mixed  $data, string  $field_key = '') 

update object attribute of type file apply changes to a certain object attribute using the given change dataset

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

\FAA\Obj\Result $result

A system result object

\stdClass $attr

An object containing the attribute definitions

mixed $data

The new value for this attribute

string $field_key

When this is a sub element, the path to the attribute

updateEntityAttributeFileMove()

updateEntityAttributeFileMove(array  $file, object  $attr, \FAA\Obj\Result  $result) : null|string

Helper for upload file moving

Parameters

array $file

The file setting with path aso.

object $attr

The resolved attribute

\FAA\Obj\Result $result

A result object

Returns

null|string —

The target storage path

updateEntityAttributeTable()

updateEntityAttributeTable(\FAA\Obj\Generic\BaseContent  $entity, \FAA\Obj\Result  $result, \stdClass  $attr, array  $data, string  $field_key = '') 

update object attribute of type relation apply changes to a certain object attribute using the given change dataset

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

\FAA\Obj\Result $result

A system result object

\stdClass $attr

An object containing the attribute definitions

array $data

The new value for this attribute

string $field_key

When this is a sub element, the path to the attribute

updateEntityAttributeRelation()

updateEntityAttributeRelation(\FAA\Obj\Generic\BaseContent  $entity, \FAA\Obj\Result  $result, \stdClass  $attr, mixed  $data, string  $fieldkey = '') 

update object attribute of type relation apply changes to a certain object attribute using the given change dataset

Parameters

\FAA\Obj\Generic\BaseContent $entity

A system object ob base content or children

\FAA\Obj\Result $result

A system result object

\stdClass $attr

An object containing the attribute definitions

mixed $data

The new value for this attribute

string $fieldkey

When this is a sub element, the path to the attribute

resolveSubType()

resolveSubType(  $res,   $hide_child_fields,   $direct_relation_type, null  $language = null, boolean  $parentresolve = true, array  $recurse = array(), boolean  $skipattributes = false, boolean  $skiphook = false) : \stdClass|null

Resolve a sub type using the given preset definition

Parameters

$res
$hide_child_fields
$direct_relation_type
null $language
boolean $parentresolve
array $recurse
boolean $skipattributes
boolean $skiphook

Returns

\stdClass|null

listEntriesOfType()

listEntriesOfType(string  $dir, string  $type, string  $language, boolean  $raw) : \FAA\Obj\Result

list generic objects Read a list of groups from local storage Uses the generic object load to get the entry list

Parameters

string $dir

Absolute path to source dir or, null

string $type

The requested object type

string $language

The language code or null for not translated view

boolean $raw

Return entries as raw objects or normalized

Returns

\FAA\Obj\Result

A default system result set

listFolderEntities()

listFolderEntities(string  $dir, string  $type) : array

list folder entries using a given directory this function can return the id's of all files in the folder this method is cached by object cache

Parameters

string $dir

Path to folder (absolute)

string $type

Type of store elements (raw / plain)

Returns

array —

List of folder files