You are here

function lost_character_process in CAPTCHA Pack 7

Same name and namespace in other branches
  1. 8 text_captcha/modules/lost_character_captcha/lost_character_captcha.module \lost_character_process()
  2. 6 text_captcha/lost_character_captcha/lost_character_captcha.module \lost_character_process()

Process the response before validation.

1 string reference to 'lost_character_process'
lost_character_captcha_captcha in text_captcha/lost_character_captcha/lost_character_captcha.module
Implements hook_captcha().

File

text_captcha/lost_character_captcha/lost_character_captcha.module, line 98

Code

function lost_character_process($element, $edit) {
  $response = $element['#value'];

  // Remove white spaces
  $parts = _text_captcha_whitespace_explode($response);
  $response = implode('', $parts);

  // Split in utf8 characters, sort and rejoin
  $characters = _text_captcha_utf8_split($response);
  sort($characters);
  $response = implode('', $characters);

  // Put back in element and return.
  $element['#value'] = $response;
  return $element;
}