public static function MinisiteArchive::fileExtensionCheck in Mini site 7
Checks that the filename ends with an allowed extension.
1 call to MinisiteArchive::fileExtensionCheck()
- _minisite_field_validate_minisite_asset in includes/
minisite.field.inc - Validate minisite asset.
File
- includes/
minisite.archive.inc, line 124 - Minisite archive class.
Class
- MinisiteArchive
- Class MinisiteArchive.
Code
public static function fileExtensionCheck($files, $extensions) {
$invalid_files = array();
foreach ($files as $file_name) {
// Ignore folder in minisite.
if (substr($file_name, -1) == '/') {
continue;
}
$regex = '/\\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
if (!preg_match($regex, $file_name)) {
$invalid_files[] = $file_name;
}
}
return $invalid_files;
}