Methods summary
public
|
#
add( $module, $name, $description, $mode, $type, $value, $options = '', $intoptions = '', $accessLevel = 'mod', $help = '' )
Description:
Adds a new setting
Name:
add
Param:
$module - the module name
$name - the name of the setting
$description - a description for the setting (will appear in the config)
$mode - 'edit', 'noedit'
$type - 'color', 'number', 'text', 'options', or 'time'
$options - a list of values that the setting can be, semi-colon delimited (optional)
$intoptions - int values corresponding to $options; if empty, the values from $options will be what is stored in the database (optional)
$admin - the permission level needed to change this setting (default: mod) (optional)
$help - a help file for this setting; if blank, will use a help topic with the same name as this setting if it exists (optional)
|
public
|
#
exists( $name )
Description:
Determine if a setting with a given name exists
Name:
exists
Return:
true if the setting exists, false otherwise
|
public
|
#
get( $name )
Description:
Gets the value of a setting
Name:
get
Return:
the value of the setting, or false if a setting with that name does not exist
|
public
|
#
save( $name, $value )
Description:
Saves a new value for a setting
Name:
save
Param:
$name - the name of the setting
@value - the new value to set the setting to
Return:
false if the setting with that name does not exist, true otherwise
|
public
|
|
public
|
#
registerChangeListener( string $settingName, callable $callback, $data = null )
Adds listener callback which will be called if given $settingName changes.
Adds listener callback which will be called if given $settingName changes.
The callback has following signature:
function callback($value, $data)
$value: new value of the setting
$data: optional data variable given on register
Example usage:
registerChangeListener("some_setting_name", function($settingName, $oldValue, $newValue, $data) {
} );
Parameters
- $settingName
- changed setting's name
- $callback
the callback function to call
$param mixed $data any data which will be passed to to the callback (optional)
In the event of an invalid setting value, throw an exception with a message indicating why the value is invalid.
- $data
|
public
|
|