Transliterate Hungarian chars

@param string $s
@return string
502923
private function transliterateHungarian($s)
    {
        $table = array(
            'á' => 'a',
            'é' => 'e',
            'í' => 'i',
            'ó' => 'o',
            'ö' => 'o',
            'ő' => 'o',
            'ú' => 'u',
            'ü' => 'u',
            'ű' => 'u',
        );
        return strtr($s, $table);
    }
232460
private function _trimSpecialsChars ($s)
    {
        if (count($this->getNotReplacedChars()) == 0) {
            $reg = '~[^-a-z0-9_]+~';
        } else {
            $reg = '~[^-a-z0-9_' . implode('',$this->getNotReplacedChars()) .']+~';
        }
        return preg_replace($reg, '', $s);
    }
941377
public static function translitRu(string $str): string
    {
        $dic = array(
            'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G',
            'Д' => 'D', 'Е' => 'E', 'Ж' => 'J', 'З' => 'Z', 'И' => 'I',
            'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N',
            'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
            'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'Ts', 'Ч' => 'Ch',
            'Ш' => 'Sh', 'Щ' => 'Sch', 'Ъ' => '', 'Ы' => 'Yi', 'Ь' => '',
            'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya', 'а' => 'a', 'б' => 'b',
            'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ж' => 'j',
            'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l',
            'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
            'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h',
            'ц' => 'ts', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ъ' => 'y',
            'ы' => 'yi', 'ь' => '\'', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya',
        );

        return strtr($str, $dic);
    }
1044958
public function buildLenEncodedBinary($s)
    {
        if ($s === null) {
            return "\251";
        }

        $l = mb_orig_strlen($s);

        if ($l <= 250) {
            return chr($l) . $s;
        }

        if ($l <= 0xFFFF) {
            return "\252" . Binary::int2bytes(2, true) . $s;
        }

        if ($l <= 0xFFFFFF) {
            return "\254" . Binary::int2bytes(3, true) . $s;
        }

        return Binary::int2bytes(8, $l, true) . $s;
    }
1188075
private function transliterateRussian($s)
    {
        $table = array(
            "А" => "A",
            "Б" => "B",
            "В" => "V",
            "Г" => "G",
            "Д" => "D",
            "Є" => "E",
            "Е" => "JE",
            "Ё" => "JO",
            "Ж" => "ZH",
            "З" => "Z",
            "И" => "I",
            "Й" => "J",
            "К" => "K",
            "Л" => "L",
            "М" => "M",
            "Н" => "N",
            "О" => "O",
            "П" => "P",
            "Р" => "R",
            "С" => "S",
            "Т" => "T",
            "У" => "U",
            "Ф" => "F",
            "Х" => "KH",
            "Ц" => "TS",
            "Ч" => "CH",
            "Ш" => "SH",
            "Щ" => "SHCH",
            "Ъ" => "",
            "Ы" => "Y",
            "Ь" => "",
            "Э" => "E",
            "Ю" => "JU",
            "Я" => "JA",
            "Ґ" => "G",
            "Ї" => "I",
            "а" => "a",
            "б" => "b",
            "в" => "v",
            "г" => "g",
            "д" => "d",
            "є" => "e",
            "е" => "je",
            "ё" => "jo",
            "ж" => "zh",
            "з" => "z",
            "и" => "i",
            "й" => "j",
            "к" => "k",
            "л" => "l",
            "м" => "m",
            "н" => "n",
            "о" => "o",
            "п" => "p",
            "р" => "r",
            "с" => "s",
            "т" => "t",
            "у" => "u",
            "ф" => "f",
            "х" => "kh",
            "ц" => "ts",
            "ч" => "ch",
            "ш" => "sh",
            "щ" => "shch",
            "ъ" => "",
            "ы" => "y",
            "ь" => "",
            "э" => "e",
            "ю" => "ju",
            "я" => "ja",
            "ґ" => "g",
            "ї" => "i"
        );
        return strtr($s, $table);
    }
636436
public static function translit($string)
    {
        $string = strtr($string,
            "абвгдежзийклмнопрстуфыэАБВГДЕЖЗИЙКЛМНОПРСТУФЫЭ",
            "abvgdegziyklmnoprstufieABVGDEGZIYKLMNOPRSTUFIE"
        );
        $string = strtr($string,
            array(
            'ё' => "yo", 'х' => "h", 'ц' => "ts", 'ч' => "ch", 'ш' => "sh",
            'щ' => "shch", 'ъ' => '', 'ь' => '', 'ю' => "yu", 'я' => "ya",
            'Ё' => "Yo", 'Х' => "H", 'Ц' => "Ts", 'Ч' => "Ch", 'Ш' => "Sh",
            'Щ' => "Shch", 'Ъ' => '', 'Ь' => '', 'Ю' => "Yu", 'Я' => "Ya",
        ));
        return $string;
    }
1245860
public static function toAscii(string $str) : string
    {
        if (preg_match("/[\x80-\xFF]/", $str)) {
            // Grab the transliteration table since we'll need it.
            if (null === static::$ascii) {
                static::$ascii = unserialize(file_get_contents(__DIR__ . '/str/resources/transliteration_table.ser'));
            }

            $str = \Normalizer::normalize($str, \Normalizer::NFKD);
            $str = preg_replace('/\p{Mn}+/u', '', $str);
            $str = str_replace(static::$ascii[0], static::$ascii[1], $str);
            $str = iconv('UTF-8', 'ASCII' . ('glibc' !== ICONV_IMPL ? '//IGNORE' : '') . '//TRANSLIT', $str);
        }

        return $str;
    }
1071861
static function translit($string)
    {
        if (!isset(self::$translit_table)){
            self::$translit_table = array(
                'А' => 'A',		'Б' => 'B',		'В' => 'V',		'Г' => 'G',		'Д' => 'D',
                'Е' => 'E',		'Ё' => 'YO',	'Ж' => 'ZH',	'З' => 'Z',		'И' => 'I',
                'Й' => 'J',		'К' => 'K',		'Л' => 'L',		'М' => 'M',		'Н' => 'N',
                'О' => 'O',		'П' => 'P',		'Р' => 'R',		'С' => 'S',		'Т' => 'T',
                'У' => 'U',		'Ф' => 'F',		'Х' => 'H',		'Ц' => 'C',		'Ч' => 'CH',
                'Ш' => 'SH',	'Щ' => 'CSH',	'Ь' => '',		'Ы' => 'Y',		'Ъ' => '',
                'Э' => 'E',		'Ю' => 'YU',	'Я' => 'YA',
                'а' => 'a',		'б' => 'b',		'в' => 'v',		'г' => 'g',		'д' => 'd',
                'е' => 'e',		'ё' => 'yo',	'ж' => 'zh',	'з' => 'z',		'и' => 'i',
                'й' => 'j',		'к' => 'k',		'л' => 'l',		'м' => 'm',		'н' => 'n',
                'о' => 'o',		'п' => 'p',		'р' => 'r',		'с' => 's',		'т' => 't',
                'у' => 'u',		'ф' => 'f',		'х' => 'h',		'ц' => 'c',		'ч' => 'ch',
                'ш' => 'sh',	'щ' => 'csh',	'ь' => '',		'ы' => 'y',		'ъ' => '',
                'э' => 'e',		'ю' => 'yu',	'я' => 'ya',
            );
        }
        return @iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', str_replace(array_keys(self::$translit_table), array_values(self::$translit_table), $string));
    }
1054189
public static function webalize(string $s, string $charList = null, bool $lower = true): string
    {
        $s = static::toAscii($s);
        if ($lower) {
            $s = \strtolower($s);
        }
        $s = \preg_replace('#[^a-z0-9' . ($charList !== null ? \preg_quote($charList, '#') : '') . ']+#i', '-', $s);
        $s = \trim($s, '-');

        return $s;
    }
583160
function phpEscape(s) {
  var result = '"';
  for (let cp of UnicodeUtils.getCodePoints(s)) {
    let special = specialEscape[cp];
    if (special !== undefined) {
      result += special;
    } else if (cp >= 0x20 && cp <= 0x7e) {
      result += String.fromCodePoint(cp);
    } else if (cp <= 0xFFFF) {
      result += '\\u{' + zeroPaddedHex(cp, 4) + '}';
    } else {
      result += '\\u{' + zeroPaddedHex(cp, 6) + '}';
    }
  }
  result += '"';
  return result;
}
1333340
public static function translitStringToAscii($str) {
        $LATV=array("ā","Ā","č","Č","ē","Ē","ģ","Ģ","ī","Ī","ķ","Ķ","ļ","Ļ","ņ","Ņ","š","Š","ū","Ū","ž","Ž",".",'"',"   ","-","_","/"); //Latviešu garie un mīkste burti un neatļautie simboli
        $LATIN=array("a","A","c","C","e","E","g","G","i","I","k","K","l","L","n","N","s","S","u","U","z","Z","",""," ",""," "," "); //Latviešu mīksto un garo burtu un neatļauto simbolu aizstāēji
        return str_replace($LATV,$LATIN,$str); //Latviešu garos un mīkstos burtus aizstāj ar latīņu burtiem
        //$str = str_replace(array('й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю','Ā','Č','Ē','Ģ','Ī','Ķ','Ļ','Ņ','Š','Ū','Ž', 'ā','č','ē','ģ','ī','ķ','ļ','ņ','š','ū','ž'),array('A','C','E','G','I','K','L','N','S','U','Z','a','c','e','g','i','k','l','n','s','u','z','i','c','u','k','e','n','g','sh','sh','z','h','i','f','i','v','a','p','r','o','l','d','zh','e','ja','ch','s','m','i','t','','b','ju','I','C','U','K','E','N','G','SH','SH','Z','H','I','F','I','V','A','P','R','O','L','D','ZH','E','JA','CH','S','M','I','T','','B','JU','A','C','E','G','I','K','L','N','S','U','Z','a','c','e','g','i','k','l','n','s','u','z'),$str);
	return $str;
}
1170269
public static function escapeAssertion($s)
    {
        if (0 === strpos($s, 'r.')) {
            $s = substr_replace($s, 'r_', 0, 2);
        }
        if (0 === strpos($s, 'p.')) {
            $s = substr_replace($s, 'p_', 0, 2);
        }

        $s = preg_replace_callback("~(\|| |=|\)|\(|&|<|>|,|\+|-|!|\*|\/)(r|p)(\.)~", function ($m) {
            return $m[1].$m[2].'_';
        }, $s);

        return $s;
    }
1292568
private function transliteratePolish($s)
    {
        $table = array(
        'ą' => 'a',
        'ę' => 'e',
        'ó' => 'o',
        'ć' => 'c',
        'ł' => 'l',
        'ń' => 'n',
        'ś' => 's',
        'ż' => 'z',
        'ź' => 'z',
        'Ó' => 'O',
        'Ć' => 'C',
        'Ł' => 'L',
        'Ś' => 'S',
        'Ż' => 'Z',
        'Ź' => 'Z'
        );
        return strtr($s, $table);
    }
1150825
private function _transliterateFrench ($s)
    {        
        $table = array (
            'â' => 'a',
            'ê' => 'e',
            'î' => 'i',
            'ô' => 'o',
            'û' => 'u',
            'Â' => 'A',
            'Ê' => 'E',
            'Î' => 'I',
            'Ô' => 'O',
            'Û' => 'U',
            'œ' => 'oe',
            'æ' => 'ae',
            'Ÿ' => 'Y',
            'ç' => 'c',
        	'Ç' => 'C',
        );
        return strtr($s, $table);
    }
90206
public static function transliterate($str)
    {
        $transliterations = array(
            'a' => 'áăâäàāąåãǻǎ',
            'ae' => 'æǽ',
            'c' => 'ćčçĉċ',
            'd' => 'ðďđ',
            'e' => 'éĕěêëėèēę',
            'g' => 'ğĝģġ',
            'h' => 'ħĥ',
            'i' => 'ıíĭîïìīįĩǐ',
            'ij' => 'ĳ',
            'j' => 'ȷĵ',
            'k' => 'ķ',
            'l' => 'ĺľļŀł',
            'n' => 'ńňņñ',
            'ng' => 'ŋ',
            'o' => 'óŏôöòőōøõǿǒơ',
            'oe' => 'œ',
            'r' => 'ŕřŗ',
            's' => 'śšşŝș',
            'ss' => 'ß',
            't' => 'ŧťţț',
            'th' => 'þ',
            'u' => 'úŭûüùűūųůũǔǖǘǚǜư',
            'w' => 'ẃŵẅẁ',
            'y' => 'ýŷÿỳ',
            'z' => 'źžż',
            
            'A' => 'ÁĂÂÄÀĀĄÅÃǺǍ',
            'Ae' => 'ÆǼ',
            'C' => 'ĆČÇĈĊ',
            'D' => 'ÐĎĐ',
            'E' => 'ÉĔĚÊËĖÈĒĘ',
            'G' => 'ĞĜĢĠ',
            'H' => 'ĦĤ',
            'I' => 'IÍĬÎÏİÌĪĮĨǏ',
            'Ij' => 'Ĳ',
            'J' => 'Ĵ',
            'K' => 'Ķ',
            'L' => 'ĹĽĻĿŁ',
            'N' => 'ŃŇŅÑ',
            'Ng' => 'Ŋ',
            'O' => 'ÓŎÔÖÒŐŌØÕǾǑƠ',
            'Oe' => 'Œ',
            'R' => 'ŔŘŖ',
            'S' => 'ŚŠŞŜȘ',
            // 'SS' => 'SS',
            'T' => 'ŦŤŢȚ',
            'Th' => 'Þ',
            'U' => 'ÚŬÛÜÙŰŪŲŮŨǓǕǗǙǛƯ',
            'W' => 'ẂŴẄẀ',
            'Y' => 'ÝŶŸỲ',
            'Z' => 'ŹŽŻ',
            
            '1' => '¹',
            '2' => '²',
            '3' => '³',
            '4' => '⁴',
        );
        
        $originals = array_map(function($el){
            return '/[' . $el . ']/u';
        }, array_values($transliterations));
        $out = preg_replace($originals, array_keys($transliterations), $str);
        return $out;
    }
973597
private function adjustString($s)
    {
        if (!is_string($s)) {
            return $s;
        }

        if ($this->config['i18nLib'] === self::VUEX_I18N) {
            $searchPipePattern = '/(\s)*(\|)(\s)*/';
            $threeColons = ' ::: ';
            $s = preg_replace($searchPipePattern, $threeColons, $s);
        }

        return preg_replace_callback(
            '/(?<!mailto|tel):\w+/',
            function ($matches) {
                return '{' . mb_substr($matches[0], 1) . '}';
            },
            $s
        );
    }
496597
private function _transliterateDanish ($s)
    {
        $table = array(
        'æ' => 'ae', 
        'ø' => 'oe', 
        'å' => 'aa', 
        'Æ' => 'Ae', 
        'Ø' => 'Oe', 
        'Å' => 'Aa' 
        );
        return strtr($s, $table);
    }