function domain_url_encode in Domain Access 7.2
Same name and namespace in other branches
- 6.2 domain.module \domain_url_encode()
- 7.3 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 2880 - 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;
}