3 namespace Elgg\Filesystem;
43 'original_filename' => basename(
$filename),
47 return $this->events->triggerResults(
'mime_type',
'file',
$params, $mime);
62 case 'application/msword':
63 case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
64 case 'application/pdf':
67 case 'application/ogg':
73 if (preg_match(
'~^(audio|image|video)/~', $mimetype, $matches)) {
77 if (str_starts_with($mimetype,
'text/') || str_contains($mimetype,
'opendocument')) {
82 'mime_type' => $mimetype,
84 return $this->events->triggerResults(
'simple_type',
'file',
$params,
$result);
96 $mimetype = $this->getMimeType(
$filename);
98 return $this->getSimpleType($mimetype,
$default);
$params
Saves global plugin settings.
Exception thrown if an argument is not of the expected type.
Detect the MIME type of a file.
Public service related to MIME type detection.
getSimpleType(string $mimetype, string $default='general')
Returns the category of a file from its MIME type.
getSimpleTypeFromFile(string $filename, string $default='general')
Returns the category of a file from a filename.
getMimeType(string $filename, string $default=MimeTypeDetector::DEFAULT_TYPE)
Get the mimetype for a given filename.
__construct(protected EventsService $events)
Constructor.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.