You are here

function _webform_safe_name in Webform 6.3

Same name and namespace in other branches
  1. 5.2 webform.module \_webform_safe_name()
  2. 5 webform.module \_webform_safe_name()
  3. 6.2 webform.module \_webform_safe_name()
  4. 7.4 webform.module \_webform_safe_name()
  5. 7.3 webform.module \_webform_safe_name()
3 calls to _webform_safe_name()
webform_component_edit_form in includes/webform.components.inc
Form to configure a webform component.
webform_expand_select_ids in components/select.inc
FAPI process function to rename IDs attached to checkboxes and radios.
webform_results_download in includes/webform.report.inc
Send a generated webform results file to the user's browser.

File

./webform.module, line 3113

Code

function _webform_safe_name($name) {
  $new = trim($name);

  // If transliteration is available, use it to convert names to ASCII.
  if (function_exists('transliteration_get')) {
    $new = transliteration_get($new, '');
    $new = str_replace(array(
      ' ',
      '-',
      '/',
    ), array(
      '_',
      '_',
      '_',
    ), $new);
  }
  else {
    $new = str_replace(array(
      ' ',
      '-',
      '/',
      '€',
      'ƒ',
      'Š',
      'Ž',
      'š',
      'ž',
      'Ÿ',
      '¢',
      '¥',
      'µ',
      'À',
      'Á',
      'Â',
      'Ã',
      'Ä',
      'Å',
      'Ç',
      'È',
      'É',
      'Ê',
      'Ë',
      'Ì',
      'Í',
      'Î',
      'Ï',
      'Ñ',
      'Ò',
      'Ó',
      'Ô',
      'Õ',
      'Ö',
      'Ø',
      'Ù',
      'Ú',
      'Û',
      'Ü',
      'Ý',
      'à',
      'á',
      'â',
      'ã',
      'ä',
      'å',
      'ç',
      'è',
      'é',
      'ê',
      'ë',
      'ì',
      'í',
      'î',
      'ï',
      'ñ',
      'ò',
      'ó',
      'ô',
      'õ',
      'ö',
      'ø',
      'ù',
      'ú',
      'û',
      'ü',
      'ý',
      'ÿ',
      'Œ',
      'œ',
      'Æ',
      'Ð',
      'Þ',
      'ß',
      'æ',
      'ð',
      'þ',
    ), array(
      '_',
      '_',
      '_',
      'E',
      'f',
      'S',
      'Z',
      's',
      'z',
      'Y',
      'c',
      'Y',
      'u',
      'A',
      'A',
      'A',
      'A',
      'A',
      'A',
      'C',
      'E',
      'E',
      'E',
      'E',
      'I',
      'I',
      'I',
      'I',
      'N',
      'O',
      'O',
      'O',
      'O',
      'O',
      'O',
      'U',
      'U',
      'U',
      'U',
      'Y',
      'a',
      'a',
      'a',
      'a',
      'a',
      'a',
      'c',
      'e',
      'e',
      'e',
      'e',
      'i',
      'i',
      'i',
      'i',
      'n',
      'o',
      'o',
      'o',
      'o',
      'o',
      'o',
      'u',
      'u',
      'u',
      'u',
      'y',
      'y',
      'OE',
      'oe',
      'AE',
      'DH',
      'TH',
      'ss',
      'ae',
      'dh',
      'th',
    ), $new);
  }
  $new = drupal_strtolower($new);
  $new = preg_replace('/[^a-z0-9_]/', '', $new);
  return $new;
}