You are here

function domain_url_encode in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 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_tokens in ./domain.tokens.inc
Implements hook_tokens().

File

./domain.module, line 3426
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;
}