Upgrade to 3.2.0

This commit is contained in:
Bastian Allgeier
2019-06-25 09:56:08 +02:00
parent 9e18cf635d
commit 9c89153d35
296 changed files with 14408 additions and 2504 deletions

View File

@@ -12,8 +12,9 @@ use SimpleXMLElement;
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Mime
{
@@ -254,6 +255,31 @@ class Mime
return false;
}
/**
* Returns all available extensions for a given mime type
*
* @param string|null $mime
* @return array
*/
public static function toExtensions(string $mime = null): array
{
$extensions = [];
foreach (static::$types as $key => $value) {
if (is_array($value) === true && in_array($mime, $value) === true) {
$extensions[] = $key;
continue;
}
if ($value === $mime) {
$extensions[] = $key;
continue;
}
}
return $extensions;
}
/**
* Returns the mime type of a file
*