Moderator: Moderators

function format_url( $url, $type = 'topic' ) {
$url = preg_replace('`\[.*\]`U','',$url);
$url = htmlentities($url, ENT_COMPAT, $this->encoding);
$url = str_replace( array('č', 'Č'),'c', $url );
$url = str_replace( array('ą', 'Ą'),'a', $url );
$url = str_replace( array('ė', 'ė'),'e', $url );
$url = str_replace( array('ę', 'Ę'),'e', $url );
$url = str_replace( array('į', 'Į'),'i', $url );
$url = str_replace( array('š', 'Š'),'s', $url );
$url = str_replace( array('ų', 'Ų'),'u', $url );
$url = str_replace( array('ū', 'Ū'),'u', $url );
$url = str_replace( array('ž', 'Ž'),'z', $url );
$url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
$url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
$url = strtolower(trim($url, '-'));
return empty($url) ? $type : $url;
}
SeO wrote:http://phpbb3.phpbb-seo.net/another-test-forum-f4/cc-tt-dd-ll-nn-zz-ss-t42.html
žŽ needed an extra replace, šŠ is handled by htmlentities().
So just add :
- Code: Select all
// --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(utf8_chr(268),utf8_chr(269), // c
utf8_chr(356),utf8_chr(357), // t
utf8_chr(270),utf8_chr(271), // d
utf8_chr(317),utf8_chr(318), // l
utf8_chr(327),utf8_chr(328), // n
utf8_chr(381),utf8_chr(382), // z
);
$this->seo_opt['url_replace'] = array('c', 'c', 't', 't', 'd', 'd', 'l', 'l','n', 'n', 'z', 'z');
Instead of the code you mentionned.
Bembis wrote:I need ą Ą to a Šš to s ęĘ to e įĮ to i šŠ to s ųŲ to u ūŪ to u ėĖ to e ęĘ to e![]()

Bembis wrote:so ?
// --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(utf8_chr(260),utf8_chr(261), // ą Ą -a
utf8_chr(268),utf8_chr(269), // čČ-c
utf8_chr(280),utf8_chr(281), // ęĘ-e
utf8_chr(278),utf8_chr(279), // ėĖ-e
utf8_chr(302),utf8_chr(303), // Įį-i
utf8_chr(138),utf8_chr(154), utf8_chr(352),utf8_chr(353), // Šš-s
utf8_chr(370),utf8_chr(371), // Ųų-u
utf8_chr(362),utf8_chr(363), // Ūū-u
utf8_chr(142),utf8_chr(158), utf8_chr(381),utf8_chr(382), // Žž-z
);
$this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'e', 'e','i', 'i', 's', 's', 's', 's', 'u', 'u', 'u', 'u', 'z', 'z', 'z', 'z');
// --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(
utf8_chr(196),utf8_chr(228), // ä
utf8_chr(214),utf8_chr(246), // ö
utf8_chr(220),utf8_chr(252), // ü
utf8_chr(223), // ß
utf8_chr(39), utf8_chr(180), // '´
);
$this->seo_opt['url_replace'] = array('ae', 'ae', 'oe', 'oe', 'ue', 'ue', 'ss', '', '');


// --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(
utf8_chr(353),utf8_chr(352), // š
utf8_chr(273),utf8_chr(272), // đ
utf8_chr(382),utf8_chr(381), // ž
utf8_chr(269),utf8_chr(268), // č
utf8_chr(263),utf8_chr(262), // ć
);
$this->seo_opt['url_replace'] = array('s', 's', 'd', 'd', 'z', 'z', 'c', 'c','c', 'c');
// Array of the filenames that may require the use of a base href tag.&# 259;,&# 7855;,&# 7857;,&# 7859;,&# 7863;,ã,á, à, &# 7841;, &# 7843;, â, &# 7845;,&# 7847;, &# 7849;, &# 7853;, &# 7851; => a
ú, ù, &# 7911;, &# 361;, &# 7909; => u
ì, &# 7883;, í, &# 7881;, &# 297; => i
&# 7871;, &# 7873;, &# 7875;, &# 7877;, &# 7879; => e
ò, ó, &# 7887;, õ, &# 7885;, ô, &# 7891;, &# 7889;, &# 7895;, &# 7897;, &# 7893; => o// --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(
utf8_chr(259), utf8_chr(7855), utf8_chr(7857), utf8_chr(7859), utf8_chr(7863), utf8_chr(7841), utf8_chr(7843), utf8_chr(7845), utf8_chr(7847), utf8_chr(7849), utf8_chr(7853), utf8_chr(7851), // ă,ắ,ằ,ẳ,ặ, ạ, ả, ấ,ầ, ẩ, ậ, ẫ
utf8_chr(7911), utf8_chr(361), utf8_chr(7909), // ủ, ũ, ụ
utf8_chr(236), utf8_chr(7883), utf8_chr(237), utf8_chr(7881), utf8_chr(297),// ì, ị, í, ỉ, ĩ
// ++ the e and o case
);
$this->seo_opt['url_replace'] = array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'u', 'u', 'u', 'i', 'i', 'i', 'i', 'i');
// Array of the filenames that may require the use of a base href tag. $url = preg_replace('`\[.*\]`U','',$url); $url = preg_replace('`\[.*\]`U','',utf8_strtolower($url)); $url = strtolower(trim($url, '-')); $url = trim($url, '-');
Users browsing this forum: No registered users and 29 guests