static function crumbs_Util::cleanTokenValues in Crumbs, the Breadcrumbs suite 7.2
Clean tokens so they are URL friendly.
Taken directly from pathauto_clean_token_values(). Using the pathauto function directly is not an option, because it can be that pathauto is not installed.
Parameters
$replacements: An array of token replacements that need to be "cleaned" for use in the URL.
$data: An array of objects used to generate the replacements.
$options: An array of options used to generate the replacements.
See also
1 call to crumbs_Util::cleanTokenValues()
- crumbs_clean_token_values in ./
crumbs.module - Clean tokens so they are URL friendly. Taken directly from pathauto_clean_token_values()
File
- lib/
Util.php, line 26
Class
- crumbs_Util
- Static methods that don't fit elsewhere. Ideally these are all stateless and do not depend on anything. But at least one of them is not..
Code
static 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)) {
// We use a simple regex instead of pathauto_cleanstring().
$value = preg_replace('#[^a-z0-9/]+#', '-', strtolower($value));
}
}
}