60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?PHP
|
|
/**
|
|
* Contains a class of blacklists for unwanted terms.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
*/
|
|
declare(strict_types = 1);
|
|
|
|
/**
|
|
* Contains lists of disallowed terms by language.
|
|
*/
|
|
final class NodaBlacklistedTerms {
|
|
/**
|
|
* A blacklist of disallowed tags. All entries are listed in full lowercase.
|
|
*/
|
|
const TAG_BLACKLIST = [
|
|
'de' => [
|
|
'andere',
|
|
'sonst',
|
|
'sonst.',
|
|
'sonstige',
|
|
'versch.',
|
|
'verschiedenes',
|
|
'unbekannt',
|
|
'weiteres',
|
|
],
|
|
'en' => [
|
|
'unknown',
|
|
'various',
|
|
],
|
|
'hu' => [
|
|
'ismeretlen',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Checks if an tag name is blacklisted.
|
|
*
|
|
* @param string $lang Input language.
|
|
* @param string $name Input name to check.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public static function tagIsInBlacklist(string $lang, string $name):bool {
|
|
|
|
$toCheck = \strtolower($name);
|
|
|
|
if (!isset(self::TAG_BLACKLIST[$lang])) {
|
|
return false;
|
|
}
|
|
|
|
if (\in_array($toCheck, self::TAG_BLACKLIST[$lang], true)) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
}
|