DokuWiki

It's better when it's simple

用户工具

站点工具


zh:devel:configuration

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
zh:devel:configuration [2017-07-20 06:25] – [例子] 223.74.133.140zh:devel:configuration [2017-07-20 07:41] (当前版本) – [表] 223.74.133.140
行 34: 行 34:
 ---- ----
 ===== 配置元数据 ===== ===== 配置元数据 =====
-For every setting in ''lib/plugins/<your plugin>/conf/default.php'' there should be a ''%%$meta[<setting>]%%'' value defined in ''lib/plugins/<your plugin>/conf/metadata.php''((For templates it's totally analogous: ''lib/tpl/<your template>/conf/default.php'' and ''lib/tpl/<your template>/conf/metadata.php''.)):+对于每一个在 ''lib/plugins/<your plugin>/conf/default.php''的设置它们都有一个 ''%%$meta[<setting>]%%'' 值定位于  ''lib/plugins/<your plugin>/conf/metadata.php''((模板是完全类似: ''lib/tpl/<your template>/conf/default.php'' 和 ''lib/tpl/<your template>/conf/metadata.php''.)):
  
 <code php> <code php>
 $meta[<setting>] = array(<setting class>, <param name> => <param value>); $meta[<setting>] = array(<setting class>, <param name> => <param value>);
 </code> </code>
-If no parameter is required for a setting class (see below), it's simply:+如果一个设置类不需要参数(参见下面),那么它就是简单的:
  
 <code php> <code php>
行 45: 行 45:
 </code> </code>
  
-Examples:+例子:
  
 <code php> <code php>
行 51: 行 51:
 $meta['title'     = array('string'); $meta['title'     = array('string');
 $meta['lang'      = array('dirchoice','_dir' => DOKU_INC.'inc/lang/'); $meta['lang'      = array('dirchoice','_dir' => DOKU_INC.'inc/lang/');
-$meta['dmode'     = array('numeric','_pattern' => '/0[0-7]{3,4}/'); // only accept octal representation+$meta['dmode'     = array('numeric','_pattern' => '/0[0-7]{3,4}/'); // 只接受八进制表示法
 $meta['allowdebug'] = array('onoff'); $meta['allowdebug'] = array('onoff');
 $meta['passcrypt' = array('multichoice','_choices' => array('smd5','md5','sha1','ssha','crypt','mysql','my411')); $meta['passcrypt' = array('multichoice','_choices' => array('smd5','md5','sha1','ssha','crypt','mysql','my411'));
行 58: 行 58:
 ==== 类 ==== ==== 类 ====
  
-^ ''%%''%%''               Default class ('setting'), textarea, minimal input validation, setting output in quotes.                                                                                                                                           +^ ''%%''%%''               默认的类('setting'),文本框 ,最小输入验证,在引号中设置输出。                                                                                         
-^ ''%%'string'%%''         Single line text input, minimal input validation, setting output in quotes.                                                                                                                                                        +^ ''%%'string'%%''         单行文本输入,最小输入验证,在引号中设置输出。                                                                                                       
-^ ''%%'numeric'%%''        | Text input, accepts numbers and arithmetic operators, setting output without quotes.\\ If given the ''_min'' and ''_max'' parameters are used for validation.                                                                           +^ ''%%'numeric'%%''        | 文本输入,接受数字和算术运算符,设置没有引号的输出。 \\ 如果给定''_min''''_max''参数,则用于验证。                                                                  
-^ ''%%'numericopt'%%''     Like above, but accepts empty values.                                                                                                                                                                                              +^ ''%%'numericopt'%%''     像上面一样,但是接受空值。                                                                                                                 
-^ ''%%'onoff'%%''          | Checkbox inputsetting output ''0'' or ''1'' (note that default values should be one of these integersand not boolean).                                                                                                                 +^ ''%%'onoff'%%''          | 复选框输入,设置输出“0”或“1(注意,默认值应该是一个整数,而不是布尔)。                                                                                       
-^ ''%%'multichoice'%%''    | Select input (single choice), setting output with quotes, required ''_choices'' parameter.                                                                                                                                             +^ ''%%'multichoice'%%''    | 选择输入(单个选择),用引号设置输出,需要 ''_choices''参数。                                                                                         
-^ ''%%'email'%%''          | Text input, input must conform to email address format, setting output in quotes.                                                                                                                                                  +^ ''%%'email'%%''          | 文本输入,输入必须符合电子邮件地址格式,在引号中设置输出。                                                                                                 
-^ ''%%'richemail'%%''      | Text input, input must conform to email address header format, may include a text part and replacement patterns, setting output in quotes.                                                                                         +^ ''%%'richemail'%%''      | 文本输入,输入必须符合电子邮件地址头格式,可能包括文本部分和替换模式,在引号中设置输出。                                                                                  
-^ ''%%'password'%%''       Password input, minimal input validation, setting output plain text in quotes. Once set the password is not shown in the config manager any more. Can be obfuscated in config through the ''_code'' parameter.                         +^ ''%%'password'%%''       密码输入,最小输入验证,在引号中设置输出纯文本。一旦设置了密码,就不再显示在配置管理器中了。可以通过 ''_code''参数对配置进行模糊处理。                                                      
-^ ''%%'dirchoice'%%''      | As ''multichoice'', selection choices based on folders found at location specified in ''_dir'' parameter (required).                                                                                                                       +^ ''%%'dirchoice'%%''      | 作为“多选”,根据 ''_dir''参数(必需)中指定的位置所找到的文件夹进行选择。                                                                                    
-^ ''%%'multicheckbox'%%'' A checkbox for each choice plus an "other" string input, config file setting is a comma separated list of checked choices.                                                                                                         +^ ''%%'multicheckbox'%%'' 每个选项的复选框和一个 "other" 字符串输入,配置文件设置是一个逗号分隔的检查选项列表。                                                                               
-^ ''%%'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'%%''       用于组配置设置,但它本身不是一个设置。为了在语言文件中清楚地说明,这种类型的键应该以''_''为开始                                                                            
-^ ''%%'authtype'%%''       Creates a selection of available authentication methods, based on the class names in ''inc/auth'' that match the ''authtype.class.php'' pattern.                                                                                           +^ ''%%'authtype'%%''       创建了一组可用的身份验证方法,这些方法是根据''inc/auth''的类名来匹配 ''authtype.class.php'' 模式。                                                           
-^ ''%%'regex'%%''          | Regular expression string, normally without delimitersas 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'') | +^ ''%%'regex'%%''          | 正则表达式字符串,通常没有分隔符;至于 ''string'',还测试了是否将编译并作为正则表达式运行。除了 ''_pattern''外,还接受 ''_delimiter'' (默认''/''''_pregflags'' (默认''ui'')。  |
  
 ==== 参数 ==== ==== 参数 ====
  
-^ ''%%'_pattern'%%''    | Stringa regular expression. Input is tested against this pattern before being accepted.\\ Optional all classesexcept ''onoff'', ''multichoice'' and ''dirchoice'' which ignore it.                                                                                                                                                                                                                                      +^ ''%%'_pattern'%%''    | 字符串,一个正则表达式。在被接受之前,输入是被测试的。\\ 可选的所有类,除了''onoff'', ''multichoice'' 和 ''dirchoice'' 忽略它。                                                                                                                                        
-^ ''%%'_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'%%''    | 数组选择。用于填充一个选择框。选择将被一个本地化语言字符串替换,如果存在的话,由''<setting name>_o_<choice>''索引。要求 ''multichoice'' & ''multicheckbox'' 类,忽略其它。                                                                                                        
-^ ''%%'_dir'%%''        | Location of directory to be used to populate choice list.\\ Required by ''dirchoice'' class, ignored by other classes.                                                                                                                                                                                                                                                                                           +^ ''%%'_dir'%%''        | 用于填充选择列表的目录的位置。\\ 要求''dirchoice''类,忽略其它类。                                                                                                                                                                                     
-^ ''%%'_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'%%''       设置密码字段的混淆选项。可能是 ''plain'', ''base64'' 或 ''uuencode''。 当使用后两个时,您需要使用[[phpxref>conf_decodeString()]]访问 plain 值。                                                                                                                 
-^ ''%%'_combine'%%''    | Complimentary output setting values which can be combined into a single display ''checkbox''.\\ Optional for ''multicheckbox'', ignored by other classes.                                                                                                                                                                                                                                                            +^ ''%%'_combine'%%''    | 互补输出设置值,可以组合成一个单一的显示 ''复选框''\\ 可选 “多复选框”,忽略其它类。                                                                                                                                                                              
-^ ''%%'_code'%%''       Encoding method to use, accepted values: ''base64'', ''uuencode'', ''plain''.  Defaults to plain.                                                                                                                                                                                                                                                                                                                    +^ ''%%'_code'%%''       使用的编码方法,接受的值: ''base64'', ''uuencode'', ''plain''.  默认为 plain.                                                                                                                                                                
-^ ''%%'_min'%%''        | Minimum numeric value.\\ Optional for ''numeric'' and ''numericopt'', ignored by others.                                                                                                                                                                                                                                                                                                                            +^ ''%%'_min'%%''        | 最小的数值。\\ 可选 ''numeric'' 和 ''numericopt'',忽略其它                                                                                                                                                                                 
-^ ''%%'_max'%%''        | Maximum numeric value.\\ Optional for ''numeric'' and ''numericopt'', ignored by others.                                                                                                                                                                                                                                                                                                                            +^ ''%%'_max'%%''        | 最小的数值。\\ 可选 ''numeric'' 和 ''numericopt'', 忽略其它                                                                                                                                                                                
-^ ''%%'_delimiter'%%'' Stringdefault ''/'', a single character used as a delimiter for testing regex input values.                                                                                                                                                                                                                                                                                                                   +^ ''%%'_delimiter'%%'' 字符串默认 ''/'', 一个字符作为分隔符用于测试正则表达式的输入值。                                                                                                                                                                                        
-^ ''%%'_pregflags'%%'' Stringdefault ''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]]                                                                                                                                                                                                                         +^ ''%%'_pregflags'%%'' 字符串默认 ''ui'', 测试正则表达式输入值时使用的有效的preg模式修饰符, 更多信息见 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.                                                                                                                                                                                                                                                                                                                   +^ ''%%'_multiple'%%''   布尔型,允许多个逗号分隔的电子邮件值。\\ 可选 ''email'', 忽略其它                                                                                                                                                                                      
-^ ''%%'_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.  |+^ ''%%'_other'%%''      | 如何处理其他值 (未列出在 ''_choices'')。 接受的值: ''always'', ''exists'', ''never''。默认值 ''always''.\\ ''exists''只显示 'other' 输入字段,当设置包含没有在选项中列出的值时 (如由于手工编辑或更新改变 ''_choices'')。这比 ''never''更安全,因为它不会丢弃不知道的/其他值。\\ 可选 ''multicheckbox'',忽略其它。  |
  
  
zh/devel/configuration.1500524727.txt.gz · 最后更改: 2017-07-20 06:25 由 223.74.133.140

除额外注明的地方外,本维基上的内容按下列许可协议发布: 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