In CodeIgniter, the url_title function takes a "title" string as input and creates a human-friendly URL string with a "separator" (dash or underscore).
Currently, the function remove single quote. In french, the single quote (apostrophe) is a word separator.
For example : The expected slug for "L'apostrophe" is "l-apostrophe", and not "lapostrophe" as it is currently the output of the url_title function.
I would like to update the following source code (/system/helpers/url_helper.php - line 493):
$trans = array(
'&.+?;' => '',
'[^\w\d _-]' => '',
'\s+' => $separator,
'('.$q_separator.')+' => $separator
);
Since but I'm not familiar with RegEx, it would be nice if someone could help me to add single quote in the array $trans
in order to convert single quotes into separators.
Modifying the CodeIgniter core is always a problem to ensure upgrade and compatibility with future versions. I would better suggest to update the array of foreign characters for transliteration | conversion used by the Text helper (in /application/config/foreign_chars.php).
Add the following line at the end of the array:
'/\'/' => ' '
This will convert single quotes ('/\'/'
) to spaces (' '
) when calling the convert_accented_characters
function.