It's not required to add a path to the PHP library.
Constants and Globals
Difference between global variables and constants
Constants are valid in the full PHP script and are specified without $ mark (e.g.
LBHOMEDIR). Disadvantage of constants is, that they are not expanded inside double-quotes. All LoxBerry constants are written in CAPITAL letters.
Global variables are available in the main script, but they need to be declared as global inside functions. They are, equivalent to the variables in the Perl modules, written in lowercase.
The following table shows all global variables and all constants. Use variables or constants as you prefer. All plugin variables contain your plugin folder. Please remember that both constants and variables are case-sensitive (constants: CAPITAL without $; variables: lowercase with $).
In other languages like bash, you cannot access the PHP variables. For such cases you can use the system environment variables, that do not include the plugin folder.
|Home directory of LoxBerry, usually |
|PLUGIN variables and constants|
|Sub-directory of the current plugin without path, e.g. |
|Absolute path to the HTMLAUTH directory of the active plugin, e.g. |
|Absolute path to the HTML directory of the active plugin, e.g. |
|Absolute path to the template directory of the active plugin, e.g. |
|Absolute path to the data directory of the active plugin, e.g. |
|Absolute path to the log directory of the active plugin, e.g. |
|Absolute path to the config directory of the active plugin, e.g. |
|Absolute path to the bin directory of the active plugin, e.g. |
|SYSTEM variables and constants for LoxBerry-Core developers (plugin devs usually won't need)|
|Absolute path to the SYSTEM HTMLAUTH directory |
|Absolute path to the SYSTEM HTML directory |
|Absolute path to the SYSTEM templates directory |
|Absolute path to the SYSTEM data directory |
|Absolute path to the SYSTEM log directory |
|Absolute path to the SYSTEM config directory |
|Absolute path to the SYSTEM bin directory |
|Absolute path to the SYSTEM bin directory |
Most functions are in the class
LBSystem, therefore they need to be called with
LBSystem::function(). Some functions are in the main namespace and therefore don't require the
LBSystem prefix. The title of every function in this documentation shows how to call it.
Most function names and features are identical to the Perl sibling LoxBerry::System with PHP adjusted syntax.
Returns a pre-formatted date/time string, e.g. to use in logfiles. Without parameter the format is human-readable. With parameters you can request a string that is optimized for file names, or an ISO formatted string.
This function returns from a Unix Epoch timestamp the Loxone timestamp, or, without parameter, the current time as Loxone timestamp.
LoxBerry's configuration saves execution paths to common binaries to stay system independend. As the required binary exists in the binary list, you should favor the variable instead of hard-coding the execution pathes in your plugin.
Miniserver's FTP port is not included in Loxberry's configuration because it is requested on-demand by a webservice call. This function additionally supports Loxone CloudDNS and therefore always returns the correct FTP port.
Returns the LoxBerry network ip address as string.
Searches for the given ip address in the Miniserver list and returns the list number. Use the list number in the array of get_miniservers.
Searches for the given Miniserver name and returns the list number. Use the list number in the array of get_miniservers.
This function returns an two dimension array of LoxBerry's configured Miniservers.
Returns an array with all installed plugins, including version information and icon uri.
Used for config parameters. Returns True if the $text contains a word that fuzzy could mean False.
Used for config parameters. Returns True if the $text contains a word that fuzzy could mean True.
Returns the current user country of LoxBerry (e.g. "at")
Returns the user defined friendly name of this LoxBerry. This is not the hostname.
Returns the network hostname of LoxBerry.
Returns the current user langauge of LoxBerry (e.g. "de")
Returns the current version of LoxBerry (e.g. "0.4.1")
Returns the Apache2 webserver port.
This function returns from a Loxone timestamp the Unix Epoch timestamp .
This function returns a named array with all data of the current plugin from the plugin database. Optionally you can use the pluginname or foldername as parameter, to get the data from the named plugin.
This function returns the currently set plugin loglevel, that the user has set in the plugin management.
Returns the plugin version of your plugin from LoxBerry's plugin database.
Returns the appropriate user language as an array.
Sets the state of LoxBerry to require a reboot. This can be used for example in a plugin, where a change of a setting requires a reboot of LoxBerry.