Greetings,
Until osclass 3.8 i had this fix for creating latin url our of the Greek characters of the listing title to the url.
1.- Look in oc-includes/osclass/helpers/hDefines.php for:
$url = str_replace('{ITEM_TITLE}', osc_sanitizeString($item['s_title']), $url);
and replace it with:
$url = str_replace('{ITEM_TITLE}', osc_sanitizeString( cust_cyrillic_to_latin($item['s_title']) ), $url);
Now, being a core file, remember that you need to redo this modification every time you upgrade Osclass.
2.- Add this at the very bottom of your theme functions.php (take care not to leave blank lines after this):
<?php
function cust_cyrillic_to_latin($textcyr) {
$cyr = array('α','β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ','ν','ξ','ο','п','ρ','σ','τ','υ',
'φ','χ','ψ','ω','Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ',
'Φ','Χ','Ψ','Ω','ί','ό','ώ','ά','ή','έ','€');
$lat = array( 'a','b','g','d','e','z','i','th','i','k','l','m','n','x','o','p','r','s','t','y',
'f' ,'x' ,'ps' ,'w','A','B','G','D','E','Z','I',
'TH','I','K','L','M','N','X','O','P','R','S','T','Y',
'F' ,'X' ,'Ps' ,'W' ,'i' ,'ο' ,'w', 'a', 'h', 'e', 'euro');
return str_replace($cyr, $lat, $textcyr);
}
?>
And it was working until i updated to the osclass 4.1.1.....
At the new version oc-includes/osclass/helpers/hDefines.php as follows bellow can you please tell me how i need write the old
$url = str_replace('{ITEM_TITLE}', osc_sanitizeString( cust_cyrillic_to_latin($item['s_title']) ), $url);
in order to work???
New code bellow as in hDefines.php in versions 4.1.1
/**
* Create automatically the url of the item details page
*
* @param string $locale
* @return string
* @throws \Exception
*/
function osc_premium_url($locale = '') {
if ( osc_rewrite_enabled() ) {
$sanitized_categories = array();
$cat = Category::newInstance()->hierarchy(osc_premium_category_id());
for ($i = count( $cat); $i > 0; $i--) {
$sanitized_categories[] = $cat[$i - 1]['s_slug'];
}
$url = str_replace( array ( '{ITEM_ID}' , '{CATEGORIES}' ) , array (
osc_premium_id() ,
implode( '/' , $sanitized_categories )
) , str_replace( '{ITEM_TITLE}', osc_sanitizeString( str_replace( ',', '-', osc_premium_title())), osc_get_preference( 'rewrite_item_url')) );
if($locale!='') {
$path = osc_base_url().$locale . '/' . $url;
} else {
$path = osc_base_url().$url;
}
} else {
$path = osc_item_url_ns( osc_premium_id(), $locale );
}
return $path;
}