Switch language

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




validate_file [ WordPress Function ]

validate_file ( $file, $allowed_files = '' )
Parameters:
  • (string) $file File path.
  • (array) $allowed_files List of allowed files.
Returns:
  • (int) 0 means nothing is wrong, greater than 0 means something was wrong.
Defined at:



File validates against allowed set of defined rules.

A return value of '1' means that the $file contains either '..' or './'. A return value of '2' means that the $file contains ':' after the first character. A return value of '3' means that the file is not in the allowed files list.

Source


<?php
function validate_file$file$allowed_files '' ) {
    if ( 
false !== strpos$file'..' ) )
        return 
1;

    if ( 
false !== strpos$file'./' ) )
        return 
1;

    if ( ! empty( 
$allowed_files ) && ! in_array$file$allowed_files ) )
        return 
3;

    if (
':' == substr$file1) )
        return 
2;

    return 
0;
}
?>

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