Settings
in package
Application settings management.
Provides methods for reading, writing, and managing application settings stored in the database, as well as LWT general table operations.
Tags
Table of Contents
Methods
- get() : string
- Get a setting from the database. It can also check for its validity.
- getWithDefault() : string
- Get the settings value for a specific key. Return a default value when possible.
- getZeroOrOne() : int
- Convert a setting to 0 or 1.
- lwtTableCheck() : void
- Check if the _lwtgeneral table exists, create it if not.
- lwtTableGet() : string
- Get a value from the _lwtgeneral table.
- lwtTableSet() : void
- Set a value in the _lwtgeneral table.
- save() : void
- Save the setting identified by a key with a specific value.
Methods
get()
Get a setting from the database. It can also check for its validity.
public
static get(string $key) : string
Parameters
- $key : string
-
Setting key. If $key is 'currentlanguage' or 'currenttext', we validate language/text.
Return values
string —Value in the database if found, or an empty string
getWithDefault()
Get the settings value for a specific key. Return a default value when possible.
public
static getWithDefault(string $key) : string
Parameters
- $key : string
-
Settings key
Return values
string —Requested setting, or default value, or ''
getZeroOrOne()
Convert a setting to 0 or 1.
public
static getZeroOrOne(string $key, string|int $dft) : int
Parameters
- $key : string
-
The setting key
- $dft : string|int
-
Default value to use, should be convertible to string
Tags
Return values
intlwtTableCheck()
Check if the _lwtgeneral table exists, create it if not.
public
static lwtTableCheck() : void
lwtTableGet()
Get a value from the _lwtgeneral table.
public
static lwtTableGet(string $key) : string
Parameters
- $key : string
-
Key to retrieve
Return values
string —Value or empty string if not found
lwtTableSet()
Set a value in the _lwtgeneral table.
public
static lwtTableSet(string $key, string $val) : void
Parameters
- $key : string
-
Key to set
- $val : string
-
Value to store
save()
Save the setting identified by a key with a specific value.
public
static save(string $k, mixed $v) : void
Parameters
- $k : string
-
Setting key
- $v : mixed
-
Setting value, will get converted to string