Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




validate_file_to_edit [ WordPress Function ]

validate_file_to_edit ( $file, $allowed_files = '' )
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
Uses:
Returns:
  • (null)
Defined at:



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

Source


<?php
function validate_file_to_edit$file$allowed_files '' ) {
    
$code validate_file$file$allowed_files );

    if (!
$code )
        return 
$file;

    switch ( 
$code ) {
        case 
:
            
wp_die__('Sorry, can&#8217;t edit files with &#8220;..&#8221; 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&#8217;t call files with their real path.' ));

        
case :
            
wp_die__('Sorry, that file cannot be edited.' ));
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics