wpcf7_is_file_path_in_content_dir()
Verifies that a given file path is under the directories that WordPress manages for user contents.
Returns false if the file at the given path does not exist yet.
Хуков нет.
Возвращает
true|false
. True if the path is under the content directories, false otherwise.
Использование
wpcf7_is_file_path_in_content_dir( $path );
- $path(строка) (обязательный)
- A file path.
Код wpcf7_is_file_path_in_content_dir() wpcf7 is file path in content dir CF7 5.7.5.1
function wpcf7_is_file_path_in_content_dir( $path ) { if ( $real_path = realpath( $path ) ) { $path = $real_path; } else { return false; } if ( 0 === strpos( $path, realpath( WP_CONTENT_DIR ) ) ) { return true; } if ( defined( 'UPLOADS' ) and 0 === strpos( $path, realpath( ABSPATH . UPLOADS ) ) ) { return true; } return false; }