X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fpathauto%2Fsrc%2FAliasCleaner.php;fp=web%2Fmodules%2Fcontrib%2Fpathauto%2Fsrc%2FAliasCleaner.php;h=cb8b6d1255c5b0c5fb6266a8639743eaee58f579;hp=340a266736abebd5f90cf51aa31e11ae059192df;hb=059867c3f96750652c80f39e44c442a58c2549ee;hpb=f8fc16ae6b862bef59baaad5d051dd37b7ff11b2 diff --git a/web/modules/contrib/pathauto/src/AliasCleaner.php b/web/modules/contrib/pathauto/src/AliasCleaner.php index 340a26673..cb8b6d125 100644 --- a/web/modules/contrib/pathauto/src/AliasCleaner.php +++ b/web/modules/contrib/pathauto/src/AliasCleaner.php @@ -104,7 +104,7 @@ class AliasCleaner implements AliasCleanerInterface { // 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. @@ -247,7 +247,7 @@ class AliasCleaner implements AliasCleanerInterface { // 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; } } @@ -260,7 +260,7 @@ class AliasCleaner implements AliasCleanerInterface { // 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. @@ -335,7 +335,9 @@ class AliasCleaner implements AliasCleanerInterface { 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); } }