AbstractSettings AbstractSettings(
string
$db_table_name, array
$col_key_names, string
$col_value_name, [integer
$cache_by_col_keys = 0]
)
|
|
Constructor.
Parameters:
|
string |
$db_table_name: |
The name of the DB table with the settings stored. |
|
array |
$col_key_names: |
List of names for the DB columns keys that reference a value. |
|
string |
$col_value_name: |
The name of the DB column that holds the value. |
|
integer |
$cache_by_col_keys: |
The number of column keys to cache by. This are the first x keys of $col_key_names. 0 means 'load all'. |
Commit changed settings to DB.
API Tags:
| Return: | true, if settings have been updated; false otherwise |
Redefined in descendants as:
boolean delete(
array
$args
)
|
|
Remove a setting.
Parameters:
Redefined in descendants as:
void delete_array(
array
$array
)
|
|
Delete an array of values.
Parameters:
|
array |
$array: |
Array of parameters for delete() |
string|false|NULL get(
string
$col_key1, [string
$col_key2 = NULL], [string
$col_key3 = NULL]
)
|
|
Get a setting from the DB settings table.
Parameters:
|
string |
$col_key1: |
First column key |
|
string |
$col_key2: |
Second column key |
|
string |
$col_key3: |
Third column key |
API Tags:
Redefined in descendants as:
boolean get_cond(
mixed
&$toset, string
1
)
|
|
Only set the first variable (passed by reference) if we could retrieve a setting.
Parameters:
|
string |
1: |
the values for the column keys (depends on $this->col_key_names and must match its count and order) |
|
mixed |
&$toset: |
variable to set maybe (by reference) |
API Tags:
| Return: | true on success (variable was set), false if not |
NULL|mixed get_default(
string
$last_key
)
|
|
Get the default for the last key of $col_key_names
Parameters:
|
string |
$last_key: |
The last column key |
API Tags:
Load all settings, disregarding the derived classes setting of $cache_by_col_keys- useful if you know that you want to get
all user settings for example.
NULL|mixed param_Request(
string
$param_name, string
$set_name, [string
$type = ''], [mixed
$default = ''], [boolean
$memorize = false], [boolean
$override = false]
)
|
|
Get a param from Request and save it to Settings, or default to previously saved user setting.
If the setting was not set before (and there's no default given that gets returned), $default gets used.
Parameters:
|
string |
$param_name: |
Request param name |
|
string |
$set_name: |
setting name. Make sure this is unique! |
|
string |
$type: |
Force value type to one of: - integer
- float
- string (strips (HTML-)Tags, trims whitespace)
- array
- object
- null
- html (does nothing)
- '' (does nothing)
- '/^...$/' check regexp pattern match (string)
- boolean (will force type to boolean, but you can't use 'true' as a default since it has special meaning. There is no real reason to pass booleans on a URL though. Passing 0 and 1 as integers seems to be best practice).
Value type will be forced only if resulting value (probably from default then) is !== NULL |
|
mixed |
$default: |
Default value or TRUE |
|
boolean |
$memorize: |
Do we need to memorize this to regenerate the URL for this page? |
|
boolean |
$override: |
Override if variable already set |
API Tags:
| Return: | NULL, if neither a param was given nor knows about it. |
Redefined in descendants as:
Reset cache (includes settings to be written to DB).
This is useful, to rollback settings that have been made, e.g. when a Plugin decides that his settings should not get updated.
boolean restore_defaults(
)
|
|
Delete values for $_defaults in DB.
This will use the default settings on the next get() again.
API Tags:
| Return: | true, if settings have been updated; false otherwise |
boolean set(
string
$args,...
)
|
|
Temporarily sets a setting (dbupdate() writes it to DB).
Parameters:
API Tags:
| Return: | true, if the value has been set, false if it has not changed. |
Redefined in descendants as:
void set_array(
array
$array
)
|
|
Set an array of values.
Parameters:
|
array |
$array: |
Array of parameters for set() |
boolean _load(
[string
$arg1 = NULL], [string
$arg2 = NULL], [string
$arg3 = NULL]
)
|
|
Loads the settings. Not meant to be called directly, but gets called when needed.
Parameters:
|
string |
$arg1: |
First column key |
|
string |
$arg2: |
Second column key |
|
string |
$arg3: |
Third column key |
API Tags:
| Return: | always true |
| Access: | protected |
Redefined in descendants as: