|
| __construct ($blog_id, string $name, ?dcRecord $rs=null) |
|
| settingExists (string $name, bool $global=false) |
|
| get ($name) |
|
| getGlobal ($name) |
|
| getLocal ($name) |
|
| __get ($name) |
|
| set ($name, $value) |
|
| __set ($name, $value) |
|
| put (string $name, $value, ?string $type=null, ?string $label=null, bool $ignore_value=true, bool $global=false) |
|
| rename (string $old_name, string $new_name) |
|
| drop (string $name) |
|
| dropEvery (string $name, bool $global=false) |
|
| dropAll (bool $force_global=false) |
|
| dumpNamespace () |
|
| dumpSettings () |
|
| dumpLocalSettings () |
|
| dumpGlobalSettings () |
|
◆ __construct()
__construct |
( |
|
$blog_id, |
|
|
string |
$name, |
|
|
?dcRecord |
$rs = null |
|
) |
| |
Object constructor. Retrieves blog settings and puts them in $settings array. Local (blog) settings have a highest priority than global settings.
- Parameters
-
mixed | $blog_id | The blog identifier |
string | $name | The namespace ID |
dcRecord | $rs | The recordset |
- Exceptions
-
References $blog_id, dcCore\app(), and NS_TABLE_NAME.
◆ settingExists()
settingExists |
( |
string |
$name, |
|
|
bool |
$global = false |
|
) |
| |
Returns true if a setting exist, else false
- Parameters
-
string | $name | The identifier |
bool | $global | The global |
- Returns
- bool
Referenced by put().
◆ get()
Returns setting value if exists.
- Parameters
-
- Returns
- mixed
◆ getGlobal()
Returns global setting value if exists.
- Parameters
-
- Returns
- mixed
◆ getLocal()
Returns local setting value if exists.
- Parameters
-
- Returns
- mixed
◆ __get()
Magic __get method.
- Parameters
-
- Returns
- mixed
◆ set()
Sets a setting in $settings property. This sets the setting for script execution time only and if setting exists.
- Parameters
-
string | $name | The setting name |
mixed | $value | The setting value |
◆ __set()
Magic __set method.
- Parameters
-
string | $name | The setting name |
mixed | $value | The setting value |
◆ put()
put |
( |
string |
$name, |
|
|
|
$value, |
|
|
?string |
$type = null , |
|
|
?string |
$label = null , |
|
|
bool |
$ignore_value = true , |
|
|
bool |
$global = false |
|
) |
| |
Creates or updates a setting.
$type could be 'string', 'integer', 'float', 'boolean', 'array' or null. If $type is null and setting exists, it will keep current setting type.
$ignore_value allow you to not change setting. Useful if you need to change a setting label or type and don't want to change its value.
- Parameters
-
string | $name | The setting identifier |
mixed | $value | The setting value |
string | $type | The setting type |
string | $label | The setting label |
bool | $ignore_value | Change setting value or not |
bool | $global | Setting is global |
- Exceptions
-
References $blog_id, $namespace, drop(), and settingExists().
◆ rename()
rename |
( |
string |
$old_name, |
|
|
string |
$new_name |
|
) |
| |
Rename an existing setting in a Namespace
- Parameters
-
string | $old_name | The old setting identifier |
string | $new_name | The new setting identifier |
- Exceptions
-
- Returns
- bool
◆ drop()
Removes an existing setting in a Namespace.
- Parameters
-
string | $name | The setting identifier |
- Exceptions
-
Referenced by put().
◆ dropEvery()
dropEvery |
( |
string |
$name, |
|
|
bool |
$global = false |
|
) |
| |
Removes every existing specific setting in a namespace
- Parameters
-
string | $name | Setting ID |
boolean | $global | Remove global setting too |
- Exceptions
-
◆ dropAll()
dropAll |
( |
bool |
$force_global = false | ) |
|
Removes all existing settings in a Namespace.
- Parameters
-
bool | $force_global | Force global pref drop |
- Exceptions
-
◆ dumpNamespace()
Dumps a namespace.
- Returns
- string
References $namespace.
◆ dumpSettings()
Dumps settings.
- Returns
- array
References $settings.
◆ dumpLocalSettings()
◆ dumpGlobalSettings()
◆ NS_TABLE_NAME
const NS_TABLE_NAME = 'setting' |
◆ NS_NAME_SCHEMA
const NS_NAME_SCHEMA = '/^[a-zA-Z][a-zA-Z0-9]+$/' |
◆ NS_ID_SCHEMA
const NS_ID_SCHEMA = '/^[a-zA-Z][a-zA-Z0-9_]+$/' |
|
protected |
◆ $con
◆ $table
◆ $blog_id
◆ $global_settings
◆ $local_settings
◆ $settings
◆ $namespace
The documentation for this class was generated from the following file: