You are here

function domain_url_encode in Domain Access 6.2

Same name and namespace in other branches
  1. 7.3 domain.module \domain_url_encode()
  2. 7.2 domain.module \domain_url_encode()

Simple function to clean strings for use in for example paths.

1 call to domain_url_encode()
domain_token_values in ./domain.module
Implement hook_token_values().

File

./domain.module, line 2793
Core module functions for the Domain Access suite.

Code

function domain_url_encode($string) {
  $string = drupal_strtolower($string);

  // Remove slashes.
  $string = str_replace('/', '', $string);

  // Reduce to the subset of ASCII96 letters and numbers - from Pathauto.
  $pattern = '/[^a-zA-Z0-9\\/]+/ ';
  $string = preg_replace($pattern, '', $string);

  // Remove white space - from Pathauto.
  $string = preg_replace('/\\s+/', '', $string);
  return $string;
}