function rules_path_default_cleaning_method

Cleans the given path.

A path is cleaned by replacing non ASCII characters in the path with the replacement character.

Path cleaning may be customized by overriding the configuration variables:

rules_clean_path;

,

rules_path_replacement_char;

and

rules_path_transliteration;

in the site's settings.php file.

Related topics

2 string references to 'rules_path_default_cleaning_method'
rules_admin_settings in rules_admin/rules_admin.inc
Rules settings form.
rules_clean_path in modules/path.eval.inc
Cleans the given string so it can be used as part of a URL path.

File

modules/path.eval.inc, line 89

Code

function rules_path_default_cleaning_method($path) {
    $replace = variable_get('rules_path_replacement_char', '-');
    if ($replace) {
        // If the transliteration module is enabled, transliterate the alias first.
        if (module_exists('transliteration') && variable_get('rules_path_transliteration', TRUE)) {
            $path = transliteration_get($path);
        }
        $array = variable_get('rules_clean_path', array(
            '/[^a-zA-Z0-9\\-_]+/',
            $replace,
        ));
        $array[2] = $path;
        // Replace it and remove trailing and leading replacement characters.
        $output = trim(call_user_func_array('preg_replace', $array), $replace);
        if (variable_get('rules_path_lower_case', TRUE)) {
            $output = drupal_strtolower($output);
        }
        return $output;
    }
    else {
        return $path;
    }
}