DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:configuration [2016-03-12 10:48] – [Table] 2a02:2450:1024:8270:89b1:5405:9426:54d9devel:configuration [2019-07-11 16:18] (current) – [Classes] Remove deprecated richemail, add array phy25
Line 34: Line 34:
 ==== Classes ==== ==== Classes ====
  
-^ ''%%''%%''               default class ('setting'), textarea, minimal input validation, setting output in quotes                                                                                                                                           | +^ ''%%''%%''               Default class ('setting'), textarea, minimal input validation, setting output in quotes                                                                                                                                          | 
-^ ''%%'string'%%''         single line text input, minimal input validation, setting output in quotes                                                                                                                                                        | +^ ''%%'string'%%''         Single line text input, minimal input validation, setting output in quotes                                                                                                                                                       | 
-^ ''%%'numeric'%%''        | text input, accepts numbers and arithmetic operators, setting output without quotes\\ if given the '_min' and '_max' parameters are used for validation                                                                           | +^ ''%%'numeric'%%''        | Text input, accepts numbers and arithmetic operators, setting output without quotes.\\ If given the ''_min'' and ''_max'' parameters are used for validation                                                                          | 
-^ ''%%'numericopt'%%''     like above, but accepts empty values                                                                                                                                                                                              | +^ ''%%'numericopt'%%''     Like above, but accepts empty values                                                                                                                                                                                             | 
-^ ''%%'onoff'%%''          | checkbox input, setting output 0 or 1 (note that default values should be one of these integers, and not boolean)                                                                                                                 | +^ ''%%'onoff'%%''          | Checkbox input, setting output ''0'' or ''1'' (note that default values should be one of these integers, and not boolean)                                                                                                                | 
-^ ''%%'multichoice'%%''    | select input (single choice), setting output with quotes, required _choices parameter                                                                                                                                             | +^ ''%%'multichoice'%%''    | Select input (single choice), setting output with quotes, required ''_choices'' parameter                                                                                                                                            | 
-^ ''%%'email'%%''          | text input, input must conform to email address format, setting output in quotes                                                                                                                                                  | +^ ''%%'email'%%''          | Text input, input must conform to email address format, setting output in quotes.                                                                                                                                                                                                                                    
-^ ''%%'richemail'%%''      | text input, input must conform to email address header format, may include a text part and replacement patterns, setting output in quotes                                                                                         +^ ''%%'password'%%''       Password input, minimal input validation, setting output plain text in quotes. Once set the password is not shown in the config manager any moreCan be obfuscated in config through the ''_code'' parameter.                         
-^ ''%%'password'%%''       password input, minimal input validation, setting output plain text in quotes. once set the password is not shown in the config manager anymore                                                                                 +^ ''%%'dirchoice'%%''      | As ''multichoice'', selection choices based on folders found at location specified in ''_dir'' parameter (required)                                                                                                                      | 
-^ ''%%'dirchoice'%%''      | as multichoice, selection choices based on folders found at location specified in _dir parameter (required)                                                                                                                       | +^ ''%%'multicheckbox'%%'' checkbox for each choice plus an "other" string input, config file setting is a comma separated list of checked choices                                                                                                        | 
-^ ''%%'multicheckbox'%%'' checkbox for each choice plus an "other" string input, config file setting is a comma separated list of checked choices                                                                                                         | +^ ''%%'fieldset'%%''       Used to group configuration settings, but is not itself a setting. To make this clear in the language files the keys for this type should start with ''_''                                                                         | 
-^ ''%%'fieldset'%%''       used to group configuration settings, but is not itself a setting. To make this clear in the language files the keys for this type should start with '_'                                                                          | +^ ''%%'authtype'%%''       Creates a selection of available authentication methods, based on the class names in ''inc/auth'' that match the ''authtype.class.php'' pattern                                                                                          
-^ ''%%'authtype'%%''       creates a selection of available authentication methods, based on the class names in inc/auth that match the authtype.class.php pattern                                                                                           | +^ ''%%'array'%%''          | a simple (one dimensional) array of string values, shown as comma separated list in the config manager but saved as PHP array(). Values may not contain commas themselves. ''_pattern'' matching on the array values supported.       
-^ ''%%'regex'%%''          | regular expression string, normally without delimiters; as for string, in addition tested to see if will compile run as a regex.  in addition to _pattern, also accepts _delimiter (default '/') and _pregflags (default 'ui' |+^ ''%%'regex'%%''          | Regular expression string, normally without delimiters; as for ''string'', in addition tested to see if will compile and run as a regex.  In addition to ''_pattern'', also accepts ''_delimiter'' (default ''/'') and ''_pregflags'' (default ''ui'') |
  
  
 ==== Parameters ==== ==== Parameters ====
  
-^ ''%%'_pattern'%%''string, a regular expression. input is tested against this pattern before being accepted\\ optional all classes, except onoff, multichoice dirchoice which ignore it | +^ ''%%'_pattern'%%''    String, a regular expression. Input is tested against this pattern before being accepted.\\ Optional all classes, except ''onoff''''multichoice'' and ''dirchoice'' which ignore it.                                                                                                                                                                                                                                      
-^ ''%%'_choices'%%''array of choices. used to populate a selection box. choice will be replaced by a localised language string, indexed by  <setting name>_o_<choice>, if one exists\\ required by 'multichoice' & 'multicheckbox' classes, ignored by others | +^ ''%%'_choices'%%''    Array of choices. Used to populate a selection box. Choice will be replaced by a localised language string, indexed by ''<setting name>_o_<choice>'', if one exists.\\ Required by ''multichoice'' & ''multicheckbox'' classes, ignored by others.                                                                                                                                                                    
-^ ''%%'_dir'%%''location of directory to be used to populate choice list\\ required by 'dirchoice' class, ignored by other classes | +^ ''%%'_dir'%%''        Location of directory to be used to populate choice list.\\ Required by ''dirchoice'' class, ignored by other classes.                                                                                                                                                                                                                                                                                           | 
-^ ''%%'_combine'%%''complimentary output setting values which can be combined into a single display checkbox\\ optional for 'multicheckbox', ignored by other classes | +^ ''%%'_code'%%''       | Sets the obfuscation option for password fields. May be ''plain'', ''base64'' or ''uuencode''. When using the latter two, you need to use [[phpxref>conf_decodeString()]] to access the plain value.                                                                                                                                                                                                               
-^ ''%%'_code'%%''encoding method to use, accepted values: 'base64','uuencode','plain'.  defaults to plain. | +^ ''%%'_combine'%%''    Complimentary output setting values which can be combined into a single display ''checkbox''.\\ Optional for ''multicheckbox'', ignored by other classes.                                                                                                                                                                                                                                                            
-^ ''%%'_min'%%''minimum numeric value, optional for 'numeric' and 'numericopt', ignored by others  +^ ''%%'_code'%%''       Encoding method to use, accepted values: ''base64'', ''uuencode'', ''plain''.  Defaults to plain.                                                                                                                                                                                                                                                                                                                    
-^ ''%%'_max'%%''maximum numeric value, optional for 'numeric' and 'numericopt', ignored by others  +^ ''%%'_min'%%''        Minimum numeric value.\\ Optional for ''numeric'' and ''numericopt'', ignored by others.                                                                                                                                                                                                                                                                                                                            
-^ ''%%'_delimiter'%%''string, default '/', a single character used as a delimiter for testing regex input values | +^ ''%%'_max'%%''        Maximum numeric value.\\ Optional for ''numeric'' and ''numericopt'', ignored by others.                                                                                                                                                                                                                                                                                                                            
-^ ''%%'_pregflags'%%''string, default 'ui', valid preg pattern modifiers used when testing regex input values, for more information see http://uk1.php.net/manual/en/reference.pcre.pattern.modifiers.php| +^ ''%%'_delimiter'%%''  String, default ''/'', a single character used as a delimiter for testing regex input values.                                                                                                                                                                                                                                                                                                                   
-^ ''%%'_multiple'%%''bool, allow multiple comma separated email values; optional for 'email', ignored by others |+^ ''%%'_pregflags'%%''  String, default ''ui'', valid preg pattern modifiers used when testing regex input values, for more information see [[http://uk1.php.net/manual/en/reference.pcre.pattern.modifiers.php]].                                                                                                                                                                                                                          
 +^ ''%%'_multiple'%%''   Bool, allow multiple comma separated email values.\\ Optional for ''email'', ignored by others.                                                                                                                                                                                                                                                                                                                   | 
 +^ ''%%'_other'%%''      | How to handle other values (not listed in ''_choices''). Accepted values: ''always'', ''exists'', ''never''. Default value ''always''.\\ ''exists'' only shows 'other' input field when the setting contains value(s) not listed in choices (e.g. due to manual editing or update changing ''_choices'').  This is safer than ''never'' as it will not discard unknown/other values.\\ Optional for ''multicheckbox'', ignored by others. 
 + 
 + 
 +==== Examples ==== 
 + 
 +=== ''multicheckbox'' with ''_other'' === 
 + 
 +Let's say initially a plugin uses the syntax: 
 + 
 +<code php>$meta['multi'] = array('multicheckbox', '_choices' => array('a','b','c','d'));</code> 
 + 
 +this means the multicheckbox will show four choices plus a string input. 
 + 
 +Let's suppose also that the user inserts one or more extra values not in ''_choices''
 + 
 +In the next release of the plugin the author's plugin decides to use the multicheckbox without the extra string, but, in order to be backwardly compatible, adopts: 
 + 
 +<code php>$meta['multi'] = array('multicheckbox', '_other' => 'exists', '_choices' => array('a','b','c','d'));</code> 
 + 
 +which means: 
 +  * if the user has inserted comma separated values, they will be printed in the extra string; 
 +  * otherwise the extra string won't show. 
 + 
 +Note also that if the user inserts comma separated values which already exist (or some of them) in ''_choices'' but: 
 +  * they are already ticked, then the extra string will be removed and nothing else; 
 +  * they are not already ticked, then the extra string will be removed and the relative value will be ticked.
  
 ===== Accessing Settings ===== ===== Accessing Settings =====
devel/configuration.1457776130.txt.gz · Last modified: 2016-03-12 10:48 by 2a02:2450:1024:8270:89b1:5405:9426:54d9

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki