Returns the extensions allowed for compressed documents.

@param type $default
@return string
173821
public function getCompressedExtensions( $default = null ) {

		$prop = $this->properties[ self::PROP_EXTENSION_COMPRESSED ];

		if( isset( $prop ) && strlen( $prop ) > 0 ) {

			return preg_split( "/,/", $prop );
		}

		return $default;
	}
1147479
public static function getMimeByExtension($extension, $default = 'application/octet-stream')
    {
        $extension = strtolower($extension);

        // look for some standard types
        switch ($extension) {
            case null:
                return $default;
            case 'json':
                return 'application/json';
            case 'html':
                return 'text/html';
            case 'atom':
                return 'application/atom+xml';
            case 'rss':
                return 'application/rss+xml';
            case 'xml':
                return 'application/xml';
        }

        $media_types = Grav::instance()['config']->get('media.types');

        if (isset($media_types[$extension])) {
            if (isset($media_types[$extension]['mime'])) {
                return $media_types[$extension]['mime'];
            }
        }

        return $default;
    }
723159
protected function getExtension($file)
    {
        if (strpos($file, '.') !== false) {
            $tempExt = strtolower(substr($file, strrpos($file, '.') + 1, strlen($file) - strrpos($file, '.')));
            return strtolower(trim($tempExt,'/'));
        }
        return '';
    }
979886
public static function getExtension(
        string $type,
        string $default = "unknown"
    ): string
    {
        return array_key_exists($type, self::$types)
            ? self::$types[$type]
            : $default;
    }
506154
public function getAcceptableCharsets(?string $default = null): array
	{
		if(!isset($this->acceptableCharsets))
		{
			$this->acceptableCharsets = $this->parseAcceptHeader($this->get('accept-charset'));
		}

		return $this->acceptableCharsets ?: (array) $default;
	}
312468
public static function getTypeFromExtension(
        string $ext,
        string $default = "application/octet-stream"
    ): string
    {
        $ext = strtolower($ext);
        return self::$extensions[$ext] ?? $default;
    }
708647
protected static function restGetSortFields($default = [])
    {
        $sort = Request::getInstance()->query('_sort', false);
        if (!$sort) {
            return $default;
        }

        $sorters = [];
        $fields = explode(',', $sort);
        foreach ($fields as $sort) {
            $sortField = $sort;
            $sortDirection = 1;

            $sortDirectionSign = substr($sort, 0, 1);
            if ($sortDirectionSign == '+' || $sortDirectionSign == '-') {
                $sortField = substr($sort, 1);
                $sortDirection = $sortDirectionSign == '+' ? 1 : -1;
            }

            $sorters[$sortField] = $sortDirection;
        }

        return $sorters;
    }
667632
public function getExtension() {
		$filename = $this->getFilename();
		$pos = strrpos($filename, '.');
		if($pos === false || $pos === 0 || $pos >= strlen($filename) - 1) {
			return null;
		}
		return substr($filename, $pos + 1);
	}
1193613
public function getDescription($default = false)
    {
        if (($ob = $this->_headers['content-description']) &&
            strlen($ob->value)) {
            return $ob->value;
        }

        return $default
            ? $this->getName()
            : '';
    }
1066932
public static function getContents($file, $default = '')
    {
        if (is_string(self::$path_prefix)) {
            $file = self::$path_prefix.$file;
        }

        return !is_file($file) || !is_readable($file) || !($contents = @file_get_contents($file)) ? $default : trim($contents);
    }
717241
private function determineExtension()
    {
        $ext = 'php';
        if (in_array($this->driverClass, $this->extensionToDriver)) {
            $map = array_flip($this->extensionToDriver);
            $ext = $map[$this->driverClass];
        }
        return $ext;
    }
533932
public static function purifyExtension($extension)
    {
        $extension = (string)$extension;
        $extension = trim($extension);
        $extension = ltrim($extension, '.');

        return $extension;
    }
349918
public function getAvailableExtensions()
    {
        $returnValue = array();
		$dir = new DirectoryIterator(ROOT_PATH);
		foreach ($dir as $fileinfo) {
			if ($fileinfo->isDir() && !$fileinfo->isDot() && substr($fileinfo->getBasename(), 0, 1) != '.') {
				$extId = $fileinfo->getBasename();
				if (!in_array($extId, self::$RESERVED_WORDS) && !$this->isInstalled($extId)) {
    				try {
    					$ext = $this->getExtensionById($extId);
    					$returnValue[] = $ext;
    				} catch (common_ext_ExtensionException $exception) {
    					common_Logger::d($extId.' is not an extension');
    				}
				}
			}
		}
		
		return $returnValue;
    }
347432
protected function fileExtension()
    {
        if (!$this->fileExtension) {
            $mimeType = $this->serializer->mimeType();
            $this->fileExtension = $this->mimetypes->fileExtensions($mimeType)[0];
        };
        return $this->fileExtension;
    }
1200375
public function getExtends($short = false)
    {
        $extends = '';
        if ($this->isArray()) {
            $extends = $this->getGenerator()->getOptionStructArrayClass();
        } elseif (!$this->isRestriction()) {
            $extends = $this->getGenerator()->getOptionStructClass();
        }
        return $short ? Utils::removeNamespace($extends) : $extends;
    }
1055207
public function getName($default = false)
    {
        if (!($name = $this->getDispositionParameter('filename')) &&
            !($name = $this->getContentTypeParameter('name')) &&
            $default) {
            $name = preg_replace('|\W|', '_', $this->getDescription(false));
        }

        return $name;
    }
1130458
public function getEnabledExtensions()
    {
        $returnValue = array();

        $enabled = $this->getExtensionById('generis')->getConfig(self::EXTENSIONS_CONFIG_KEY);
        foreach ($this->getInstalledExtensions() as $ext) {
            if (isset($enabled[$ext->getId()]) && $enabled[$ext->getId()]['enabled']) {
                $returnValue[$ext->getId()] = $ext;
            }
        }
    
        return (array) $returnValue;
    }