Points
8
Solutions
0
Thank you very much!That is going to require quite a bit of code customization in the functions.php. I will share the code later on with you.
I continue to fill the forum with my sometimes silly questions. And here's the next one: how and where to set up transliteration so that URLs use Latin instead of Cyrillic? This is an article in the blog section.
View attachment 272
function clean($string) {
// Transliterate Cyrillic (and other non-Latin) to Latin
if (function_exists('transliterator_transliterate')) {
$string = transliterator_transliterate(
'Any-Latin; Latin-ASCII; Lower()',
$string
);
} else {
// Fallback if intl extension isn't available
$string = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $string);
}
// --- existing Sngine logic below ---
$string = preg_replace('/[^\p{L}\p{N}\-]+/u', '-', $string);
$string = preg_replace('/-+/', '-', $string);
$string = trim($string, '-');
return $string;
}
Should it just be inserted? Or should something be replaced?The code will look something like this after you have made the edits.
Should it just be inserted? Or should something be replaced?
function get_url_text($string, $length = 10)
{
$string = html_entity_decode($string, ENT_QUOTES);
$string = htmlspecialchars_decode($string, ENT_QUOTES);
// Transliterate Cyrillic / non-Latin to Latin ASCII
if (function_exists('transliterator_transliterate')) {
$transliterated = transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', $string);
if ($transliterated !== false && $transliterated !== null) {
$string = $transliterated;
}
} else {
$fallback = @iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $string);
if ($fallback !== false) {
$string = $fallback;
}
}
$string = preg_replace('/[^\\pL\d]+/u', '-', $string);
$string = trim($string, '-');
$string = strtolower($string);
$words = explode("-", $string);
if (count($words) > $length) {
$string = "";
for ($i = 0; $i < $length; $i++) {
$string .= "-" . $words[$i];
}
$string = trim($string, '-');
}
return $string;
}
I forgot that the version you are using is a nulled version, so the line number will be different for you than me.It doesn't work. I'll send you this file. Maybe I'm doing something wrong...