[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

(no description)

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

Defines 1 class

Setting:: (18 methods):
  __construct()
  initialize()
  update()
  cleanValue()
  shouldHaveDefault()
  getKey()
  getPrettyKey()
  getArrayKey()
  getType()
  html()
  shouldBeSaved()
  escape()
  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

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

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()

param: mixed $value
return: mixed

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

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

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

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

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

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

escape($string)   X-Ref
Escaping

param: string $string
return: string

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
param: string $var name of variable
param: string $fmt save format
return: string

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

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

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