You are here

function transliteration_filter in Transliteration 6.3

Implements hook_filter().

File

./transliteration.module, line 192
Converts non-latin text to US-ASCII and sanitizes file names.

Code

function transliteration_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
  switch ($op) {
    case 'list':
      return array(
        t('Convert all characters to US-ASCII'),
      );
    case 'no cache':
      return FALSE;
    case 'process':
      return transliteration_get($text, variable_get("transliteration_filter_no_known_transliteration_{$format}", '?'));
    case 'settings':
      return array(
        'filter_transliteration' => array(
          '#type' => 'fieldset',
          '#title' => 'Transliteration',
          '#collapsible' => TRUE,
          '#collapsed' => FALSE,
          "transliteration_filter_no_known_transliteration_{$format}" => array(
            '#type' => 'textfield',
            '#title' => t('Placeholder for characters with no known US-ASCII equivalent'),
            '#size' => 2,
            // The maximum length is 5 in order to accommodate unicode multibyte input.
            '#maxlength' => 5,
            '#default_value' => variable_get("transliteration_filter_no_known_transliteration_{$format}", '?'),
          ),
        ),
      );
    default:
      return $text;
  }
}