// Trim duplicate, leading, and trailing separators. Do this before cleaning
// backslashes since a pattern like "[token1]/[token2]-[token3]/[token4]"
// could end up like "value1/-/value2" and if backslashes were cleaned first
- // this would result in a duplicate blackslash.
+ // this would result in a duplicate backslash.
$output = $this->getCleanSeparators($output);
// Trim duplicate, leading, and trailing backslashes.
// Get rid of words that are on the ignore list.
if ($this->cleanStringCache['ignore_words_regex']) {
$words_removed = $this->cleanStringCache['ignore_words_callback']($this->cleanStringCache['ignore_words_regex'], '', $output);
- if (Unicode::strlen(trim($words_removed)) > 0) {
+ if (mb_strlen(trim($words_removed)) > 0) {
$output = $words_removed;
}
}
// Optionally convert to lower case.
if ($this->cleanStringCache['lowercase']) {
- $output = Unicode::strtolower($output);
+ $output = mb_strtolower($output);
}
// Shorten to a logical place based on word boundaries.
public function cleanTokenValues(&$replacements, $data = array(), $options = array()) {
foreach ($replacements as $token => $value) {
// Only clean non-path tokens.
- if (!preg_match('/(path|alias|url|url-brief)\]$/', $token)) {
+ $config = $this->configFactory->get('pathauto.settings');
+ $safe_tokens = implode('|', (array) $config->get('safe_tokens'));
+ if (!preg_match('/:(' . $safe_tokens . ')(:|\]$)/', $token)) {
$replacements[$token] = $this->cleanString($value, $options);
}
}