Checks if a given file type should be a plural or not.

@return array
355978
public static function shouldBePlural($key)
    {
        $config = self::getArrayBaseValue('plural_names_for', [
            'controller-name' => true,
            'request-form-name' => true,
            'route-group' => true,
            'language-file-name' => true,
            'resource-file-name' => true,
            'table-name' => true,
        ]);

        if (isset($config[$key])) {
            return (bool) $config[$key];
        }

        return ($key != 'model-name');
    }
743198
public static function getValidFileTypesForCategory()
  {
    $db = \Database::getInstance();
    $input = \Input::getInstance();
    if($db->tableExists('tl_dms_categories') && $db->tableExists('tl_dms_documents'))
    {
      $objCategory = $db->prepare('SELECT cat.* FROM tl_dms_categories cat JOIN tl_dms_documents doc ON doc.pid = cat.id WHERE doc.id = ?')->execute($input->get('id'));
      if ($objCategory->numRows)
      {
        return $objCategory->file_types;
      }
    }
    return "";
  }
136594
private static function getType($mode = 'strtolower', $plural = true)
    {
        $namespace = get_called_class();
        $class = explode('\\', $namespace);
        $complement = strtolower(array_pop($class) . ($plural ? 's' : ''));

        switch ($mode) {
            case 'ucfirst':
                return ucfirst($complement);
            case 'strtoupper':
                return strtoupper($complement);
            default:
                return $complement;
        }
    }
956045
public function getFiles() : array
    {
        $files = [];

        if (!empty($_FILES)) {
            foreach ($_FILES as $inputName => $phpFile) {
                if (!is_array($phpFile['name'])) {

                    // When this was a single file
                    $files[$inputName] = $this->handleUniqueFile($phpFile);
                } else {

                    //When the input has a 'multiple' attribute
                    $files[$inputName] = $this->handleMultipleFile($phpFile);
                }
            }
        }

        return $files;
    }
452088
static function defaultMimeType()
    {
        return array( 'name' => 'application/octet-stream',
                      'url' => false,
                      'filename' => false,
                      'dirpath' => false,
                      'basename' => false,
                      'suffix' => false,
                      'prefix' => false,
                      'suffixes' => false,
                      'prefixes' => false,
                      'is_valid' => true );
    }
110001
public function types()
    {
        if ($this->types === null) {
            $this->types = [];

            $grav = Grav::instance();

            /** @var UniformResourceLocator $locator */
            $locator = $grav['locator'];

            // Get stream / directory iterator.
            if ($locator->isStream($this->search)) {
                $iterator = $locator->getIterator($this->search);
            } else {
                $iterator = new \DirectoryIterator($this->search);
            }

            /** @var \DirectoryIterator $file */
            foreach ($iterator as $file) {
                if (!$file->isFile() || '.' . $file->getExtension() !== YAML_EXT) {
                    continue;
                }
                $name = $file->getBasename(YAML_EXT);
                $this->types[$name] = ucfirst(str_replace('_', ' ', $name));
            }
        }

        return $this->types;
    }
1029047
public function describe_file_types($types) {

        $descriptions = [];
        $types = $this->normalize_file_types($types);

        foreach ($types as $type) {
            if ($type === '*') {
                $desc = get_string('filetypesany', 'core_form');
                $descriptions[$desc] = [];
            } else if ($group = $this->is_filetype_group($type)) {
                $desc = $this->get_group_description($type);
                $descriptions[$desc] = $group->extensions;

            } else if ($this->looks_like_mimetype($type)) {
                $desc = get_mimetype_description($type);
                $descriptions[$desc] = file_get_typegroup('extension', [$type]);

            } else {
                $desc = get_mimetype_description(['filename' => 'fakefile'.$type]);
                if (isset($descriptions[$desc])) {
                    $descriptions[$desc][] = $type;
                } else {
                    $descriptions[$desc] = [$type];
                }
            }
        }

        $data = [];

        foreach ($descriptions as $desc => $exts) {
            sort($exts);
            $data[] = (object)[
                'description' => $desc,
                'extensions' => join(' ', $exts),
            ];
        }

        core_collator::asort_objects_by_property($data, 'description', core_collator::SORT_NATURAL);

        return (object)[
            'hasdescriptions' => !empty($data),
            'descriptions' => array_values($data),
        ];
    }
1188463
public function containsMultipleTypes()
    {
        $mixed = false;

        $types = [];
        foreach ($this->items as $item) {
            $class = get_class($item->getType());
            if (!in_array($class, $types, true)) {
                $types[] = $class;
            }
        }

        if (count($types) > 1) {
            $mixed = true;
        }

        return $mixed;
    }
238485
protected function get_module_name_plural() {
        if (isset(self::$modulenameplural)) {
            return self::$modulenameplural;
        }
        self::$modulenameplural = get_string('modulenameplural', 'assign');
        return self::$modulenameplural;
    }
936409
protected function validateMimeType () : bool
	{
		if (!is_array($this->allowedMimeTypes) || empty($this->allowedMimeTypes))
			return TRUE;
		if (!in_array($this->mimeType, $this->allowedMimeTypes)):
			$this->error = "Unsupported file type.";
			return FALSE;
		endif;
		return TRUE;
	}
801684
public function get_module_type_name($plural = false) {
        $modnames = get_module_types_names($plural);
        if (isset($modnames[$this->modname])) {
            return $modnames[$this->modname];
        } else {
            return null;
        }
    }
468290
public function plural_name()
    {
        if ($name = $this->config()->get('plural_name')) {
            return $name;
        }
        $name = $this->singular_name();
        //if the penultimate character is not a vowel, replace "y" with "ies"
        if (preg_match('/[^aeiou]y$/i', $name)) {
            $name = substr($name, 0, -1) . 'ie';
        }
        return ucfirst($name . 's');
    }
259955
public static function getFileFormTypes(): array
    {
        $values = array_map(static function (string $keyword): string {
            return self::getFileFormTypeValue($keyword);
        }, array_combine(self::OBJE_FILE_FORM_TYPE, self::OBJE_FILE_FORM_TYPE));

        uasort($values, '\Fisharebest\Webtrees\I18N::strcasecmp');

        return $values;
    }
367707
public static function pluralize($word)
    {
        if (isset(self::$_cache['pluralize'][$word])) {
            return self::$_cache['pluralize'][$word];
        }

        if (!isset(self::$_plural['merged']['irregular'])) {
            self::$_plural['merged']['irregular'] = self::$_plural['irregular'];
        }

        if (!isset(self::$_plural['merged']['uninflected'])) {
            self::$_plural['merged']['uninflected'] = array_merge(self::$_plural['uninflected'], self::$_uninflected);
        }

        if (!isset(self::$_plural['cacheUninflected']) || !isset(self::$_plural['cacheIrregular'])) {
            self::$_plural['cacheUninflected'] = '(?:' . implode('|', self::$_plural['merged']['uninflected']) . ')';
            self::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_plural['merged']['irregular'])) . ')';
        }

        if (preg_match('/(.*)\\b(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
            self::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1);
            return self::$_cache['pluralize'][$word];
        }

        if (preg_match('/^(' . self::$_plural['cacheUninflected'] . ')$/i', $word, $regs)) {
            self::$_cache['pluralize'][$word] = $word;
            return $word;
        }

        foreach (self::$_plural['rules'] as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                self::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
                return self::$_cache['pluralize'][$word];
            }
        }
    }
1160810
public static function plural($word)
    {
        if(is_array($word)) {
            $ret = [];
            foreach($word as $key => $value) {
                $ret[$key] = Str::plural($value);
            }

            return $ret;
        }

        return Inflector::plural($word);
    }
1313912
private function areMultipleNamespacesInFile()
    {
        if (count($this->objects) === 0) {
            return false;
        }

        $foundNamespaces = array();
        foreach ($this->objects as $object) {
            $ns = $object->getNamespace();
            if ($ns !== null) {
                $foundNamespaces[$ns] = $ns;
            }
        }

        $foundNamespacesCount = count($foundNamespaces);

        if ($foundNamespacesCount === 0) {
            return false;
        } elseif ($foundNamespacesCount > 1) {
            return true;
        } else {
            return !isset($foundNamespaces[$this->getNamespace()]);
        }
    }
545853
private function getCachedSingular($plural)
	{
		$plural = String::strtolower($plural);

		return array_search($plural, $this->cache);
	}