app/functions.php
/**
 * Function used to create a slug associated to an "ugly" string.
 * 
 * @param string $string the string to transform.
 * @return string the resulting slug.
 * @since 1.0.0
 */
Function used to create a slug associated to an "ugly" string.


Function used to create a slug associated to an " ugly " string .
function slugify($string)
{
    $table = array(
        'Š' => 'S', 'š' => 's', 'Đ' => 'Dj', 'đ' => 'dj', 'Ž' => 'Z', 'ž' => 'z', 'Č' => 'C', 'č' => 'c', 'Ć' => 'C', 'ć' => 'c',
        'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'A', 'Ç' => 'C', 'È' => 'E', 'É' => 'E',
        'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O',
        'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y', 'Þ' => 'B', 'ß' => 'Ss',
        'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'a', 'ç' => 'c', 'è' => 'e', 'é' => 'e',
        'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'o', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o',
        'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ý' => 'y', 'ý' => 'y', 'þ' => 'b',
        'ÿ' => 'y', 'Ŕ' => 'R', 'ŕ' => 'r', '/' => '-', ' ' => '-'
    );
    $stripped = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string);
    return strtolower(strtr($string, $table));
}
function slugify ( $ string ) { $ table = array ( 'Š'  >  S', š' =  ' ',  ' ' => 'D ', ' đ  =>  dj , 'Ž ' => ' ', 'ž' > 'z ,  Č'  =  'C'  ' ' = > 'c', 'Ć  => C',  ć' =>  ' ', 'À'  >  A', Á' =  ' ',  ' ' => 'A , ' Ã  =>  A'  'Ä ' => ' ', 'Å' > 'A ,  Æ'  =  'A'  ' ' = > 'C', 'È  => E',  É' =>  ' ', 'Ê'  >  E', Ë' =  ' ',  ' ' => 'I , ' Í  =>  I'  'Î ' => ' ', 'Ï' > 'I ,  Ñ'  =  'N'  ' ' = > 'O', 'Ó  => O',  Ô' =>  ' ', 'Õ'  >  O', Ö' =  ' ',  ' ' => 'O , ' Ù  =>  U'  'Ú ' => ' ', 'Û' > 'U ,  Ü'  =  'U'  ' ' = > 'Y', 'Þ  => B',  ß' =>  ' s', 'à'  >  a', á' =  ' ',  ' ' => 'a , ' ã  =>  a'  'ä ' => ' ', 'å' > 'a ,  æ'  =  'a'  ' ' = > 'c', 'è  => e',  é' =>  ' ', 'ê'  >  e', ë' =  ' ',  ' ' => 'i , ' í  =>  i'  'î ' => ' ', 'ï' > 'i ,  ð'  =  'o'  ' ' = > 'n', 'ò  => o',  ó' =>  ' ', 'ô'  >  o', õ' =  ' ',  ' ' => 'o , ' ø  =>  o'  'ù ' => ' ', 'ú' > 'u ,  û'  =  'u'  ' ' = > 'y', 'ý  => y',  þ' =>  ' ', 'ÿ'  >  y', Ŕ' =  ' ',  ' ' => 'r , ' /  => '- , '  => '- ) ; $ stripped = preg_replace ( array ( '/\s{2,}/' , '/[\t\n]/' ) , ' ' , $ string ) ; return strtolower ( strtr ( $ string , $ table ) ) ; }
Function used to create a slug associated to an "ugly" string.
Function used to create a slug associated to an " ugly " string .
// -- Remove duplicated spaces // -- Returns the slug