mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +02:00
Truncate Generated SEF-URLs to an acceptable length.
This commit is contained in:
@@ -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');
|
||||
|
Reference in New Issue
Block a user