public function titleToIdentifier($depth, $text)
    {
        /** @var callable $func */
        $func = $this->getParam('titleToIdFunction');
        if (isset($func)) {
            return ($func($depth, $text));
        }
        // conversion of accented characters
        // see http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html
        $text = htmlentities($text, ENT_NOQUOTES, 'utf-8');
        $text = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $text);
        $text = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $text); // for ligatures e.g. '&oelig;'
        $text = preg_replace('#&([lr]s|sb|[lrb]d)(quo);#', ' ', $text); // for *quote (http://www.degraeve.com/reference/specialcharacters.php)
        $text = str_replace('&nbsp;', ' ', $text); // for non breaking space
        $text = preg_replace('#&[^;]+;#', '', $text); // strips other characters

        $text = preg_replace("/[^a-zA-Z0-9_-]/", ' ', $text); // remove any other characters
        $text = str_replace(' ', '-', $text);
        $text = preg_replace('/\s+/', " ", $text);
        $text = preg_replace('/-+/', "-", $text);
        $text = trim($text, '-');
        $text = trim($text);
        $text = empty($text) ? '-' : $text;

        return ($text);
    }
public function titleToIdentifier($depth, $text)
    {
        /** @var callable $func */
        $func = $this->getParam('titleToIdFunction');
        if (isset($func)) {
            return ($func($depth, $text));
        }
        // conversion of accented characters
        // see http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html
        $text = htmlentities($text, ENT_NOQUOTES, 'utf-8');
        $text = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $text);
        $text = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $text); // for ligatures e.g. '&oelig;'
        $text = preg_replace('#&([lr]s|sb|[lrb]d)(quo);#', ' ', $text); // for *quote (http://www.degraeve.com/reference/specialcharacters.php)
        $text = str_replace('&nbsp;', ' ', $text); // for non breaking space
        $text = preg_replace('#&[^;]+;#', '', $text); // strips other characters

        $text = preg_replace("/[^a-zA-Z0-9_-]/", ' ', $text); // remove any other characters
        $text = str_replace(' ', '-', $text);
        $text = preg_replace('/\s+/', " ", $text);
        $text = preg_replace('/-+/', "-", $text);
        $text = trim($text, '-');
        $text = trim($text);
        $text = empty($text) ? '-' : $text;

        return ($text);
    }
public function titleToIdentifier ( $ depth , $ text ) { /** @var callable $func */ $ func = $ this -> getParam ( 'titleToIdFunction' ) ; if ( isset ( $ func ) ) { return ( $ func ( $ depth , $ text ) ) ; } // conversion of accented characters // see http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html $ text = htmlentities ( $ text , ENT_NOQUOTES , 'utf-8' ) ; $ text = preg_replace ( '#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#' , '\1' , $ text ) ; $ text = preg_replace ( '#&([A-za-z]{2})(?:lig);#' , '\1' , $ text ) ; // for ligatures e.g. '&oelig;' $ text = preg_replace ( '#&([lr]s|sb|[lrb]d)(quo);#' , ' ' , $ text ) ; // for *quote (http://www.degraeve.com/reference/specialcharacters.php) $ text = str_replace ( '&nbsp;' , ' ' , $ text ) ; // for non breaking space $ text = preg_replace ( '#&[^;]+;#' , '' , $ text ) ; // strips other characters $ text = preg_replace ( "/[^a-zA-Z0-9_-]/" , ' ' , $ text ) ; // remove any other characters $ text = str_replace ( ' ' , '-' , $ text ) ; $ text = preg_replace ( '/\s+/' , " " , $ text ) ; $ text = preg_replace ( '/-+/' , "-" , $ text ) ; $ text = trim ( $ text , '-' ) ; $ text = trim ( $ text ) ; $ text = empty ( $ text ) ? '-' : $ text ; return ( $ text ) ; }
Convert title string to a usable HTML identifier.
@param    int $depth Depth of the title.
@param    string $text Input string.
@return    string    The converted string.
Convert title string to a usable HTML identifier .