4 public static function cleanString($string, $separator =
'-',$cleanPunctuation = TRUE, $cleanSlash = TRUE)
8 'a',
'an',
'as',
'at',
'before',
'but',
'by',
'for',
'from',
'is',
'in',
9 'into',
'like',
'of',
'off',
'on',
'onto',
'per',
'since',
'than',
'the',
10 'this',
'that',
'to',
'up',
'via',
'with',
14 if ($cleanPunctuation)
17 foreach ($punctuation as $name => $details)
20 $output = str_replace($details[
'value'], $separator, $output);
27 $output = str_replace(
'/',
'', $output);
31 $translations = self::i18nToAscII();
32 $output = strtr($output, $translations);
39 $ignoreRe =
'\b'. preg_replace(
'/,/',
'\b|\b', $ignoreWords) .
'\b';
41 if (function_exists(
'mb_eregi_replace'))
43 $output = mb_eregi_replace($ignoreRe,
'', $output);
47 $output = preg_replace(
"/$ignoreRe/i",
'', $output);
51 $output = preg_replace(
'/\s+/', $separator, $output);
79 public static function cleanSeparators($string, $separator = NULL, $toLowCase = TRUE)
84 if (isset($separator) && strlen($separator))
87 $seppattern = preg_quote($separator,
'/');
90 $output = preg_replace(
"/^$seppattern+|$seppattern+$/",
'', $output);
93 $output = preg_replace(
"/$seppattern+\/|\/$seppattern+/",
"/", $output);
96 $output = preg_replace(
"/$seppattern+/", $separator, $output);
102 $output = strtolower($output);
123 "double_quotes"=>
'"',
148 "left_parenthesis"=>
"(",
149 "right_parenthesis"=>
")",
150 "question_mark"=>
"?",
157 public static function i18nToAscII()