function pathauto_cleanstring in Pathauto 5        
                          
                  
                        Same name and namespace in other branches
- 5.2 pathauto.inc \pathauto_cleanstring()
 - 6.2 pathauto.inc \pathauto_cleanstring()
 - 6 pathauto.inc \pathauto_cleanstring()
 - 7 pathauto.inc \pathauto_cleanstring()
 
 
11 calls to pathauto_cleanstring()
  - blog_pathauto_bulkupdate in ./pathauto_user.inc
 
  
  - event_pathauto_node in contrib/pathauto_node_event.inc
 
  
  - forum_pathauto_bulkupdate in ./pathauto_taxonomy.inc
 
  - Generate aliases for all forums and forum containers without aliases
 
  - node_get_placeholders in ./pathauto_node.inc
 
  
  - pathauto_menu_get_placeholders in ./pathauto_menu.inc
 
  - Generate the menu placeholders.
 
... See full list
 
File
 
   - ./pathauto.module, line 220
 
  
Code
function pathauto_cleanstring($string) {
  
  $ignore_words = array(
    "a",
    "an",
    "as",
    "at",
    "before",
    "but",
    "by",
    "for",
    "from",
    "is",
    "in",
    "into",
    "like",
    "of",
    "off",
    "on",
    "onto",
    "per",
    "since",
    "than",
    "the",
    "this",
    "that",
    "to",
    "up",
    "via",
    "with",
  );
  static $i18n_loaded = false;
  static $translations = array();
  if (!$i18n_loaded) {
    $path = drupal_get_path('module', 'pathauto');
    if (is_file($path . '/i18n-ascii.txt')) {
      $translations = parse_ini_file($path . '/i18n-ascii.txt');
    }
    $i18n_loaded = true;
  }
  $output = strtr($output, $translations);
  
  $separator = variable_get('pathauto_separator', '-');
  $quotes = variable_get('pathauto_quotes', 0);
  $output = str_replace("'", $quotes ? $separator : '', $string);
  
  
  $output = strtr($output, $translations);
  
  $ignore_re = "\\b" . preg_replace("/,/", "\\b|\\b", variable_get('pathauto_ignore_words', $ignore_words)) . "\\b";
  $output = preg_replace("/{$ignore_re}/ie", "", $output);
  
  $pattern = '/[^a-zA-Z0-9]+/ ';
  $output = preg_replace($pattern, $separator, $output);
  
  if ($separator) {
    if (ctype_alnum($separator)) {
      $seppattern = $separator;
    }
    else {
      $seppattern = '\\' . $separator;
    }
    $output = preg_replace("/^{$seppattern}+|{$seppattern}+\$/", "", $output);
  }
  
  $maxlength = min(variable_get('pathauto_max_component_length', 100), 128);
  $output = drupal_substr($output, 0, $maxlength);
  return $output;
}