WC_Product_CSV_Importer_Controller::file_is_in_directory()private staticWC 1.0

Check if a given file is inside a given directory.

Метод класса: WC_Product_CSV_Importer_Controller{}

Хуков нет.

Возвращает

true|false. True if the file is inside the directory.

Использование

$result = WC_Product_CSV_Importer_Controller::file_is_in_directory( $file_path, $directory ): bool;
$file_path(строка) (обязательный)
The full path of the file to check.
$directory(строка) (обязательный)
The path of the directory to check.

Код WC_Product_CSV_Importer_Controller::file_is_in_directory() WC 9.4.2

private static function file_is_in_directory( string $file_path, string $directory ): bool {
	$file_path = (string) new URL( $file_path ); // This resolves '/../' sequences.
	$file_path = preg_replace( '/^file:\\/\\//', '', $file_path );
	return 0 === stripos( wp_normalize_path( $file_path ), trailingslashit( wp_normalize_path( $directory ) ) );
}