You are here

function pathauto_clean_token_values in Pathauto 5.2

Same name and namespace in other branches
  1. 6.2 pathauto.inc \pathauto_clean_token_values()
  2. 6 pathauto.inc \pathauto_clean_token_values()
  3. 7 pathauto.inc \pathauto_clean_token_values()

Clean tokens so they are URL friendly.

Parameters

$full: An array of token values that need to be "cleaned" for use in the URL.

Return value

An array of the cleaned tokens.

1 call to pathauto_clean_token_values()
pathauto_get_placeholders in ./pathauto.inc
Generalized function to get tokens across all Pathauto types.

File

./pathauto.inc, line 441
Miscellaneous functions for Pathauto.

Code

function pathauto_clean_token_values($full) {
  foreach ($full->values as $key => $value) {

    // If it's a "path" or "url friendly" token don't remove the "/" character
    if (drupal_substr($full->tokens[$key], -4, 4) === 'path' || drupal_substr($full->tokens[$key], -8, 8) === 'path-raw' || drupal_substr($full->tokens[$key], -5, 5) === 'alias') {
      $full->values[$key] = pathauto_cleanstring($value, FALSE);
    }
    else {
      $full->values[$key] = pathauto_cleanstring($value);
    }
  }
  return $full->values;
}