class File in Feeds 8.3
Same name in this branch
- 8.3 src/Utility/File.php \Drupal\feeds\Utility\File
- 8.3 src/Feeds/Target/File.php \Drupal\feeds\Feeds\Target\File
Helper functions for dealing with files.
Hierarchy
- class \Drupal\feeds\Utility\File
Expanded class hierarchy of File
2 files declare their use of File
- DirectoryFetcher.php in src/
Feeds/ Fetcher/ DirectoryFetcher.php - DirectoryFetcherFeedForm.php in src/
Feeds/ Fetcher/ Form/ DirectoryFetcherFeedForm.php
1 string reference to 'File'
- UploadFetcherFeedForm::buildConfigurationForm in src/
Feeds/ Fetcher/ Form/ UploadFetcherFeedForm.php - Form constructor.
File
- src/
Utility/ File.php, line 8
Namespace
Drupal\feeds\UtilityView source
class File {
/**
* Checks that the filename ends with an allowed extension.
*
* @param string $filename
* A file path.
* @param string $extensions
* A string with a space separated list of allowed extensions.
*
* @return bool
* Returns true if the file is valid, false if not.
*/
public static function validateExtension($filename, $extensions) {
$regex = '/\\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
return (bool) preg_match($regex, $filename);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
File:: |
public static | function | Checks that the filename ends with an allowed extension. |