[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/config/settings/ -> config.class.php (summary)

Configuration Class and generic setting classes

Author: Chris Smith
Author: Ben Coburn
File Size: 1431 lines (51 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 18 classes

configuration:: (14 methods):
  __construct()
  retrieve_settings()
  save_settings()
  touch_settings()
  _read_config_group()
  _read_config()
  _readValue()
  _out_header()
  _out_footer()
  _is_locked()
  _flatten()
  get_plugin_list()
  get_plugintpl_metadata()
  get_plugintpl_default()

setting:: (11 methods):
  __construct()
  initialize()
  update()
  html()
  out()
  prompt()
  is_protected()
  is_default()
  error()
  caution()
  _out_key()

setting_array:: (6 methods):
  _from_string()
  _from_array()
  update()
  _escape()
  out()
  html()

setting_string:: (1 method):
  html()

setting_password:: (2 methods):
  update()
  html()

setting_email:: (1 method):
  update()

setting_numeric:: (2 methods):
  update()
  out()

setting_numericopt:: (1 method):
  update()

setting_onoff:: (2 methods):
  html()
  update()

setting_multichoice:: (2 methods):
  html()
  update()

setting_dirchoice:: (1 method):
  initialize()

setting_hidden:: (0 methods):

setting_fieldset:: (0 methods):

setting_undefined:: (0 methods):

setting_no_class:: (0 methods):

setting_no_default:: (0 methods):

setting_multicheckbox:: (4 methods):
  update()
  html()
  _str2array()
  _array2str()

setting_regex:: (1 method):
  update()


Class: configuration  - X-Ref

Class configuration

__construct($datafile)   X-Ref
constructor

param: string $datafile path to config metadata file

retrieve_settings()   X-Ref
Retrieve and stores settings in setting[] attribute


save_settings($id, $header='', $backup=true)   X-Ref
Stores setting[] array to file

param: string $id     Name of plugin, which saves the settings
param: string $header Text at the top of the rewritten settings file
param: bool $backup   backup current file? (remove any existing backup)
return: bool succesful?

touch_settings()   X-Ref
Update last modified time stamp of the config file

return: bool

_read_config_group($files)   X-Ref
Read and merge given config files

param: array $files file paths
return: array config settings

_read_config($file)   X-Ref
Return an array of config settings

param: string $file file path
return: array config settings

_readValue($value)   X-Ref
Convert php string into value

param: string $value
return: bool|string

_out_header($id, $header)   X-Ref
Returns header of rewritten settings file

param: string $id plugin name of which generated this output
param: string $header additional text for at top of the file
return: string text of header

_out_footer()   X-Ref
Returns footer of rewritten settings file

return: string text of footer

_is_locked()   X-Ref
Configuration is considered locked if there is no local settings filename
or the directory its in is not writable or the file exists and is not writable

return: bool true: locked, false: writable

_flatten($conf,$prefix='')   X-Ref
not used ... conf's contents are an array!
reduce any multidimensional settings to one dimension using CM_KEYMARKER

param: $conf
param: string $prefix
return: array

get_plugin_list()   X-Ref
Returns array of plugin names

triggers: PLUGIN_CONFIG_PLUGINLIST event
return: array plugin names

get_plugintpl_metadata($tpl)   X-Ref
load metadata for plugin and template settings

param: string $tpl name of active template
return: array metadata of settings

get_plugintpl_default($tpl)   X-Ref
Load default settings for plugins and templates

param: string $tpl name of active template
return: array default settings

Class: setting  - X-Ref

Class setting

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

param: string $key
param: array|null $params array with metadata of setting

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

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 user provided value $input
- if changed value fails error check, save it to $this->_input (to allow echoing later)
- if changed value passes error check, set $this->_local to the new value

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

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)

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

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

is_protected()   X-Ref
Is setting protected

return: bool

is_default()   X-Ref
Is setting the default?

return: bool

error()   X-Ref
Has an error?

return: bool

caution()   X-Ref
Returns caution

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

_out_key($pretty=false,$url=false)   X-Ref
Returns setting key, eventually with referer to config: namespace at dokuwiki.org

param: bool $pretty create nice key
param: bool $url    provide url to config: namespace
return: string key

Class: setting_array  - X-Ref

Class setting_array

_from_string($string)   X-Ref
Create an array from a string

param: string $string
return: array

_from_array($array)   X-Ref
Create a string from an array

param: array $array
return: string

update($input)   X-Ref
update setting with user provided value $input
if value fails error check, save it

param: string $input
return: bool true if changed, false otherwise (incl. on error)

_escape($string)   X-Ref
Escaping

param: string $string
return: string

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

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

Class: setting_string  - X-Ref

Class setting_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)

Class: setting_password  - X-Ref

Class setting_password

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

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)

Class: setting_email  - X-Ref

Class setting_email

update($input)   X-Ref
update setting with user provided value $input
if value fails error check, save it

param: mixed $input
return: boolean true if changed, false otherwise (incl. on error)

Class: setting_numeric  - X-Ref

Class setting_numeric

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

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

param: string $var name of variable
param: string $fmt save format
return: string

Class: setting_numericopt  - X-Ref

Class setting_numericopt

update($input)   X-Ref
Empty string is valid for numericopt

param: mixed $input
return: bool

Class: setting_onoff  - X-Ref

Class setting_onoff

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)

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

Class: setting_multichoice  - X-Ref

Class setting_multichoice

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)

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

Class: setting_dirchoice  - X-Ref

Class setting_dirchoice

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

param: mixed $default   default setting value
param: mixed $local     local setting value
param: mixed $protected protected setting value

Class: setting_hidden  - X-Ref

Class setting_hidden

Class: setting_fieldset  - X-Ref

Class setting_fieldset

Class: setting_undefined  - X-Ref

Class setting_undefined

Class: setting_no_class  - X-Ref

Class setting_no_class

Class: setting_no_default  - X-Ref

Class setting_no_default

Class: setting_multicheckbox  - X-Ref

Class setting_multicheckbox

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (also on error)

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 input value, when error occurred, otherwise the stored setting
return: string[] with content array(string $label_html, string $input_html)

_str2array($str)   X-Ref
convert comma separated list to an array and combine any complimentary values

param: string $str
return: array

_array2str($input)   X-Ref
convert array of values + other back to a comma separated list, incl. splitting any combined values

param: array $input
return: string

Class: setting_regex  - X-Ref

Class setting_regex

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

param: mixed   $input   the new value
return: boolean          true if changed, false otherwise (incl. on error)