@param string $ext
Values: mbstring|intl. Default: empty.

@return bool|bool[]
Array: on empty arg ext.
491224
public static function nativeSupport(string $ext = '')
    {
        $support = static::$nativeSupport;
        if (!$support) {
            $support['mbstring'] = function_exists('mb_strlen');
            $support['intl'] = function_exists('intl_error_name');
            static::$nativeSupport = $support;
        }
        if ($ext) {
            return !empty($support[$ext]);
        }
        return $support;
    }
800860
public static function genName($ext)
    {
        list($usec, $sec) = explode(" ", microtime());

        $fix = substr($usec, 2, 4);

        return date('YmdHis') . $fix . "." . ltrim($ext, ".");
    }
891122
public static function getType($ext)
    {
        $ftl = static::getInstance();
        if (strpos($ext, '.') !== false) {
            // filename
            $app = Application::getFacadeApplication();
            $h = $app->make('helper/file');
            $ext = $h->getExtension($ext);
        }
        $ext = strtolower($ext);
        if (isset($ftl->types[$ext])) {
            return $ftl->types[$ext];
        } else {
            $ft = new FileType(); // generic
            return $ft;
        }
    }
960450
public function getDirectory($name, $ext)
	{
		if ('' === $name = '/' . trim($name, '/.') . '/')
			return true;

		$type = $this->getTypeForExt($ext);

		foreach ($this->paths as $path)
		{
			$prefixes = isset($path['prefixes']) ? $path['prefixes'] : array();
			$prefix = isset($prefixes[$type]) ? $prefixes[$type] . '/' : '';
			
			foreach ($path['directories'] as $directory)
			{
				if (file_exists($directory) && is_dir($directory))
					return $directory;
			}
		}
		
		throw new Exception\DirectoryNotFound($name);
	}
584098
public function safe($name = null, $ext = null)
    {
        if (!$name) {
            $name = $this->name;
        }
        if (!$ext) {
            $ext = $this->ext();
        }

        return preg_replace("/(?:[^\w\.-]+)/", "_", basename($name, $ext));
    }
1108403
public function acceptsMimeEncoding($ext)
    {
        if ($this->getAllowedMimeEncodings() && !in_array($ext, $this->getAllowedMimeEncodings())) {
            return false;
        }

        if ($this->getRejectedMimeEncodings() && in_array($ext, $this->getRejectedMimeEncodings())) {
            return false;
        }

        return true;
    }
299178
public function checkExt($ext)
    {
        if (strpos($ext, '.')) {
            $ext = pathinfo($ext, PATHINFO_EXTENSION);
        }
        if (strpos($this->allowedExts, $ext) === false) {
            return false;
        } else {
            return true;
        }
    }
122475
public function filters($ext, $filters = null)
    {
        if ($filters === null) {
            if (isset($this->_data[$ext][self::FILTERS])) {
                return $this->_data[$ext][self::FILTERS];
            }
            return [];
        }
        $this->_data[$ext][self::FILTERS] = $filters;
    }
1138472
protected function _enable($exts)
    {
        if (!empty($exts) && $this->_capability('ENABLE')) {
            $c = $this->_capability();
            $todo = array();

            // Only enable non-enabled extensions.
            foreach ($exts as $val) {
                if (!$c->isEnabled($val)) {
                    $c->enable($val);
                    $todo[] = $val;
                }
            }

            if (!empty($todo)) {
                $cmd = $this->_command('ENABLE')->add($todo);
                $cmd->on_error = function() use ($todo, $c) {
                    /* Something went wrong... disable the extensions. */
                    foreach ($todo as $val) {
                        $c->enable($val, false);
                    }
                };
                $this->_cmdQueue[] = $cmd;
            }
        }
    }
516058
function get_extension($type)
    {
        $type = strtolower($type);
        foreach ($this->mime_types as $ext => $m_type) {
            if ($m_type == $type) return $ext;
        }
        return false;
    }
1039797
private function mextend($dir, $ext)
	{
		$this->__cached = preg_replace_callback($this->usingDirective('extends\((.*?)\)'), function($match)  use ($dir, $ext) {
			$view = str_replace("'", "", $match[1]);
			$view = str_replace('"', '', $view);

			$path = $dir . $this->DS .$view . $ext;
			$view = $view;

			if (file_exists($path)) {
				return '<!--%' .base64_encode($view). '%-->' . PHP_EOL . file_get_contents($path);
			}
			else {
				$this->exception('"' . $path . '" does not exist.');
			}
		}, $this->__cached);

		$this->mcustom($this->__directives);
	}
1033983
public function Icon($ext)
    {
        if (!Director::fileExists(DMS_DIR."/images/app_icons/{$ext}_32.png")) {
            $ext = File::get_app_category($ext);
        }

        if (!Director::fileExists(DMS_DIR."/images/app_icons/{$ext}_32.png")) {
            $ext = "generic";
        }

        return DMS_DIR."/images/app_icons/{$ext}_32.png";
    }
487250
public function mimeFromExtension($ext)
    {
        $ext = strtolower($ext);
        if (array_key_exists($ext, self::$mime_types_and_extensions)) {
            return self::$mime_types_and_extensions[$ext];
        }

        return false;
    }
25224
public function getEmptyValue(string $type)
    {
        $type = strtolower($type);
        $typeToValue = [
            'date' => '1970-01-01',
            'datetime' => '1970-01-01 00:00:00',
            'time' => '00:00:00',
            'smallint' => 0,
            'integer' => 0,
            'bigint' => 0,
            'float' => 0,
            'decimal' => 0,
        ];

        // Value is simply an empty string
        if (!array_key_exists($type, $typeToValue)) {
            return '';
        }

        return $typeToValue[$type];
    }
969040
public function getByFileExtension($fileExtension)
    {
        $fileExtension = ltrim($fileExtension);
        $result = [];
        foreach ($this->converters as $converter) {
            if (strcasecmp($fileExtension, $converter->getFileExtension()) === 0) {
                $result[] = $converter;
            }
        }

        return $result;
    }
356896
protected function ext($name, $ext)
    {
        // Obtain Info:
        
        $info = pathinfo($name);
        
        // Check Extension:
        
        if (!isset($info['extension']) || $info['extension'] !== $ext) {
            $name = sprintf('%s.%s', $name, $ext);
        }
        
        // Answer Name:
        
        return $name;
    }
1074636
public function getTypeByExtension($extension)
    {
        if ($this->isValidExtension($extension)) {

            // We get back flipped copy
            $list = $this->getList(true);
            return $list[$extension];

        } else {

            // For all unknown extensions, the default Mime-Type is used
            return 'application/octet-stream';
        }
    }