[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/config/core/Setting/ -> Setting.php (summary)

(no description)

File Size: 294 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Setting:: (17 methods):
  __construct()
  initialize()
  update()
  cleanValue()
  shouldHaveDefault()
  getKey()
  getPrettyKey()
  getArrayKey()
  getType()
  html()
  shouldBeSaved()
  out()
  prompt()
  isProtected()
  isDefault()
  hasError()
  caution()


Class: Setting  - X-Ref

Class Setting

__construct($key, $params = null)   X-Ref
Constructor.

The given parameters will be set up as class properties

see: initialize() to set the actual value of the setting
param: string $key
param: array|null $params array with metadata of setting

initialize($default = null, $local = null, $protected = null)   X-Ref
Set the current values for the setting $key

This is used to initialize the setting with the data read form the config files.

see: update() to set a new value
param: mixed $default default setting value
param: mixed $local local setting value
param: mixed $protected protected setting value

update($input)   X-Ref
update changed setting with validated user provided value $input
- if changed value fails validation check, save it to $this->input (to allow echoing later)
- if changed value passes validation check, set $this->local to the new value

return: boolean          true if changed, false otherwise
param: mixed $input the new value

cleanValue($value)   X-Ref
Clean a value read from a config before using it internally

Default implementation returns $value as is. Subclasses can override.
Note: null should always be returned as null!

This is applied in initialize() and update()

return: mixed
param: mixed $value

shouldHaveDefault()   X-Ref
Should this type of config have a default?

return: bool

getKey()   X-Ref
Get this setting's unique key

return: string

getPrettyKey($url = true)   X-Ref
Get the key of this setting marked up human readable

return: string
param: bool $url link to dokuwiki.org manual?

getArrayKey()   X-Ref
Returns setting key as an array key separator

This is used to create form output

return: string key

getType()   X-Ref
What type of configuration is this

Returns one of

'plugin' for plugin configuration
'template' for template configuration
'dokuwiki' for core configuration

return: string

html(\admin_plugin_config $plugin, $echo = false)   X-Ref
Build html for label and input of setting

return: string[] with content array(string $label_html, string $input_html)
param: \admin_plugin_config $plugin object of config plugin
param: bool $echo true: show inputted value, when error occurred, otherwise the stored setting

shouldBeSaved()   X-Ref
Should the current local value be saved?

see: out() to run when this returns true
return: bool

out($var, $fmt = 'php')   X-Ref
Generate string to save local setting value to file according to $fmt

see: shouldBeSaved() to check if this should be called
return: string
param: string $var name of variable
param: string $fmt save format

prompt(\admin_plugin_config $plugin)   X-Ref
Returns the localized prompt

return: string text
param: \admin_plugin_config $plugin object of config plugin

isProtected()   X-Ref
Is setting protected

return: bool

isDefault()   X-Ref
Is setting the default?

return: bool

hasError()   X-Ref
Has an error?

return: bool

caution()   X-Ref
Returns caution

return: false|string caution string, otherwise false for invalid caution