HM\BackUpWordPress\Excludes::is_file_excluded PHP Метод

is_file_excluded() публичный Метод

Check if a file is excluded, i.e. excluded directly or is in an excluded folder.
public is_file_excluded ( SplFileInfo $file ) : boolean | null
$file SplFileInfo File to check if it's excluded.
Результат boolean | null True if file is excluded, false otherwise. Null - if it's not a file.
    public function is_file_excluded(\SplFileInfo $file)
    {
        $exclude_string = implode('|', $this->get_excludes_for_regex());
        $file_path_no_root = str_ireplace(trailingslashit(Path::get_root()), '', wp_normalize_path($file->getPathname()));
        if ($exclude_string && preg_match('(' . $exclude_string . ')', $file_path_no_root)) {
            return true;
        }
        return false;
    }