concrete/src/Utility/Service/Text.php
public function urlify($handle, $max_length = null, $locale = '', $removeExcludedWords = true)
    {
        if ($max_length === null) {
            $max_length = Config::get('concrete.seo.segment_max_length');
        }
        $text = strtolower(str_replace(array("\r", "\n", "\t"), ' ', $this->asciify($handle, $locale)));
        if ($removeExcludedWords) {
            $excludeSeoWords = Config::get('concrete.seo.exclude_words');
            if (is_string($excludeSeoWords)) {
                if (strlen($excludeSeoWords)) {
                    $remove_list = explode(',', $excludeSeoWords);
                    $remove_list = array_map('trim', $remove_list);
                    $remove_list = array_filter($remove_list, 'strlen');
                } else {
                    $remove_list = array();
                }
            } else {
                $remove_list = URLify::$remove_list;
            }
            if (count($remove_list)) {
                $text = preg_replace('/\b(' . implode('|', $remove_list) . ')\b/i', '', $text);
            }
        }
        $text = preg_replace('/[^-\w\s]/', '', $text);   // remove unneeded chars
        $text = str_replace('_', ' ', $text);            // treat underscores as spaces
        $text = preg_replace('/^\s+|\s+$/', '', $text);  // trim leading/trailing spaces
        $text = preg_replace('/[-\s]+/', '-', $text);    // convert spaces to hyphens
        $text = strtolower($text);                       // convert to lowercase
        return trim(substr($text, 0, $max_length), '-'); // trim to first $maxlength chars
    }
public function urlify($handle, $max_length = null, $locale = '', $removeExcludedWords = true)
    {
        if ($max_length === null) {
            $max_length = Config::get('concrete.seo.segment_max_length');
        }
        $text = strtolower(str_replace(array("\r", "\n", "\t"), ' ', $this->asciify($handle, $locale)));
        if ($removeExcludedWords) {
            $excludeSeoWords = Config::get('concrete.seo.exclude_words');
            if (is_string($excludeSeoWords)) {
                if (strlen($excludeSeoWords)) {
                    $remove_list = explode(',', $excludeSeoWords);
                    $remove_list = array_map('trim', $remove_list);
                    $remove_list = array_filter($remove_list, 'strlen');
                } else {
                    $remove_list = array();
                }
            } else {
                $remove_list = URLify::$remove_list;
            }
            if (count($remove_list)) {
                $text = preg_replace('/\b(' . implode('|', $remove_list) . ')\b/i', '', $text);
            }
        }
        $text = preg_replace('/[^-\w\s]/', '', $text);   // remove unneeded chars
        $text = str_replace('_', ' ', $text);            // treat underscores as spaces
        $text = preg_replace('/^\s+|\s+$/', '', $text);  // trim leading/trailing spaces
        $text = preg_replace('/[-\s]+/', '-', $text);    // convert spaces to hyphens
        $text = strtolower($text);                       // convert to lowercase
        return trim(substr($text, 0, $max_length), '-'); // trim to first $maxlength chars
    }
public function urlify ( $ handle , $ max_length = null , $ locale = '' , $ removeExcludedWords = true ) { if ( $ max_length === null ) { $ max_length = Config :: get ( 'concrete.seo.segment_max_length' ) ; } $ text = strtolower ( str_replace ( array ( "\r" , "\n" , "\t" ) , ' ' , $ this -> asciify ( $ handle , $ locale ) ) ) ; if ( $ removeExcludedWords ) { $ excludeSeoWords = Config :: get ( 'concrete.seo.exclude_words' ) ; if ( is_string ( $ excludeSeoWords ) ) { if ( strlen ( $ excludeSeoWords ) ) { $ remove_list = explode ( ',' , $ excludeSeoWords ) ; $ remove_list = array_map ( 'trim' , $ remove_list ) ; $ remove_list = array_filter ( $ remove_list , 'strlen' ) ; } else { $ remove_list = array ( ) ; } } else { $ remove_list = URLify :: $ remove_list ; } if ( count ( $ remove_list ) ) { $ text = preg_replace ( '/\b(' . implode ( '|' , $ remove_list ) . ')\b/i' , '' , $ text ) ; } } $ text = preg_replace ( '/[^-\w\s]/' , '' , $ text ) ; // remove unneeded chars $ text = str_replace ( '_' , ' ' , $ text ) ; // treat underscores as spaces $ text = preg_replace ( '/^\s+|\s+$/' , '' , $ text ) ; // trim leading/trailing spaces $ text = preg_replace ( '/[-\s]+/' , '-' , $ text ) ; // convert spaces to hyphens $ text = strtolower ( $ text ) ; // convert to lowercase return trim ( substr ( $ text , 0 , $ max_length ) , '-' ) ; // trim to first $maxlength chars }
Takes text and returns it in the "lowercase-and-dashed-with-no-punctuation" format.

@param string $handle
@param int    $max_length           Max number of characters of the return value
@param string $locale              Language code of the language rules that should be priorized
@param bool   $removeExcludedWords Set to true to remove excluded words, false to allow them.

@return string
Takes text and returns it in the lowercase - and - dashed - with - no - punctuation format .