WordPress Version: 3.7
/**
* 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
*
* @since 1.5.0
*
* @uses wp_die
* @uses validate_file
* @param string $file file the users is attempting to edit
* @param array $allowed_files Array of allowed files to edit, $file must match an entry exactly
* @return null
*/
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.'));
}
}