validate_file_to_edit
函数
validate_file_to_edit ( $file, $allowed_files = array() )
- 参数
-
-
(string)
$file
File the user is attempting to edit.- Required: 是
-
(string[])
$allowed_files
Optional. Array of allowed files to edit. `$file` must match an entry exactly.- Required: 否
- Default: array()
-
(string)
- 返回值
-
- (string|void) Returns the file name on success, dies on failure.
- 定义位置
-
-
wp-admin/includes/file.php
, line 707
-
wp-admin/includes/file.php
- 引入
- 1.5.0
- 弃用
- –
Makes sure that the file that was requested to be edited is allowed to be edited.
Function will die if you are not allowed to edit the file.
function validate_file_to_edit( $file, $allowed_files = array() ) { $code = validate_file( $file, $allowed_files ); if ( ! $code ) { return $file; } switch ( $code ) { case 1: wp_die( __( 'Sorry, that file cannot be edited.' ) ); // case 2 : // wp_die( __('Sorry, cannot call files with their real path.' )); case 3: wp_die( __( 'Sorry, that file cannot be edited.' ) ); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。