You are here

function rules_clean_path in Rules 6

Same name and namespace in other branches
  1. 7.2 modules/path.eval.inc \rules_clean_path()

Cleans the given path by replacing non ASCII characters with the given $replace parameter

Furthermore it allows customization by overriding the variable rules_clean_path in the settings.php

Related topics

3 calls to rules_clean_path()
rules_action_node_path_alias in rules/modules/path.rules.inc
Action Implementation
rules_action_path_alias in rules/modules/path.rules.inc
Action Implementation
rules_condition_alias_exists in rules/modules/path.rules.inc
Condition implementation: Check if the URL alias already exists

File

rules/modules/path.rules.inc, line 106
Rules integration for the path module

Code

function rules_clean_path($path, $replace) {
  if ($replace) {
    $array = variable_get('rules_clean_path', array(
      '/[^a-zA-Z0-9\\/\\-_]+/',
      $replace,
    ));
    $array[2] = $path;

    //replace it and remove trailing and leading replacement characters
    return trim(call_user_func_array('preg_replace', $array), $replace);
  }
  else {
    return $path;
  }
}