public

German + Cyrillic + Greek - Enfold Theme Function - /framework/php/function-set-avia-backend.php lines 89-128

  • Download Gist
Cyrillic - Latin Wordpres - Avia Framework
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
if(!function_exists('avia_backend_safe_string'))
{
/**
* Create a lower case version of a string without spaces so we can use that string for database settings
*
* @param string $string to convert
* @return string the converted string
*/
 
function avia_backend_safe_string( $string , $replace = "_")
{
$string = strtolower($string);
$trans = array(
'&\#\d+?;' => '', '&\S+?;' => '', '\s+' => $replace,
//-------German Start
'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'Ä' => 'Ae',
'Ö' => 'Oe','Ü' => 'Ue','ß' => 'ss',
//-------Cyrillic Start
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Ѓ' => 'G`',
'Ґ' => 'G`', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'YO', 'Є' => 'YE',
'Ж' => 'ZH', 'З' => 'Z', 'Ѕ' => 'Z', 'И' => 'I', 'Й' => 'J',
'Ј' => 'J', 'І' => 'I', 'Ї' => 'YI', 'К' => 'K', 'Ќ' => 'K`',
'Л' => 'L', 'Љ' => 'L', 'М' => 'M', 'Н' => 'N', 'Њ' => 'N`',
'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
'У' => 'U', 'Ў' => 'U`', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'TS',
'Ч' => 'CH', 'Џ' => 'DH', 'Ш' => 'SH', 'Щ' => 'SHH', 'Ъ' => '``',
'Ы' => 'Y`', 'Ь' => '`', 'Э' => 'E`', 'Ю' => 'YU', 'Я' => 'YA',
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'ѓ' => 'g',
'ґ' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'є' => 'ye',
'ж' => 'zh', 'з' => 'z', 'ѕ' => 'z', 'и' => 'i', 'й' => 'j',
'ј' => 'j', 'і' => 'i', 'ї' => 'yi', 'к' => 'k', 'ќ' => 'k`',
'л' => 'l', 'љ' => 'l', 'м' => 'm', 'н' => 'n', 'њ' => 'n`',
'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't',
'у' => 'u', 'ў' => 'u`', 'ф' => 'f', 'х' => 'h', 'ц' => 'ts',
'ч' => 'ch', 'џ' => 'dh', 'ш' => 'sh', 'щ' => 'shh', 'ъ' => '``',
'ы' => 'y`', 'ь' => '`', 'э' => 'e`', 'ю' => 'yu', 'я' => 'ya',
//-------Greek Start
'Α' => 'A', 'α' => 'a', 'Β' => 'B', 'β' => 'b', 'Γ' => 'G',
'γ' => 'g', 'Δ' => 'D', 'δ' => 'd', 'Ε' => 'E', 'ε' => 'e',
'Ζ' => 'Z', 'ζ' => 'z', 'Η' => 'H', 'η' => 'h', 'Θ' => 'Q',
'θ' => 'q', 'Ι' => 'I', 'ι' => 'i', 'Κ' => 'K', 'κ' => 'k',
'Λ' => 'L', 'λ' => 'l', 'Μ' => 'M', 'μ' => 'm', 'Ν' => 'N',
'ν' => 'n', 'Ξ' => 'X', 'ξ' => 'x', 'Ο' => 'O', 'ο' => 'o',
'Π' => 'P', 'π' => 'p', 'Ρ' => 'R', 'ρ' => 'r', 'Σ' => 'S',
'σ' => 's', 'Τ' => 'T', 'τ' => 't', 'Υ' => 'Y', 'υ' => 'y',
'Φ' => 'F', 'φ' => 'f', 'Χ' => 'C', 'χ' => 'c', 'Ψ' => 'U',
'ψ' => 'u', 'Ω' => 'W', 'ω' => 'w',
//-------End Languages
'[^a-z0-9\-\._]' => '', $replace.'+' => $replace,
$replace.'$' => $replace, '^'.$replace => $replace, '\.+$' => ''
);//end of $trans array
 
$string = strip_tags($string);
foreach ($trans as $key => $val)
{
$string = preg_replace("#".$key."#i", $val, $string);
}
return stripslashes($string);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.