Advertisements

validate_file_to_edit

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

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: