diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 2ac0499ca..59646b85f 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -4278,9 +4278,16 @@ class eHelper */ public static function title2sef($title, $type = null) { - $title = preg_replace('/[^\w\pL\s.,]/u', '', strip_tags(e107::getParser()->toHTML($title, TRUE))); + $title = str_replace(array("&",",","(",")"),'',$title); + $title = preg_replace('/[^\w\pL\s.]/u', '', strip_tags(e107::getParser()->toHTML($title, TRUE))); $title = trim(preg_replace('/[\s]+/', ' ', str_replace('_', ' ', $title))); - + + $words = str_word_count($title,1); + + $limited = array_slice($words, 0, 14); // Limit number of words to 14. - any more and it ain't friendly. + + $title = implode(" ",$limited); + if(null === $type) { $type = e107::getPref('url_sef_translate');