$plugins
$plugins : array<mixed,\FAA\Interfaces\Plugin>
The plugin buffer
$plugins : array<mixed,\FAA\Interfaces\Plugin>
The plugin buffer
$context : null|\FAA\Obj\Request|\FAA\Obj\CronJob
Storage for current global context
KnownPlugins() : array<mixed,\FAA\Interfaces\Plugin>
Get the known plugins
Context(null $context = null) : void|null|\FAA\Obj\Request|\FAA\Obj\CronJob
Get/Set the global context
null | $context |
CallHook(string $name, $returns = false, $parameter = null) : boolean
Call hook
Calls the interfaces and plugins that are registered on this hook
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
string | $name | Name of hook |
$returns | ||
$parameter |
Plugin(string $name) : \FAA\Interfaces\Plugin
Get plugin Get one of the registered plugins. This function uses the cache
string | $name | Get plugin instance |
A plugin instance or null when not registered
SystemInformation(\FAA\Obj\Request $request)
\FAA\Obj\Request | $request |
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
string | $root | The path to the base folder |
array | $components | The list of folder components |
boolean | $make | Try to create the folder |
The combined relative path as string
CopyFile(string $source, string $target) : \FAA\Obj\Result
Copy file Copy a single file with obtaining lock on index before
string | $source | Absolute path to source |
string | $target | Absolute path to target |
A system result object
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.
string | $source | The source folder destination |
string | $target | The target folder name |
A system result object
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.
string | $fileName | The path to the file |
boolean | $caseSensitive | Use case sensitive path, defaults to true |
File exists
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
string | $path | Absolute link to the file to open |
integer | $length | Limiter for line length |
A system result object
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
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 |
A system result object
WriteCsv(string $path, array $list, string $delimiter = ';', string $enclosure = "'", string $escape = "\\") : \FAA\Obj\Result
Write a array of entries to csv file
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 |
The write result
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
string | $file | Absolute path to file |
string | $target | The output folder or, null for dynamic one |
The unzip result
Zip(string $source, string $target) : \FAA\Obj\Result
Create a zip archive from folder or file contents
string | $source | |
string | $target |
TailLogfile(string $path, integer $max = 200, integer $buffer = 4096) : \FAA\Obj\Result
tail a log file get set of lines inside a logfile
string | $path | The target log file path |
integer | $max | Maximum buffer length of array |
integer | $buffer | Maximum buffer length of line characters |
A default system result object
GetLock() : \FAA\Obj\Result
obtain lock try to obtain the lock indicated by lock file in var
A default system result object
TryUnLock(integer $pid, string $path = null) : boolean
obtain lock with retry try to obtain the lock indicated by lock file in var
integer | $pid | Additional lock level reliability with process id |
string | $path | Path to lock file to obtain lock at |
A default system result object
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
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 |
True on successful lock otherwise false
RevokeLock() : \FAA\Obj\Result
release lock try to release the lock indicated by lock file in var
A default system result object
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
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) |
A default system result object
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
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 |
A default system result object
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
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 |
A default system result object
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
mixed | $data | The payload to encode |
integer | $mode | Serialize readable or unformatted |
boolean | $crypt | Encrypt the result after serialisation |
A default system result object
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
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 |
A default system result object
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
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) |
True on success otherwise false
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
string | $dir | The root folder path to search in |
string | $ext | Filter by extension |
boolean | $to_int | Convert to integer when set to true |
A list containing the found id's
ReadFolder(string $dir) : array<mixed,\FAA\Obj\Sys\File>
Read folder
Will list all files and folders of a folder
string | $dir | Path to root folder |
An array of file objects
ListFiles(string $dir, string $ext = '/^json$/', boolean $full = false) : array
list files Iterate over directory and list the found files
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 |
A list containing the found files
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
string | $folder | The path to delete |
boolean | $full | Also remove the root folder |
List of deleted folders and files
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
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 |
A system result object containing the files
ConfigGetPreset(string $name) : \FAA\Obj\Result
Load a config preset
Fetch a preset from default system storage location and return it decoded
string | $name | The preset name |
A system result object
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
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 |
The cleared version number
CallExecutable(string $cmd, string $folder, string $outfile = '') : \FAA\Obj\Result
Execute a system command Uses installed executable to perform a system call
string | $cmd | The command to execute |
string | $folder | The working directory |
string | $outfile | Optional output file of the call result |
A system result object
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
A default system result object
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.
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 |
A default system result object
IsBase64(string $string, boolean $simple = true) : boolean
guess if string is base64 will try to guess if the given string is base64
string | $string | The string to check |
boolean | $simple | Use a simple method to check the given content |
True on success otherwise false
SendResponse(\FAA\Obj\Response $res, \FAA\Obj\Request $request)
Sen the response to the browser.
Supports all response types like html or download defined in the given response object.
\FAA\Obj\Response | $res | |
\FAA\Obj\Request | $request |
GetLink(string $path, \FAA\Obj\Domain $dom) : null|\FAA\Obj\Search\Response\Link
Get optimized link Calculate the optimized link expression for the given path including the language
string | $path | The requested raw path |
\FAA\Obj\Domain | $dom | The target domain |
The link object or null when not registered
SetCorsHeader(\FAA\Obj\Request $request) : \FAA\Obj\Response
Set CORS header
Sets CORS header to enable cross domain access in special cases
\FAA\Obj\Request | $request | A system request object |
A system response object
HostReachable(string $host, integer $port = 22, integer $timeout = 2) : boolean
check if host is reachable test if a certain host is reachable at certain port
string | $host | Host name or IP to check |
integer | $port | TCP port to connect to |
integer | $timeout | Number of seconds to wait for a response from remote host |
Indicator if remote host is reachable
ExtractHostName(string $host, integer $length = 2, boolean $port = true) : string
get reduced hostname reduce a hostname to defined components, e.g. when you give www.test.de and set length to 2 you will get test.de
string | $host | Host name to reduce |
integer | $length | The maximum length of components |
boolean | $port | Remove the port number when set false |
The reduced domain to given components count
SendAsJson(\FAA\Obj\Request|\FAA\Obj\Result $request)
\FAA\Obj\Request|\FAA\Obj\Result | $request |
SetCacheHeaders(integer $lifetime = FAA_HTTP_CACHE_BROWSER_DURATION)
Set cache header for http browser caching
set a list of performance header to enable browser side caching When the lifetime is set to a negtive value, the cache will be deactivated
integer | $lifetime | Max lifetime of cache in seconds |
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
string | $encrypt | The string to encrypt |
string | $mc_key | The key |
The encrypted string base64 encoded
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
string | $encrypted | The string to decrypt (must be base64 encoded) |
string | $mc_key | The key |
The decrypted string
handleRootCall(\FAA\Obj\Request $request)
Handle root call
Handle root call cases, these happen when the system is requested with / Will redirect to the corresponding real path for home folder
\FAA\Obj\Request | $request | The system request object |
handleDirectoryCall(string $path, \FAA\Obj\Request $request)
Handle virtual directory call Handle virtual directory call operations that are connected to existing virtual directories
string | $path | The call path |
\FAA\Obj\Request | $request | The system request object |
handleApiCall(\FAA\Obj\Endpoint $endpoint, \FAA\Obj\Request $request)
Handle api call Handle api call operations that are linked to a system widget
\FAA\Obj\Endpoint | $endpoint | A system REST endpoint object |
\FAA\Obj\Request | $request | The system request object |
isSystemOperation(\FAA\Obj\Request $request) : boolean|string
Detect system request Detect if a specific request is a registered system operation
\FAA\Obj\Request | $request |
handleLockedSystem(\FAA\Obj\Request $request)
Handle the system is locked case
Sends a 503 response header including a retry after
\FAA\Obj\Request | $request |
handleSystemCall(string $call, \FAA\Obj\Request $request)
Handle system call Handle system call operations like login, logout and basic session operations
string | $call | The call type |
\FAA\Obj\Request | $request | The system request object |