public static function filter($text, $length = 60)
{
$text = self::downcode($text);
// remove all these words from the string before urlifying
$text = preg_replace('/\\b(' . implode('|', self::$remove_list) . ')\\b/i', '', $text);
// if downcode doesn't hit, the char will be stripped here
$text = preg_replace('/[^-\\w\\s]/', '', $text);
// remove unneeded chars
$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, $length), '-');
// trim to first
// $length
// chars
}