Definition:
function validate_file_to_edit( $file, $allowed_files = '' ) {}
Make sure that the file that was requested to edit, is allowed to be edited
Function will die if if you are not allowed to edit the file
Parameters
- string $file: file the users is attempting to edit
- array $allowed_files: Array of allowed files to edit, $file must match an entry exactly
Source code
function validate_file_to_edit( $file, $allowed_files = '' ) { $code = validate_file( $file, $allowed_files ); if (!$code ) return $file; switch ( $code ) { case 1 : wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' )); //case 2 : // wp_die( __('Sorry, can’t call files with their real path.' )); case 3 : wp_die( __('Sorry, that file cannot be edited.' )); } }
3325
No comments yet... Be the first to leave a reply!